爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7118|回复: 3

ncl画垂直剖面,显示剖面线的问题

[复制链接]

新浪微博达人勋

发表于 2018-3-18 20:00:53 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图:
问题概况: 投影是WRF输出数据兰博托
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
本帖最后由 chongzika 于 2018-3-19 14:42 编辑
  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

  3. begin
  4. ;
  5. ; The WRF ARW input file.
  6. ; This needs to have a ".nc" appended, so just do it.
  7.   files     = systemfunc("ls -1 wrfout_d02*")
  8.   a = addfiles(files,"r")
  9. xlon = wrf_user_getvar(a, "XLONG",0)
  10. xlat = wrf_user_getvar(a, "XLAT",0)
  11.     ; gsn_define_colormap(wks,"MPL_gist_yarg")

  12. ; Set some basic resources

  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14. ll_res= True
  15. loc0= wrf_user_ll_to_ij(a[0],70,37,ll_res)
  16. print(loc0)
  17. loc1= wrf_user_ll_to_ij(a[0],80,37,ll_res)
  18. print(loc1)

  19. ;---------------------------------------------------------------

  20.   plane = new(4,float)
  21.   plane = (/loc0(0),loc1(0),loc0(1), loc1(1)/)  ;(/58,65/)       ;
  22.   print(plane)
  23.   opts = True
  24.   angle = 0.

  25.   lat_plane = wrf_user_intrp2d(xlat,plane,angle,opts)
  26.   lon_plane = wrf_user_intrp2d(xlon,plane,angle,opts)
  27. ;gsn_polyline(wks,plot,(/lon_plane(0),lon_plane(-1)/),(/lat_plane(0),lat_plane(-1)/),lnres)
  28. end
复制代码
输出的起始值经纬度
70,37—— 80,37
读取后插值画图用的
70.21637,36.09188 —— 81.05466,37.04618结果画出来的就只是红色的线,而不是想要的蓝色线条官网脚本 http://www2.mmm.ucar.edu/wrf/OnL ... Section_smooth4.htm




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

新浪微博达人勋

 楼主| 发表于 2018-3-18 20:58:04 | 显示全部楼层
本帖最后由 chongzika 于 2018-3-18 21:02 编辑
  1. <div class="blockcode"><blockquote>
复制代码
  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
  3. begin
  4. files = systemfunc("ls -1 wrfout_d02*")
  5. a = addfiles(files,"r")
  6. xlon = wrf_user_getvar(a, "XLONG",0)
  7. xlat = wrf_user_getvar(a, "XLAT",0)

  8. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  9. ll_res= True
  10. lon0=79.5
  11. lat0=37
  12. lon1=80
  13. lat1=37
  14. loc0= wrf_user_ll_to_ij(a[0],lon0,lat0,ll_res)
  15. ;print(loc0)
  16. loc1= wrf_user_ll_to_ij(a[0],lon1,lat1,ll_res)

  17. ;---------------------------------------------------------------

  18. plane = new(4,float)
  19. plane = (/loc0(0),loc1(0),loc0(1), loc1(1)/) ;(/58,65/) ;
  20. opts = True
  21. angle=0.
  22. lat_plane = wrf_user_intrp2d(xlat,plane,angle,opts)
  23. lon_plane = wrf_user_intrp2d(xlon,plane,angle,opts)
  24. dimsX = dimsizes(lat_plane)
  25. loc2=wrf_user_ij_to_ll(a[0],lon_plane(0),lat_plane(0),ll_res)
  26. loc3=wrf_user_ij_to_ll(a[0],lon_plane(dimsX-1),lat_plane(dimsX-1),ll_res)
  27. loc4= wrf_user_ll_to_ij(a[0],loc2(0),loc2(1),ll_res)
  28. loc5= wrf_user_ll_to_ij(a[0],loc3(0),loc3(1),ll_res)
  29. print("lon0 lat0 lon1 lat1")
  30. print (sprintf("%6.2f", lon0) +" " \
  31. +sprintf("%6.2f", lat0) +" " \
  32. +sprintf("%6.2f", lon1) +" " \
  33. +sprintf("%6.2f", lat1) )
  34. print("loc0_x loc0_y loc1_x loc1_y")
  35. print (sprintf("%6.2f", loc0(0)) +" " \
  36. +sprintf("%6.2f", loc0(1)) +" " \
  37. +sprintf("%6.2f", loc1(0)) +" " \
  38. +sprintf("%6.2f", loc1(1)) )
  39. print("loc0_x1 loc0_y1 loc1_x1 loc1_y1")
  40. print (sprintf("%6.2f", lon_plane(0)) +" " \
  41. +sprintf("%6.2f", lat_plane(0)) +" " \
  42. +sprintf("%6.2f", lon_plane(1)) +" " \
  43. +sprintf("%6.2f", lat_plane(1)) )
  44. print("lon0_x lat0_y lon1_x lat1_y")
  45. print (sprintf("%6.2f", loc2(0)) +" " \
  46. +sprintf("%6.2f", loc2(1)) +" " \
  47. +sprintf("%6.2f", loc3(0)) +" " \
  48. +sprintf("%6.2f", loc3(1)) )
  49. print("loc0_x2 loc0_y2 loc1_x2 loc1_y2")
  50. print (sprintf("%6.2f", loc4(0)) +" " \
  51. +sprintf("%6.2f", loc4(1)) +" " \
  52. +sprintf("%6.2f", loc5(0)) +" " \
  53. +sprintf("%6.2f", loc5(1)) )
  54. end
复制代码


输出对比一看,经过坐标转化再插值再转换后完全对不上了
  lon0     lat0      lon1   lat1
   79.50  37.00   80.00   37.00
  loc0_x     loc0_y      loc1_x   loc1_y
  132.00 133.00  136.00  132.00
  loc0_x1     loc0_y1      loc1_x1   loc1_y1
   79.52  37.30   79.56   37.21
  lon0_x     lat0_y      lon1_x   lat1_y
   75.27  27.80   75.29   27.78
  loc0_x2     loc0_y2      loc1_x2   loc1_y2
   80.00  37.00   80.00   37.00

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

新浪微博达人勋

发表于 2018-3-19 23:38:17 | 显示全部楼层
你一定用的是ncl6.2后的版本
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-3-20 08:39:18 | 显示全部楼层
freekiller 发表于 2018-3-19 23:38
你一定用的是ncl6.2后的版本

是的6.2,难道之前的都没问题么?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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