- 积分
- 5268
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-7-10
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 yysunnyboy 于 2019-4-16 03:45 编辑
大家好,我想使用North American Regional Reanalysis (NARR)的数据进行气温的绘制,NARR的数据范围涵盖整个北美,而我只需要画出加拿大范围内的。由于NARR的特殊投影方式(Lambert Conformal),NARR以及NCL都建议使用 res@mpLimitMode = "Corners"来选取指定区域的数据。这个例子可以在NCL官网找到,链接如下:https://www.ncl.ucar.edu/Applications/narr.shtml
; open file and read in data
;-----------------------------------------------
diri = "./" ; input directory
f = addfile (diri+"air.200001.nc", "r")
; convert short=>float
;
; This file has two missing values, which are not the same.
; The _FillValue is -32767, while missing_value is 32766.
; Fix this by setting _FillValue to missing_value, so that
; all values equal to 32766 get marked as missing, and then
; convert to float using short2flt.
;
x_short = f->air(10,:,:,:) ; (11th time index,lev,lat,lon)
x_short@_FillValue = x_short@missing_value ; fix missing value
x = short2flt( x_short ) ; apply scale and offset attributes
delete(x_short)
printVarSummary(x)
printMinMax(x,0)
lat2d = f->lat ; coordinates
lon2d = f->lon
dimlc = dimsizes(lat2d) ; dimension sizes
nlat = dimlc(0)
mlon = dimlc(1)
;-----------------------------------------------
; Create plots
;-----------------------------------------------
wks = gsn_open_wks ("png", "narr") ; send graphics to PNG file
cmap = read_colormap_file("gui_default") ; read color data
res = True ; plot mods desired for original grid
res@cnFillOn = True ; color fill
res@cnFillPalette = cmap(2:,:) ; set color map
res@cnLinesOn = False ; no contour lines
res@mpGridAndLimbOn = True
res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
res@tmXTOn = False
res@gsnAddCyclic = False ; regional data
res@mpLimitMode = "Corners" ; choose range of map
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(nlat-1,mlon-1)
res@mpRightCornerLonF = lon2d(nlat-1,mlon-1)
res@tfDoNDCOverlay = True
res@mpProjection = "LambertConformal"
res@mpLambertParallel1F = f->Lambert_Conformal@standard_parallel(0)
res@mpLambertParallel2F = f->Lambert_Conformal@standard_parallel(1)
res@mpLambertMeridianF = f->Lambert_Conformal@longitude_of_central_meridian
res@gsnCenterString = "T@"+x&level(3) + "hPa" ; draw center subtitle
res@gsnLeftString = "Original grid" ; draw left subtitle
plot = gsn_csm_contour_map(wks,x(3,:,:),res) ; Draw original grid on map
end
以上的脚本文件可以正确画出北美的气温图,然而,当我想更改mpLimitMode = "Corners" 的参数来画出加拿大范围内的数据时,就会出错。例如,加拿大范围内本来没有红色,但下面的图中加拿大却出现了红色。并且,y轴的纬度刻度也是错误的,请问大家该如何解决呢?谢谢。以下是我修改的脚本,其余与上面的脚本一样。
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat2d(100,100)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(150,200)
res@mpRightCornerLonF = lon2d(nlat-1,mlon-1)
|
|