立即注册 登录
气象家园 返回首页

尽头的尽头的个人空间 http://bbs.06climate.com/?255 [收藏] [复制] [分享] [RSS]

留言板

facelist doodle涂鸦板

您需要登录后才可以留言 登录 | 立即注册


紫珑 2023-2-8 15:15
紧急求助,大神你好,请问下如何使用Grads为地图添加比例尺,如0-190-380那样的,不好意思打扰了,非常感谢!
我看路曼曼 2018-7-11 21:56
非常感谢您的回复。
承德气象 2017-7-4 09:59
为什么删除我的帖子,我想发布到grads中的脚本编辑中,可是根本发布出去。
FrankieLJY 2017-4-15 14:01
版主,到你空间来请教这个题了,可能很简单,但是困扰我几天了,我用shapefile数据mask了一个区域,然后相对这个mask的区域赋值,不知道该设置哪个属性,或是该怎么样设置我的colormap呢,问题http://bbs.06climate.com/forum.php?mod=viewthread&tid=51916!我在官网上看到一个例子http://www.ncl.ucar.edu/Applications/Scripts/shapefiles_5.ncl,他设置的colormap我不知道它是怎么把相应的值给相应的那些属性的,麻烦版主有时间帮我看看好吗,谢谢了!
qixiangren34 2015-11-20 17:26
请把您的最近的Cygwin传我一份吧,我下载老不成功,用压缩文件,邮箱zhangcx321@sina.com.
芥末 2015-11-13 16:20
尽头的尽头: 哈哈,每天来签个到吧,积分用不完
你这广告打得好吖,连广告语都这么顺口 哈哈 才子
芥末 2015-11-12 23:31
抱大腿吖 抱大腿啊 等没积分了 找你要 哈哈
estee_lau 2014-10-20 11:06
好多积分呀!
黄小仙儿 2014-4-13 15:17
恩,师兄。我按照你的方法添加了地区界的底图,但是省界那里是空的。请问怎么在一张图上即设置省界,也设置市界呢
尽头的尽头 2014-4-12 21:23
;----------------------------------------------------------------------
; This is a basic NCL template for creating contours over maps using
; WRF data, and attaching shapefile outlines. This template plots one
; timestep of HGT from a WRF file, and attaches shapefile outlines
; from the "USA_adm2.shp" and "CAN_adm2.shp" shapefiles, downloaded
; from http://www.gadm.org/country/
;----------------------------------------------------------------------
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"

begin
  filename = "wrfout_d01_2002-07.nc"
  a        = addfile(filename,"r")

  ter = a->HGT(0,:,:)                        ; Read the variable to memory

  wks = gsn_open_wks("x11","wrf_hgt_shapefile")
  gsn_define_colormap(wks,"OceanLakeLandSnow")  ; Change color map

  res                   = True               ; Use basic options for this field
  res@cnFillOn          = True               ; Create a color fill plot
  res@ContourParameters = (/1,1100,20/)

  contour = wrf_contour(a,wks,ter,res)

  pltres            = True   ; Set plot options
  pltres@PanelPlot  = True   ; Tells wrf_map_overlays not to remove contours

  mpres             = True   ; Set map options
  mpres@mpOutlineOn = False
  mpres@mpFillOn    = False

;---Create the contours over the WRF map (nothing will be drawn yet).
  plot = wrf_map_overlays(a,wks,contour,pltres,mpres)

;---Attach the shapefile polylines using files read off gadm.org/country.
  usa_shp_name    = "USA_adm/USA_adm2.shp"
  canada_shp_name = "CAN_adm/CAN_adm2.shp"

  lnres                  = True
  lnres@gsLineColor      = "gray25"
  lnres@gsLineThicknessF = 0.5   
  usa_id = gsn_add_shapefile_polylines(wks,plot,usa_shp_name,lnres)
  can_id = gsn_add_shapefile_polylines(wks,plot,canada_shp_name,lnres)

  draw(plot)       ; This will draw the map and the shapefile outlines.
  frame(wks)       ; Advance the frame

end
这是官网wrf家shp的,你参考下
黄小仙儿 2014-4-12 19:35
尽头的尽头: 你的ncl是啥版本,这个要在6.1.0以上的版本才有
提示:ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetPointCount'.

ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetGeometryCount'.是不是shp文件有问题还是什么原因?
黄小仙儿 2014-4-12 19:34
尽头的尽头: 你的ncl是啥版本,这个要在6.1.0以上的版本才有
刚重装的6.2.0
黄小仙儿 2014-4-12 18:36
尽头的尽头: 你的ncl是啥版本,这个要在6.1.0以上的版本才有
额,貌似是6.0.0,我去下最新版安装
黄小仙儿 2014-4-12 16:13
师兄,我按照你说的添加shp底图,但是提示gsn_add_shapefile_polylines没有定义,不知道该怎么办了,能不能帮我看看.

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"

begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/home/Huanglei/data/d03"+".nc","r")            


; We generate plots, but what kind do we prefer?
  type = "pdf"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_Cloud")
  gsn_define_colormap(wks,"WhBlGrYeRe")   ; overwrite the .hluresfile color map


; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  mpres  = True  ; Map resources
  pltres = True ; Plot resources


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; What times and how many time steps are in the data set?
  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it =10, ntimes-1,3        ; TIME LOOP

    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)   ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        
    if(isfilevar(a,"QICE"))
      qi = wrf_user_getvar(a,"QICE",it)
      qi = qi*1000.
      qi@units = "g/kg"   
    end if

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    do level = 10,24,5      ; LOOP OVER LEVELS

      display_level = level + 1
      opts = res
      opts@cnFillOn         = True
      opts@gsnSpreadColors  = False
      opts@PlotLevelID      = "Eta Level  " + display_level


      if (isvar("qi"))
        qi_plane  = qi(level,:,:)
        contour = wrf_contour(a,wks,qi(level,:,:),opts)
        plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
        delete(contour)
      end if
;>============================================================<
;                      add China map
;>------------------------------------------------------------<

     
  shp_name    = "/home/Huanglei/map/Sichuan_city.shp"

  lnres                  = True
  lnres@gsLineColor      = "gray25"
  lnres@gsLineThicknessF = 0.5   

  usa_id = gsn_add_shapefile_polylines(wks,plot,shp_name,lnres)

  draw(plot)       ; This will draw the map and the shapefile outlines.
   delete(opts)

    end do      ; END OF LEVEL LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do        ; END OF TIME LOOP     

end
黄小仙儿 2014-4-10 17:05
尽头的尽头: 论坛搜索,有这方面的东西的
刚刚查了,都是grads添加shp的,没找到NCL的。。。
黄小仙儿 2014-4-10 16:50
尽头的尽头: 你这是wrf输出结果吧,而且就四川几个市,没必要用这个脚本,自己做一个你要画的区域的SHP,然后加上去就行了
我找到了一个四川的shp文件,那要怎么把它加上去,用什么命令?能不能详细讲解一下。。刚开始学,还都不太懂~
黄小仙儿 2014-4-10 16:44
尽头的尽头: 你这是wrf输出结果吧,而且就四川几个市,没必要用这个脚本,自己做一个你要画的区域的SHP,然后加上去就行了
这个要怎么做。。。
黄小仙儿 2014-4-10 16:02
;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/home/Huanglei/data/d03"+".nc","r")            


; We generate plots, but what kind do we prefer?
; type = "x11"
type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_Cloud")
  gsn_define_colormap(wks,"WhBlGrYeRe")   ; overwrite the .hluresfile color map


; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"

; mpres  = True  ; Map resources
  pltres = True ; Plot resources
; mpres =  True
  cnres  = True
  cnres@china     = True       ;draw china map or not
  cnres@river     = True       ;draw changjiang&huanghe or not
  cnres@province  = True       ;draw province boundary or not
  cnres@nanhai    = True       ;draw nanhai or not
  cnres@diqu      = True       ; draw diqujie or no
; mpres@mpGeophysicalLineColor = "Black"
; mpres@mpNationalLineColor    = "Black"
;; mpres@mpUSStateLineColor     = "Black"
; mpres@mpGridLineColor        = "Black"
; mpres@mpLimbLineColor        = "Black"
  ;mpres@mpPerimLineColor       = "Black"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; What times and how many time steps are in the data set?
  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 0,5        ; TIME LOOP

    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)   ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

    if(isfilevar(a,"QVAPOR"))
      qv = wrf_user_getvar(a,"QVAPOR",it)
      qv = qv*1000.
      qv@units = "g/kg"   
    end if
    if(isfilevar(a,"QCLOUD"))
      qc = wrf_user_getvar(a,"QCLOUD",it)
      qc = qc*1000.
      qc@units = "g/kg"   
    end if
    if(isfilevar(a,"QRAIN"))
      qr = wrf_user_getvar(a,"QRAIN",it)
      qr = qr*1000.
      qr@units = "g/kg"   
    end if
    if(isfilevar(a,"QICE"))
      qi = wrf_user_getvar(a,"QICE",it)
      qi = qi*1000.
      qi@units = "g/kg"   
    end if
   if(isfilevar(a,"QGRAUP"))
      qi = wrf_user_getvar(a,"QGRAUP",it)
      qi = qi*1000.
      qi@units = "g/kg"   
    end if
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    do level = 0,24,5     ; LOOP OVER LEVELS

      display_level = level + 1
      opts = res
      opts@cnFillOn         = True
      opts@gsnSpreadColors  = False
      opts@PlotLevelID      = "Eta Level  " + display_level

      if (isvar("qv"))
        contour = wrf_contour(a,wks,qv(level,:,:),opts)
        plot = wrf_map_overlays(a,wks,(/contour/),pltres,cnres)
        delete(contour)
      end if

      if (isvar("qc"))
        contour = wrf_contour(a,wks,qc(level,:,:),opts)
        plot = wrf_map_overlays(a,wks,(/contour/),pltres,cnres)
        delete(contour)
      end if

      if (isvar("qr"))
        contour = wrf_contour(a,wks,qr(level,:,:),opts)
        plot = wrf_map_overlays(a,wks,(/contour/),pltres,cnres)
        delete(contour)
      end if

      if (isvar("qi"))
        qi_plane  = qi(level,:,:)
        contour = wrf_contour(a,wks,qi(level,:,:),opts)
        plot = wrf_map_overlays(a,wks,(/contour/),pltres,cnres)
        delete(contour)
      end if
     chinamap = add_china_map(wks,plot,cnres)
      delete(opts)

    end do      ; END OF LEVEL LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do        ; END OF TIME LOOP     

end
黄小仙儿 2014-4-10 16:02
尽头的尽头: 把你的脚本发给我看看
我数据的区域比较小,就是四川的几个市。不知道这个有没有影响
黄小仙儿 2014-4-10 11:58
你是LPP师兄?
我按照你的添加中国地图的方法试着画图,出现了这样的警告:
warning:nanhai is not a valid resource in plt_Cloud_map at this time
warning:china is not a valid resource in plt_Cloud_map at this time
warning:river is not a valid resource in plt_Cloud_map at this time
warning:province is not a valid resource in plt_Cloud_map at this time
warning:diqu is not a valid resource in plt_Cloud_map at this time
warning:nanhai is not a valid resource in plt_Cloud_map at this time
warning:china is not a valid resource in plt_Cloud_map at this time
warning:river is not a valid resource in plt_Cloud_map at this time
warning:province is not a valid resource in plt_Cloud_map at this time
warning:diqu is not a valid resource in plt_Cloud_map at this time
warning:nanhai is not a valid resource in plt_Cloud_map at this time
warning:china is not a valid resource in plt_Cloud_map at this time
warning:river is not a valid resource in plt_Cloud_map at this time
warning:province is not a valid resource in plt_Cloud_map at this time
warning:diqu is not a valid resource in plt_Cloud_map at this time
请问是怎么回事啊,需要我贴出脚本吗?
12下一页

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

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

返回顶部