爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5388|回复: 5

大神帮帮忙,是个小问题。

[复制链接]

新浪微博达人勋

发表于 2015-3-18 09:37:53 | 显示全部楼层 |阅读模式

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

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

x
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;
; Make a list of all files we are interested in
  DATADir = "/mnt/Disk16T/Guoxl/"
  FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d02_20* ")
  numFILES = dimsizes(FILES)
  print("numFILES = " + numFILES)
  print(FILES)
  print (" ")
  ; We generate plots, but what kind do we prefer?
  type = "PNG"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_Surface_multi_files")
  spd_num = new((/99,150/),float)
  speed = new((/99,150/),float)
  spd_num=0.0
;--------------------------------
; Set some Basic Plot options
;--------------------------------
  res = True
  res@Footer = False

  res@mpGeophysicalLineColor   = "Black"
  res@mpNationalLineColor      = "Black"
  res@mpGridAndLimbOn          = False
  res@mpDataSetName            = "Earth..4"      ; divisions for other countries.
  res@mpDataBaseVersion        = "MediumRes"     ; Medium resolution database
  res@mpOutlineSpecifiers      = (/"China:states","Taiwan"/)
;  mpres@mpOutlineBoundarySets    = "NoBoundaries"
  res@mpFillAreaSpecifiers        = (/"China"/)
  res@mpSpecifiedFillColors       = (/"White"/)
  res@mpUSStateLineColor          = "Black"
  res@mpGridLineColor             = "Black"
  res@mpLimbLineColor             = "Black"
  res@mpPerimLineColor            = "Black"
  res@mpGeophysicalLineThicknessF = 3.0   ; for Offshore Line thickness
  res@mpNationalLineThicknessF    = 3.0   ; for National Line thickness
  res@mpGridLineThicknessF        = 3.0
  res@mpLimbLineThicknessF        = 3.0
  res@mpUSStateLineThicknessF     = 3.0   ; for Province Line thickness
;-------------------------------------------------------------------------------
do ifil = 0,numFILES-1
    a = addfile(FILES(ifil)+".nc","r")   ; Open the next file
    lat = a->XLAT(0,:,:)
    lon = a->XLONG(0,:,:)
    printVarSummary(lat)
    dims = dimsizes(lat)
    u10 = wrf_user_getvar(a,"U10",-1)    ; u at 10 m, mass point
    v10 = wrf_user_getvar(a,"V10",-1)    ; v at 10 m, mass point
    dimU  = dimsizes(u10)
    lonU = dimU(1)
    dimV  = dimsizes(v10)
    latV = dimV(0)
    printVarSummary(u10)
    spd    = sqrt(u10^2+v10^2)
  ;  copy_VarCoords(u10,spd)
    printVarSummary(spd)
    printMinMax(spd, True)
    spd_avg=dim_avg_n_Wrap(spd,0)
  ;  printVarSummary(spd_avg)
    spd_num=spd_num+spd_avg
    copy_VarCoords(u10,spd_num)
  ;  printVarSummary(spd_num)
end do
   ; speed!0 = "lat"
   ; speed&lat = u10&XLAT
   ; speed!1 = "lon"
   ; speed&lon = u10&XLONG
    speed = spd_num/numFILES
    copy_VarCoords(u10,speed)
    printVarSummary(speed)
;---------------------------------------------
; Plotting options for Wind Speed
;---------------------------------------------
   res@mpLimitMode           = "Corners"
   res@mpLeftCornerLatF      =  lat(0,0)
   res@mpLeftCornerLonF      =  lon(0,0)
   res@mpRightCornerLatF     =  lat(dims(0)-1,dims(1)-1)
   res@mpRightCornerLonF     =  lon(dims(0)-1,dims(1)-1)
   res@pmTickMarkDisplayMode = "Always"
  opts = res
  opts@cnFillOn = True
; opts@pmLabelBarOrthogonalPosF = -0.1
  opts@FieldTitle = "Wind Speed at 10 m"   ; overwrite Field Title
  opts@ContourParameters = (/ 900., 1100., 4. /)
  opts@gsnSpreadColorEnd = -3  ; End third from the last color in color map
  plot = gsn_csm_contour_map(wks,speed,opts)
end






warning:FieldTitle is not a valid resource in plt_Surface_multi_files_contour at this time
warning:ContourParameters is not a valid resource in plt_Surface_multi_files_contour at this time
warning:Footer is not a valid resource in plt_Surface_multi_files_contour at this time



图画出来不合适,谢谢各位大神了

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

新浪微博达人勋

 楼主| 发表于 2015-3-18 10:02:53 | 显示全部楼层
画出来这个样子
C:\Users\Administrator.PC-20131225WNKB\Desktop\plt_Surface_multi_files
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-3-18 14:06:13 | 显示全部楼层
warning没关系,相应的语句删除就行。
图片看不到,也不清楚“不合适”具体指的什么!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-3-20 09:36:07 | 显示全部楼层
本帖最后由 bbpp870630 于 2015-3-20 09:37 编辑
longlivehj 发表于 2015-3-18 14:06
warning没关系,相应的语句删除就行。
图片看不到,也不清楚“不合适”具体指的什么!


谢谢,就是不能改变色标和间隔 plt_Surface_multi_files.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-3-20 09:54:28 | 显示全部楼层
bbpp870630 发表于 2015-3-20 09:36
谢谢,就是不能改变色标和间隔

官网上有例子
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-5 10:26:30 | 显示全部楼层

请问能把对应修改图标的网址发一下吗
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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