爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 13143|回复: 0

[作图] ncl采用兰伯特投影画fnl环流形势 方形

[复制链接]
发表于 2019-4-15 21:15:19 | 显示全部楼层 |阅读模式
3金钱
脚本如下想采用兰伯特投影画图,但想把图设置为矩形的
求大家指点,急急急急急急……
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

begin
f1   = addfile("/cygdrive/c/Users/Administrator/Desktop/FNL/fnl_20180914_06_00.grib2","r")
hgt1 = f1->HGT_P0_L100_GLL0({50000}, :, :)
u1 = f1->UGRD_P0_L100_GLL0({50000}, ::4, ::4)
v1 = f1->VGRD_P0_L100_GLL0({50000}, ::4, ::4)

f2   = addfile("/cygdrive/c/Users/Administrator/Desktop/FNL/fnl_20180915_06_00.grib2","r")
hgt2 = f2->HGT_P0_L100_GLL0({50000}, :, :)
u2 = f2->UGRD_P0_L100_GLL0({50000}, ::4, ::4)
v2 = f2->VGRD_P0_L100_GLL0({50000}, ::4, ::4)

f3   = addfile("/cygdrive/c/Users/Administrator/Desktop/FNL/fnl_20180916_06_00.grib2","r")
hgt3 = f3->HGT_P0_L100_GLL0({50000}, :, :)
u3 = f3->UGRD_P0_L100_GLL0({50000}, ::4, ::4)
v3 = f3->VGRD_P0_L100_GLL0({50000}, ::4, ::4)

wks = gsn_open_wks("png", "/cygdrive/c/Users/Administrator/Desktop/FNL/500lambort")

plots = new(3,"graphic")
cnplots = new(3,"graphic")
vcplots = new(3,"graphic")


pres = True
pres@gsnDraw = True
pres@gsnFrame = True
pres@gsnLeftString = ""
pres@gsnRightString = ""
pres@gsnPanelCenter = True


;>---------------------------------------<
;            set for the map
;>---------------------------------------<
mpres = True
mpres@gsnDraw = False
mpres@gsnFrame = False
mpres@gsnLeftString = ""
mpres@gsnRightString = ""
mpres@mpFillOn                = False ;地图填充从开关

mpres@mpProjection            = "LambertConformal"
;mpres@mpLimitMode             = "Corners"
;mpres@mpCenterLatF  = 25.00002
;mpres@mpCenterLonF  = 130
;mpres@mpLeftCornerLatF = 0
;mpres@mpLeftCornerLonF = 101
;mpres@mpRightCornerLatF = 44.33
;mpres@mpRightCornerLonF = 165.5

mpres@gsnMaskLambertConformal = True
mpres@mpLimitMode             = "LatLon"
mpres@mpLambertMeridianF = 130.0
;mpres@mpLambertParallel1F = 25      ;Default: .001 ;可以自己改一改
;mpres@mpLambertParallel2F = 25    ;Default: 89.999
mpres@mpMinLatF               = 5.
mpres@mpMaxLatF               = 45.
mpres@mpMinLonF               = 100.
mpres@mpMaxLonF               = 160.

mpres@mpDataBaseVersion       = "MediumRes" ;用中等分辨率绘制地图
mpres@mpDataSetName           = "Earth..4"  ;数据集包含中国
mpres@mpOutlineSpecifiers     = (/"China:states"/) ;绘制轮廓名称

mpres@mpGeophysicalLineColor      = "Black"
mpres@mpNationalLineColor         = "Black"
mpres@mpUSStateLineColor          = "Black"
mpres@mpGridLineColor             = "Black"
mpres@mpLimbLineColor             = "Black"
mpres@mpPerimLineColor            = "Black"
mpres@mpGeophysicalLineThicknessF = 2.0
mpres@mpGridLineThicknessF        = 2.0
mpres@mpLimbLineThicknessF        = 2.0
mpres@mpNationalLineThicknessF    = 2.0
mpres@mpUSStateLineThicknessF     = 2.0


mpres@pmTickMarkDisplayMode  = "Always" ;显示标题
mpres@tmXBMajorLengthF = 0.005 ;坐标轴大刻度长度
;>---------------------------------------<
;>---------------------------------------<
;       set resource for contour plot
;>---------------------------------------<
cnres = True
cnres@gsnDraw = False
cnres@gsnFrame = False
cnres@gsnLeftString = ""
cnres@gsnRightString = ""
cnres@cnSmoothingOn = True ;等值线平滑开关
cnres@cnSmoothingDistanceF   = 0.001 ;平滑距离
cnres@cnLevelSelectionMode   = "ManualLevels" ;取值方式
cnres@cnMinLevelValF = 40
cnres@cnMaxLevelValF = 40   ;等值线最大最小间隔
cnres@cnLevelSpacingF = 40    ;间隔值
cnres@cnInfoLabelOn = False ;等值线信息标注显隐开关
cnres@cnLineLabelsOn          =  True ;等值线信息显隐开关
cnres@cnLineLabelFontHeightF = 0.01 ;字号
cnres@cnLineThicknessF = 2.0 ;字重
cnres@cnLineLabelInterval = 1 ;间隔n条等值线才标注

cnres@cnLineColor = "Blue"  ;等值线颜色
cnres@gsnContourLineThicknessesScale = 3.0 ;等值线宽

;>---------------------------------------<
;>---------------------------------------<
;     set resource for windBarb plot
;>---------------------------------------<
vcres = True
vcres@gsnDraw = False
vcres@gsnFrame = False
vcres@gsnLeftString = ""
vcres@gsnRightString = ""
vcres@gsnAddCyclic = False                       ;对于地理引用的数据,添加一个经度循环点作为缺省值
vcres@vcRefMagnitudeF         = 4.0  ;参考标尺,小方框中的标尺为4m/s
vcres@vcRefLengthF            = 0.040
;参考标尺,小方框中的线段长度;和上一句一起表示,0.04的长度代表4m/s
;若设为0.08,则小方框中的线段长度变长,图中风羽长度变长,线段长度不代表风速大小
;风速大小只和风羽尾部的小线段有关,标准参照小方框中的标注
vcres@vcGlyphStyle               = "WindBarb"    ;箭头样式
vcres@vcWindBarbScaleFactorF   = 2.5
;ncl默认的一个长线表示10,而我们一个长线表示4m/s,为了方便,在原数据上乘以2.5,这样一个长线显示的实际是原来的4m/s
;vcres@vcRefAnnoOn               = False          ;矢量图参考矢量显隐开关
vcres@vcWindBarbLineThicknessF  = 1.5            ;线宽
vcres@vcWindBarbColor = "black"           
vcres@vcMinMagnitudeF = 0.01                     ;小于矢量最小强度将被屏蔽
vcres@vcWindBarbTickLengthF = 0.3                ;风羽长度
;>---------------------------------------<

plots(0) = gsn_csm_map(wks, mpres)

cnplots(0) = gsn_csm_contour(wks, hgt1, cnres)
vcplots(0) = gsn_csm_vector(wks, u1, v1, vcres)
overlay(plots(0), cnplots(0))
overlay(plots(0), vcplots(0))


plots(1) = gsn_csm_map(wks, mpres)

cnplots(1) = gsn_csm_contour(wks, hgt2, cnres)
vcplots(1) = gsn_csm_vector(wks, u2, v2, vcres)
overlay(plots(1), cnplots(1))
overlay(plots(1), vcplots(1))

plots(2) = gsn_csm_map(wks, mpres)

cnplots(2) = gsn_csm_contour(wks, hgt3, cnres)
vcplots(2) = gsn_csm_vector(wks, u3, v3, vcres)
overlay(plots(2), cnplots(2))
overlay(plots(2), vcplots(2))


gsn_panel(wks,plots,(/1,3/),pres)


end




画出来是这样

画出来是这样
500.png
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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