爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 23021|回复: 33

[分享资料] 为什么我参照isen.gs的例子画位涡PV,得的每个高度上的PV都是一样的?剖面上也都直线

[复制链接]

新浪微博达人勋

发表于 2012-4-22 15:09:51 | 显示全部楼层 |阅读模式

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

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

x
现在尝试着画个等熵位涡的图,参考别的帖子里的建议,用了isen.gs,刚开始不太会就按着里面的例子来做。奇怪的是画出来的每一层的结果是一样的。。囧了。。。为嘛?!求助!!

  1. 'reinit'
  2. 'open F:\Res\data\input\fnl\fnl_20110817_12_00.ctl'
  3. 'enable print F:\Res\draw\PV\pv315_20110817_12_00.gmf'
  4. 'set grads off'
  5. 'set grid off'
  6. 'set xlopts 1 4 0.16'
  7. 'set ylopts 1 4 0.16'
  8. 'set xlint 5'
  9. 'set ylint 5'
  10. 'set xlab on'
  11. 'set ylab on'
  12. 'set lat 20 45'
  13. 'set lon 100 130'
  14. 'set lev 1000 100'

  15. 'define u=UGRDprs'
  16. 'define v=VGRDprs'
  17. 'define PP=lev'
  18. 'define t=tmpprs'
  19. 'define coriol=2*7.29e-5*sin(lat*3.1415/180)'
  20. 'define dudy=cdiff(u,y)/(111177*cdiff(lat,y))'
  21. 'define dvdx=cdiff(v,x)/(111177*cdiff(lon,x)*cos(lat*3.1415/180))'
  22. 'define dt=t(z-1)*pow(1000/PP(z-1),0.286)-t(z+1)*pow(1000/PP(z+1),0.286)'
  23. 'define dp=100*(PP(z-1)-PP(z+1))'
  24. 'define dtdp=dt/dp'
  25. 'define part1='isen(dvdx,t,PP,315)
  26. 'define part2='isen(dudy,t,PP,315)
  27. 'define part3='isen(dtdp,t,PP,315)
  28. 'define pv315=-9.8*(coriol+part1-part2)*part3'
  29. 'set lat 30'
  30. 'set lon 100 130'
  31. *'set z 1'
  32. 'set cthick 6'
  33. 'cnbasemap pv315*1e6 0'
  34. 'print'
  35. 'disable print'
  36. ;
  37. function isen(field,tgrid,pgrid,tlev)
  38. *----------------------------------------------------------------------
  39. * Bob Hart (hart@ems.psu.edu) /  PSU Meteorology
  40. * 2/26/1999
  41. *
  42. * 2/26/99 - Fixed a bug that caused the script to crash on
  43. *           certain machines.  
  44. *
  45. * GrADS function to interpolate within a 3-D grid to a specified
  46. * isentropic level.  Can also be used on non-pressure level data, such
  47. * as sigma or eta-coordinate output where pressure is a function
  48. * of time and grid level.  Can be used to create isentropic PV surfaces
  49. * (examples are given at end of documentation just prior to
  50. * function.)
  51. *
  52. * Advantages:  Easy to use, no UDFs.  Disadvantages:  Can take 5-20 secs.
  53. *
  54. * Arguments:
  55. *    field = name of 3-D grid to interpolate
  56. *
  57. *    tgrid = name of 3-D grid holding temperature values (deg K) at each
  58. *            gridpoint.
  59. *
  60. *    pgrid = name of 3-D grid holding pressure values (mb) at each gridpoint
  61. *            If you are using regular pressure-level data, this should be
  62. *            set to the builtin GrADS variable 'lev'.
  63. *
  64. *    tlev  = theta-level (deg K) at which to interpolate
  65. *
  66. * Function returns:  defined grid interp holding interpolated values
  67. *
  68. * NOTE:  YOU NEED TO INCLUDE A COPY OF THIS FUNCTION IN YOUR SCRIPT
  69. *
  70. * NOTE:  Areas having tlev below bottom level or above upper level
  71. *        will be undefined in output field. Extrapolation is NOT
  72. *        performed!!
  73. *
  74. *------------------------------------------------------------------------
  75. *
  76. * EXAMPLE FUNCTION CALLS:
  77. *
  78. * Sample variables: u = u-wind in m/s
  79. *                   v = v-wind in m/s
  80. *                   w = vertical velocity
  81. *                   t = temperature in K
  82. *                  PP = pressure data in mb
  83. *
  84. * 1) Display vertical velocity field on 320K surface:
  85. *
  86. *    'd 'isen(w,t,PP,320)
  87. *
  88. * 2) Create & Display colorized streamlines on 320K surface:
  89. *
  90. *    'define u320='isen(u,t,PP,320)
  91. *    'define v320='isen(v,t,PP,320)
  92. *    'set z 1'
  93. *    'set gxout stream'
  94. *    'd u320;v320;mag(u320,v320)'
  95. *
  96. * 3) Create & display a 320K isentropic PV surface:
  97. *
  98. *    'set lev 1050 150'
  99. *    'define coriol=2*7.29e-5*sin(lat*3.1415/180)'
  100. *    'define dudy=cdiff(u,y)/(111177*cdiff(lat,y))'
  101. *    'define dvdx=cdiff(v,x)/(111177*cdiff(lon,x)*cos(lat*3.1415/180))'
  102. *    'define dt=t(z-1)*pow(1000/PP(z-1),0.286)-t(z+1)*pow(1000/PP(z+1),0.286)'
  103. *    'define dp=100*(PP(z-1)-PP(z+1))'
  104. *    'define dtdp=dt/dp'
  105. *    'define part1='isen(dvdx,t,PP,320)
  106. *    'define part2='isen(dudy,t,PP,320)
  107. *    'define part3='isen(dtdp,t,PP,320)
  108. *    'define pv320=-9.8*(coriol+part1-part2)*part3'
  109. *    'set z 1'
  110. *    'd pv320'
  111. *
  112. * PROBLEMS:  Send email to Bob Hart (hart@ems.psu.edu)
  113. *
  114. *-----------------------------------------------------------------------
  115. *-------------------- BEGINNING OF FUNCTION ----------------------------
  116. *-----------------------------------------------------------------------

  117. * Get initial dimensions of dataset so that exit dimensions will be
  118. * same

  119. 'q dims'
  120. rec=sublin(result,4)
  121. ztype=subwrd(rec,3)
  122. if (ztype = 'fixed')
  123.    zmin=subwrd(rec,9)
  124.    zmax=zmin
  125. else
  126.    zmin=subwrd(rec,11)
  127.    zmax=subwrd(rec,13)
  128. endif

  129. * Get full z-dimensions of dataset.

  130. 'q file'
  131. rec=sublin(result,5)
  132. zsize=subwrd(rec,9)

  133. * Determine spatially varying bounding pressure levels for isen surface
  134. * tabove = theta-value at level above ; tbelow = theta value at level
  135. * below for each gridpoint

  136. 'set z 1 'zsize
  137. 'define theta='tgrid'*pow(1000/'pgrid',0.286)'
  138. 'set z 2 'zsize
  139. 'define thetam='tgrid'(z-1)*pow(1000/'pgrid'(z-1),0.286)'
  140. 'set z 1 'zsize-1
  141. 'define thetap='tgrid'(z+1)*pow(1000/'pgrid'(z+1),0.286)'

  142. 'define tabove=0.5*maskout(theta,theta-'tlev')+0.5*maskout(theta,'tlev'-thetam)'
  143. 'define tbelow=0.5*maskout(theta,thetap-'tlev')+0.5*maskout(theta,'tlev'-theta)'

  144. * Isolate field values at bounding pressure levels
  145. * fabove = requested field value above isen surface
  146. * fbelow = requested field value below isen surface

  147. 'define fabove=tabove*0+'field
  148. 'define fbelow=tbelow*0+'field

  149. 'set z 1'

  150. * Turn this 3-D grid of values (mostly undefined) into a 2-D isen layer

  151. * If more than one layer is valid (rare), take the mean of all the
  152. * valid levels. Not the best way to deal with the multi-layer issue,
  153. * but works well, rarely if ever impacts output, and is quick.
  154. * Ideally, only the upper most level would be used.  However, this
  155. * is not easily done using current GrADS intrinsic functions.

  156. 'define fabove=mean(fabove,z=1,z='zsize')'
  157. 'define fbelow=mean(fbelow,z=1,z='zsize')'
  158. 'define tabove=mean(tabove,z=1,z='zsize')'
  159. 'define tbelow=mean(tbelow,z=1,z='zsize')'

  160. * Finally, interpolate linearly in theta and create isen surface.
  161. * Linear interpolation in theta works b/c it scales as height,
  162. * or log-P, from Poisson equation for pot temp.

  163. 'set z 'zmin ' ' zmax

  164. 'define slope=(fabove-fbelow)/(tabove-tbelow)'
  165. 'define b=fbelow-slope*tbelow'
  166. 'define interp=slope*'tlev'+b'

  167. * variable interp now holds isentropic field and its named it returned
  168. * for use by the user.

  169. say 'Done.  Newly defined variable interp has 'tlev'K 'field'-field.'

  170. return(interp)




密码修改失败请联系微信:mofangbao

新浪微博达人勋

0
早起挑战累计收入
发表于 2012-4-22 21:27:25 | 显示全部楼层
太长了,木有用过...
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-4-23 18:53:23 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-14 09:42:10 | 显示全部楼层
何小肥 发表于 2012-4-23 18:53
其实37行以后的是贴的isen.gs。。。

楼主的问题解决了没有,能用这个gs算吗?我计算出来都是恒定值。。。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-14 10:56:35 | 显示全部楼层
你计算的是315K等熵面上的值,难道在不同高度上还有区别吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-14 17:13:30 | 显示全部楼层
pqman3 发表于 2012-5-14 10:56
你计算的是315K等熵面上的值,难道在不同高度上还有区别吗?

我想计算不同等压面上的值。。那我要怎么算?所有等熵面的算一遍,再在等压面上画??用这个GS能实现么???
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-14 17:17:21 | 显示全部楼层
littlelock 发表于 2012-5-14 09:42
楼主的问题解决了没有,能用这个gs算吗?我计算出来都是恒定值。。。

没有,最近做大尺度的,这个中小尺度的先放着。。但是听说有人用fortran做的。。只是我没有程序
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-15 12:48:44 | 显示全部楼层
何小肥 发表于 2012-5-14 17:17
没有,最近做大尺度的,这个中小尺度的先放着。。但是听说有人用fortran做的。。只是我没有程序

我后来用那个isen.gs做出来了,只是不知道对不对
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-15 15:44:15 | 显示全部楼层
littlelock 发表于 2012-5-15 12:48
我后来用那个isen.gs做出来了,只是不知道对不对

好啊。。那我找可以交流的伙伴啦~~不错不错~~有空交流下
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-7-6 16:16:58 | 显示全部楼层
有结果了吗
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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