爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 11219|回复: 8

[作图] ncl绘制ERA在分析资料风场请教

[复制链接]

新浪微博达人勋

发表于 2016-8-2 18:04:58 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
为何ncl画ERA在分析资料风场总是报错,以下是代码。求各位大侠赐教

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
  f=addfile("/home/newcmaq/history/data/Interim/era201512.nc","r")
  wks = gsn_open_wks("png","wind")
   v500  = f->v(16,15,:,:)
   u500  = f->u(16,15,:,:)
   v1=v500*0.00186544395079936
   u1=u500*0.00193238582520567
   lat=f->latitude
   lon=f->longitude
   lat@units="degrees_north"
   lon@units="degrees_east"
   v1!0="lat"
   v1!1="lon"  
   u1!0="lat"
   u1!1="lon"  
; Set some Basic Plot options
   res=True
   res@gsnAddCyclic = False
   res@gsnMaximize             = True
   res@mpMinLatF               = 16.                        
   res@mpMaxLatF               = 54.
   res@mpMinLonF               = 73.
   res@mpMaxLonF               = 135.
   ;res@gsnDraw                 = False
   ;res@gsnFrame                = False
   res@mpDataBaseVersion       = "MediumRes"
   res@mpDataSetName           = "Earth..4"
   res@mpOutlineOn           = True         ; Turn on map outlines
   res@mpOutlineSpecifiers   = (/"China:states","Taiwan"/)
      ;China:states
   res@mpProvincialLineColor="black"
   res@mpProvincialLineThicknessF=1
   
   res@mpLandFillColor         = "white"
   res@mpInlandWaterFillColor  = "white"
   res@mpOceanFillColor        = "blue"
   res@mpOutlineBoundarySets   = "NoBoundaries"
;  res@mpFillDrawOrder = "PostDraw"

   
;   res@vcRefMagnitudeF         = 40.                ; make vectors  larger
;  res@vcRefLengthF            = 0.045              ; ref vec length
;  res@vcMinDistanceF        = 0.001                ; thin out vectors
   
   res@vcGlyphStyle            = "WindBarb"
   res@vcMinDistanceF        = 0.07
   res@vcWindBarbColor     = "Blue"               
   res@vpXF = 0     ;左边距
   res@vpYF = 0      ;上边距
   res@vpWidthF  = 1.0              ; height and width of plot
   res@vpHeightF = 0.8
            
   plot = gsn_csm_vector_map(wks,u1,v1,res)
end



ERA文件信息
netcdf era201512 {
dimensions:
longitude = 480 ;
latitude = 241 ;
level = 16 ;
time = UNLIMITED ; // (124 currently)
variables:
float longitude(longitude) ;
  longitude:units = "degrees_east" ;
  longitude:long_name = "longitude" ;
float latitude(latitude) ;
  latitude:units = "degrees_north" ;
  latitude:long_name = "latitude" ;
int level(level) ;
  level:units = "millibars" ;
  level:long_name = "pressure_level" ;
int time(time) ;
  time:units = "hours since 1900-01-01 00:00:0.0" ;
  time:long_name = "time" ;
  time:calendar = "gregorian" ;
short z(time, level, latitude, longitude) ;
  z:scale_factor = 0.982048464609433 ;
  z:add_offset = 26467.8468663927 ;
  z:_FillValue = -32767s ;
  z:missing_value = -32767s ;
  z:units = "m**2 s**-2" ;
  z:long_name = "Geopotential" ;
  z:standard_name = "geopotential" ;
short r(time, level, latitude, longitude) ;
  r:scale_factor = 0.00239670312113763 ;
  r:add_offset = 55.4724063275471 ;
  r:_FillValue = -32767s ;
  r:missing_value = -32767s ;
  r:units = "%" ;
  r:long_name = "Relative humidity" ;
  r:standard_name = "relative_humidity" ;
short u(time, level, latitude, longitude) ;
  u:scale_factor = 0.00193238582520567 ;
  u:add_offset = 12.7802990658765 ;
  u:_FillValue = -32767s ;
  u:missing_value = -32767s ;
  u:units = "m s**-1" ;
  u:long_name = "U component of wind" ;
  u:standard_name = "eastward_wind" ;
short v(time, level, latitude, longitude) ;
  v:scale_factor = 0.00186544395079936 ;
  v:add_offset = 2.08933827411835 ;
  v:_FillValue = -32767s ;
  v:missing_value = -32767s ;
  v:units = "m s**-1" ;
  v:long_name = "V component of wind" ;
  v:standard_name = "northward_wind" ;
// global attributes:
  :Conventions = "CF-1.6" ;
  :history = "2016-08-02 02:33:26 GMT by grib_to_netcdf-1.16.0: grib_to_netcdf /data/data01/scratch/_mars-atls09-95e2cf679cd58ee9b4db4dd119a05a8d-Fo1V4j.grib -o /data/data01/scratch/_grib2netcdf-atls00-95e2cf679cd58ee9b4db4dd119a05a8d-_h3EqG.nc -utime" ;
}


报错信息:
(0)     check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0)     A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
(0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0)     check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
(0)     A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
(0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'


密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-8-3 10:28:07 | 显示全部楼层
问题已解决
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-3 10:39:23 | 显示全部楼层

楼主可以把解决方法分享一下啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-8-3 10:44:54 | 显示全部楼层
好的 等整理好了 马上分享
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-8-3 10:45:37 | 显示全部楼层
实际很简单,添加几行
v1!0="lat"
   v1&lat=v500&latitude
   v1!1="lon"
   v1&lon=v500&longitude
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-10 21:44:00 | 显示全部楼层
非常感谢楼主点睛,同样遇到这样的问题已经解决
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2021-4-22 17:25:32 | 显示全部楼层
   v500  = f->v(16,15,:,:)
   u500  = f->u(16,15,:,:)
   v1=v500*0.00186544395079936
   u1=u500*0.00193238582520567

这里面的16,15, 0.00186544395079936, 0.00193238582520567代表什么呀
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-1-2 15:33:40 | 显示全部楼层
感谢楼主慷慨分享  
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-5-23 09:07:56 | 显示全部楼层
green_tea789 发表于 2021-4-22 17:25
v500  = f->v(16,15,:,:)
   u500  = f->u(16,15,:,:)
   v1=v500*0.00186544395079936

16是第16个时次,15是第15个高度层。u500和v500你知道了为什么乘那一串数字了吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表