- 积分
- 351
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-7-8
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2013-9-28 10:11:31
|
显示全部楼层
peter19192009 发表于 2013-9-27 15:19
最好能介绍你用的是什么数据,什么数据格式,变量是什么,否则你这么说,很难帮助你。
我用的是nc文件,如下:
netcdf mksrf_soitex.10level.c010119 {
dimensions:
lon = 4320 ;
lat = 2160 ;
number_of_layers = 10 ;
number_of_mapunits = 4931 ;
max_value_mapunit = 6998 ;
variables:
float LON(lon) ;
LON:long_name = "lon" ;
LON:units = "degrees east" ;
float LAT(lat) ;
LAT:long_name = "lat" ;
LAT:units = "degrees north" ;
float LONGXY(lat, lon) ;
LONGXY:long_name = "longitude-2d" ;
LONGXY:units = "degrees east" ;
float LATIXY(lat, lon) ;
LATIXY:long_name = "latitude-2d" ;
LATIXY:units = "degrees north" ;
float LANDMASK(lat, lon) ;
LANDMASK:long_name = "land mask" ;
LANDMASK:units = "unitless" ;
float DZSOI(number_of_layers) ;
DZSOI:long_name = "soil layer thickness" ;
DZSOI:units = "m" ;
float ZSOI(number_of_layers) ;
ZSOI:long_name = "soil layer depth" ;
ZSOI:units = "m" ;
float EDGEN ;
EDGEN:long_name = "northern edge of surface grid" ;
EDGEN:units = "degrees north" ;
float EDGEE ;
EDGEE:long_name = "eastern edge of surface grid" ;
EDGEE:units = "degrees east" ;
float EDGES ;
EDGES:long_name = "southern edge of surface grid" ;
EDGES:units = "degrees north" ;
float EDGEW ;
EDGEW:long_name = "western edge of surface grid" ;
EDGEW:units = "degrees east" ;
float MAPUNITS(lat, lon) ;
MAPUNITS:long_name = "igbp soil mapunit" ;
MAPUNITS:units = "unitless" ;
float PCT_SAND(number_of_layers, max_value_mapunit) ;
PCT_SAND:long_name = "percent sand" ;
PCT_SAND:units = "unitless" ;
float PCT_CLAY(number_of_layers, max_value_mapunit) ;
PCT_CLAY:long_name = "percent clay" ;
PCT_CLAY:units = "unitless" ;
ncl 设置如下:
;*******************导入库函数******************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;************************************************
begin
f = addfile ("mksrf_soitex.10level.c010119.nc", "r")
P = f->PCT_SAND
LAT2D= f->LATIXY
LON2D= f->LONGXY
LAT2D&lat= f->LAT
LAT2D&lon= f->LON
LON2D&lat= f->LAT
LON2D&lon= f->LON
;printVarSummary(P)
;exit
;end
;p = P(time|:,pft|:,lat|:,lon|:)
;lon2d=LON2D(lat|:,lon|:)
;lat2d=LAT2D(lat|:,lon|:)
wks = gsn_open_wks ("ps", "lcnative") ; open workstation
gsn_define_colormap (wks,"gui_default")
;wks = gsn_open_wks("X11","barnes")
res=True
;;;;;;;;;;;限定地图区域绘图;;;;;;地图和数据要分别设置,互相独立;;;;;;;;;;;;;
res@gsnAddCyclic = False
;res@mpLimitMode = "LatLon"
res@mpMinLatF = 10
res@mpMaxLatF = 60
res@mpMinLonF = 65
res@mpMaxLonF = 140
;;;;;;;;;;;;;只显示中国区域的图;;;;;;;;;;;;;;;;;;;;;;
res@mpDataBaseVersion="Ncarg4_1" ;中等分辨率
res@mpDataSetName="Earth..4" ;第4版地图,有中国边界数据
res@mpOutlineOn = True
res@mpOutlineSpecifiers=(/"China:states","Taiwan"/) ;中国边界有问题,缺藏南、台湾
res@mpOutlineBoundarySets ="NoBoundaries"
;;;;;;;;;;;填充颜色;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res@cnFillDrawOrder = "PreDraw" ;设置画图顺序,先填充颜色,后把海洋覆盖掉
res@mpAreaMaskingOn = True ;使能填充覆盖
res@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/)
res@mpOceanFillColor = 0 ;用白色填充海洋0是colormap的索引值
res@mpInlandWaterFillColor = 0
;res@tiMainString = "Bare land"
;res@tiMainString = "Needleleaf evergreen tree-temperate"
;res@tiMainString = "Needleleaf evergreen tree-boreal"
;res@tiMainString = "Needleleaf deciduous tree-boreal"
;res@tiMainString = "Broadleaf evergreen tree-tropical"
;res@tiMainString = "Broadleaf evergreen tree-temperate"
;res@tiMainString = "Broadleaf deciduous tree-tropical"
;res@tiMainString = "Broadleaf deciduous tree-temperate"
;res@tiMainString = "Broadleaf deciduous tree-boreal"
;res@tiMainString = "Broadleaf evergreen shrub-temperate"
;res@tiMainString = "Broadleaf deciduous shrub-temperate"
;res@tiMainString = "Broadleaf deciduous shrub-boreal"
;res@tiMainString = "C3 arctic grass"
;res@tiMainString = "C3 grass"
;res@tiMainString = "C4 grass"
;res@tiMainString = "Crop 1"
;res@tiMainString = "Crop 2"
res@cnFillOn = True
res@cnLinesOn = False ;等值线不显示
res@cnLineLabelsOn = False
;plot = gsn_csm_contour_map(wks,P(0,:,:),res)
plot = gsn_csm_contour_map(wks,P(0,0),res)
end |
|