- 积分
- 10658
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-10-10
- 最后登录
- 1970-1-1
|
发表于 2014-4-2 09:25:21
|
显示全部楼层
本帖最后由 longlivehj 于 2014-4-2 09:58 编辑
http://www.mmm.ucar.edu/wrf/OnLi ... CL/NCL_examples.htm
上面链接里有很多非常实用的例子。我也是在其中一个基础上稍作修改,就可以作出你要的图。
下面是我整理过的代码,贴出来供你参考。
; Example script plots all data in a geo_em file
; November 2008
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
a = addfile("./geo_em.d01.nc","r") ; Open a file
v = a->LU_INDEX ; Read the variable to memory
type = "png"
; type = "pdf"
; type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"landuse") ; Create a plot workstation
gsn_define_colormap(wks,"StepSeq25")
mpres = True ; Set map options
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGeophysicalLineThicknessF = 2.
mpres@mpOutlineBoundarySets = "National"
mpres@mpNationalLineColor = "Black"
mpres@mpNationalLineThicknessF = 2
opts = True ; Set some Basic Plot options
opts@InitTime = False ; Do not plot time or footers
opts@Footer = False
opts@cnFillOn = True
opts@cnFillMode = "RasterFill"
opts@cnExplicitLabelBarLabelsOn = True
opts@ContourParameters = (/ 2,24,1 /)
opts@lbLabelStrings = (/ "Urban and Built-Up Land", "Dryland Cropland and Pasture", \
"Irrigated Cropland and Pasture", "Mixed Dryland/Irrigated Cropland", \
"Cropland/Grassland Mosaic", "Cropland/Woodland Mosaic", "Grassland", \
"Shrubland", "Mixed Shrubland/Grassland", "Savanna", \
"Deciduous Broadleaf Forest", "Deciduous Needleleaf Forest", \
"Evergreen Broadleaf Forest", "Evergreen Needleleaf Forest", \
"Mixed Forest", "Water Bodies", "Herbaceous Wetland", "Wooded Wetland", \
"Barren or Sparsely Vegetated", "Herbaceous Tundra", "Wooded Tundra", \
"Mixed Tundra", "Bare Ground Tundra", "Snow or Ice" /)
opts@lbLabelAngleF = 270.0
opts@lbLabelAlignment = "BoxCenters"
opts@lbTitleOn = False
opts@lbLabelFontHeightF = 0.01
opts@lbLabelJust = "CenterLeft"
opts@pmLabelBarOrthogonalPosF = 0.01
opts@FieldTitle = "LU_INDEX : "+ v@description ; overwrite field name
contour = wrf_contour(a,wks,v(0,:,:),opts)
plot = wrf_map_overlays(a,wks,(/contour/),True,mpres)
end
|
|