爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6450|回复: 6

[作图] 求助!contour图纵坐标间隔不对,如何设置?

[复制链接]
发表于 2018-4-10 16:04:56 | 显示全部楼层 |阅读模式

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

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

x
想画变量的廓线的日变化图,从wrfout文件里提取的变量是30层eta分层,然后自己做出相对高度z1替换eta,最后得到的图纵坐标间隔不合理,0—100m和其他百米的间隔都不一样长,是哪里的问题呢?求助各位大大,非常感谢~; ***********************************************
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************

begin

f1      = addfile ("~/wrfout_d03_2017-01-21_00:00:00.nc","r")
a11    = f1->EXCH_H(:,:,:,:)

a12 = dim_avg(a11)
a13=dim_avg(a12)

m1= new((/24,30,2/),"float")
t = ispan(0,23,1)

do i= 0,29
m1(:,i,0)=a13(16:39,i)
m1(:,i,1)=a13(40:63,i)
end do

n1 = dim_avg(m1)

  g1    = f1->HGT(1,:,:)
  h1=dim_avg(g1)
  ter1=dim_avg(h1)
  i1=wrf_user_getvar(f1,"z",0)
  i1=i1-ter1
  j1=dim_avg(i1)
  k1=dim_avg(j1)
  z1= new((30),"float")
  z1(0)=0
  z1(1:29)=k1(0:28)

n1!0 = "Time"
copy_VarAtts(a11,n1)
copy_VarCoords_2(a11,n1)

n1&bottom_top_stag = z1
n1&Time = t

wks  = gsn_open_wks("png","contour_exch_01")   ; send graphics to PNG file

res1                     = True
res1@cnFillOn            = True           ; turn on color
res1@cnFillPalette       = "amwg256"

res1@cnLineLabelsOn      = False          ; no contour line labels
res1@cnInfoLabelOn       = False          ; no info label
res1@cnLinesOn           = False          ; turn off contour lines

res1@vpWidthF  = 0.8                      ; change the aspect ratio
res1@vpHeightF = 0.6
res1@vpXF      = .15                       ; location of where plot starts
res1@vpYF      = .9

res1@tmXBLabelFontHeightF = 0.025         ; label font height
res1@tmYLLabelFontHeightF = 0.025

res1@tmYLOn                   = True
res1@tmYLLabelsOn             = True
; res1@trYMaxF                  = 1000.
res1@tmYLMode                 = "Manual"
res1@tmYLTickStartF           = 0.
res1@tmYLTickEndF             = 800.
res1@tmYLTickSpacingF         = 100.

plot = gsn_csm_contour(wks,n1(bottom_top_stag|:15,Time|:),res1)          ; contour the variable

end


n1和z1的属性见下:
Variable: n1
Type: float
Total Size: 2880 bytes
            720 values
Number of Dimensions: 2
Dimensions and sizes:        [Time | 24] x [bottom_top_stag | 30]
Coordinates:
            Time: [0..23]
            bottom_top_stag: [ 0..17578.91]
Number Of Attributes: 7
  coordinates :        XLONG XLAT
  stagger :        Z
  units :        -
  description :        SCALAR EXCHANGE COEFFICIENTS
  MemoryOrder :        XYZ
  FieldType :        104
  _FillValue :        9.96921e+36


Variable: z1
Type: float
Total Size: 120 bytes
            30 values
Number of Dimensions: 1
Dimensions and sizes:        [30]
Coordinates:
Number Of Attributes: 1
  _FillValue :        9.96921e+36
(0)         0
(1)        10.13144
(2)        27.2005
(3)        45.9689
(4)        66.02456
(5)        92.78149
(6)        140.1814
(7)        191.6025
(8)        233.8749
(9)        307.2459
(10)        407.6262
(11)        481.8983
(12)        557.0893
(13)        644.8188
(14)        725.309
(15)        802.3631
(16)        884.1748
(17)        1232.071
(18)        1863.503
(19)        2539.979
(20)        3267.459
(21)        4053.219
(22)        4911.677
(23)        5863.649
(24)        6943.682
(25)        8213.806
(26)        9759.84
(27)        11791.46
(28)        14866.54
(29)        17578.91


exch

exch
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2018-4-11 10:27:47 | 显示全部楼层
求助求助 是属性没设置好吗?
密码修改失败请联系微信:mofangbao
发表于 2018-4-11 13:37:18 | 显示全部楼层

是不是经纬度设置的问题?试试下面的属性设置,
res@mpCenterLonF            =  
res@mpMinLonF               =
res@mpMaxLonF               =
res@mpMinLatF               =
res@mpMaxLatF               =

res@tmYLMode                = "Explicit"
   
res@tmYLValues              =(/20,30/)
   
res@tmYLLabels              =(/"20N","30N","40N","50N"/)
   
res@tmYLMinorValues         =ispan(-90,90,5)
   
res@tmXBMode                = "Explicit"
   
res@tmXBValues              =
   
res@tmXBLabels              =
   
res@tmXBMinorValues         =
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2018-4-11 14:53:06 | 显示全部楼层
Dortch 发表于 2018-4-11 13:37
是不是经纬度设置的问题?试试下面的属性设置,
res@mpCenterLonF            =  
res@mpMinLonF       ...

感谢感谢,但是我想画的不是经纬度,X轴是时间,Y轴是高度额,而且用 Explicit 的res也是一样的结果
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2018-4-12 15:05:10 | 显示全部楼层
求助各位大佬
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2018-4-16 08:58:02 | 显示全部楼层
没有人啊
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2018-4-16 08:58:05 | 显示全部楼层
没有人啊
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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