爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 38006|回复: 38

ncl怎么画指定经纬度范围的图

[复制链接]
发表于 2014-9-14 15:01:06 | 显示全部楼层 |阅读模式

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

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

x
如题,ncl怎么给定一个经纬度范围,然后画出的图是这个经纬度的图

密码修改失败请联系微信:mofangbao
发表于 2016-3-13 22:21:11 | 显示全部楼层
例:u=a->u(:,{5.0:55.0},{120.0:235.0})就可以只取5°N-55°N,120°E-125°W范围的值了
密码修改失败请联系微信:mofangbao
回复 支持 2 反对 0

使用道具 举报

发表于 2014-9-14 20:11:33 | 显示全部楼层
采用ncl的wrf专门画图函数绘制带有map的图时,指定区域的方式比较特殊。
http://www.ncl.ucar.edu/Document ... _map_overlays.shtml,仔细看description部分,有介绍两种方法(“zoomin”和“latlonoverlay”),任选其一,每种方法都有相应的例子。
密码修改失败请联系微信:mofangbao
回复 支持 2 反对 0

使用道具 举报

发表于 2014-10-10 19:58:41 | 显示全部楼层
在经纬度射之前加一句mpres@mpLimitMode = "LatLon" 试试呢
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2014-9-14 15:01:26 | 显示全部楼层
急,在线等
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2014-9-14 15:29:20 | 显示全部楼层
本帖最后由 tianmeng 于 2014-9-14 15:32 编辑

跪求答案,为什么我每次修改都是全图
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-9-14 15:34:53 | 显示全部楼层
pres@mpMinLatF               = 34.5
     mpres@mpMaxLatF               = 38.5
     mpres@mpMinLonF               = 114.5
     mpres@mpMaxLonF               = 122.5
都不管用,每次都是全部的图
密码修改失败请联系微信:mofangbao
发表于 2014-9-14 15:35:22 | 显示全部楼层
  res@mpMinLatF         = minlat
  res@mpMaxLatF        = maxlat
  res@mpMinLonF        = minlon
  res@mpMaxLonF       = maxlon
这个没用么?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-9-14 16:14:24 | 显示全部楼层
sun_shine_Xia 发表于 2014-9-14 15:35
res@mpMinLatF         = minlat
  res@mpMaxLatF        = maxlat
  res@mpMinLonF        = minlon

没用啊,不知道为什么,我把程序贴出来吧
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-9-14 16:18:07 | 显示全部楼层
;   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 "./WRFUserARW.ncl"

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

; We generate plots, but what kind do we prefer?
  type = "pdf"
; type = "png"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"aaa")
; Set some basic resources
  res = True
  res@MainTitle                   = "REAL-TIME WRF"

  pltres = True
  mpres = True


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

; 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,ntimes-1,1             ; 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

    slp = wrf_user_getvar(a,"slp",it)    ; slp
      wrf_smooth_2d( slp, 3 )            ; smooth slp
    tc = wrf_user_getvar(a,"tc",it)      ; 3D tc
    u  = wrf_user_getvar(a,"ua",it)      ; 3D U at mass points
    v  = wrf_user_getvar(a,"va",it)      ; 3D V at mass points
    tc2 = wrf_user_getvar(a,"T2",it)     ; T2 in Kelvin
       tc2 = tc2-273.16                  ; T2 in C
    u10 = wrf_user_getvar(a,"U10",it)    ; u at 10 m, mass point
    v10 = wrf_user_getvar(a,"V10",it)    ; v at 10 m, mass point

      tc2@description = "Surface Temperature"
      tc2@units = "C"
      u10@units = "m/s"
      v10@units = "m/s"
                           ; Plotting options for T
      opts = res
      opts@cnFillOn = True
      gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
      res@gsnSpreadColors=True
      opts@ContourParameters = (/ -40., 30., 4./)
      opts@gsnSpreadColorEnd = -3  ; End third from the last color in color map
      contour_tc = wrf_contour(a,wks,tc2,opts)
      delete(opts)

    ; Plotting options for SLP
      opts = res
      opts@cnLineColor = "Red"
      opts@cnHighLabelsOn = True
      opts@cnLowLabelsOn = True
      opts@ContourParameters = (/ 900., 1100., 4. /)
      opts@cnLineLabelBackgroundColor = -1
      opts@gsnContourLineThicknessesScale = 2.0
      contour_psl = wrf_contour(a,wks,slp,opts)
      delete(opts)
; Plotting options for Wind Vectors
      opts = res
      opts@FieldTitle = "Wind"       ; overwrite Field Title
      opts@NumVectors = 47           ; density of wind barbs
      vector = wrf_vector(a,wks,u10,v10,opts)
      delete(opts)

    ;Plotting Provincial boundary
     mpres@mpMinLatF               = 34.5
     mpres@mpMaxLatF               = 38.5
     mpres@mpMinLonF               = 114.5
     mpres@mpMaxLonF               = 122.5
     mpres@mpDataBaseVersion="MediumRes"
     mpres@mpDataSetName="Earth..4"
     mpres@mpGeophysicalLineColor = "Black"
     mpres@mpNationalLineColor    = "Black"
     mpres@mpGridLineColor        = "Black"
     mpres@mpLimbLineColor        = "Black"
     mpres@mpPerimLineColor       = "Black"
mpres@mpUSStateLineThicknessF     = 2
     mpres@mpNationalLineThicknessF    = 2
     mpres@mpUSStateLineColor="Black"
     mpres@mpOutlineSpecifiers="China:states"

    ; MAKE PLOTS
      plot = wrf_map_overlays(a,wks,(/contour_tc,contour_psl,vector/),pltres,mpres)

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

  end do        ; END OF TIME LOOP

end
密码修改失败请联系微信:mofangbao
发表于 2014-9-14 18:46:06 | 显示全部楼层
亲,mpres的属性开关呢?
密码修改失败请联系微信:mofangbao
发表于 2014-9-14 19:24:51 | 显示全部楼层
mpres=True
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-9-14 19:51:31 | 显示全部楼层
打开了,我在最开始就打开了,可是不行
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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