[ncl-talk] Get hourly precipitation (.txt file)

소윤영 yyso at ncam.kr
Tue Apr 20 23:32:50 MDT 2021


Dear NCL-Talk,
I have been using this script to get accumulated precipitation value(txt),
and I want to add hourly precipitation value, however the codes are not
working. How should I fix this?

===================================================================
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
;====================================================================
domain = "d02"
start = "20210417"
;====================================================================
stid = (/"87"/)

id=1
station = stid(id)
  if station.eq."87" then
    slat = 33.3562127
    slon = 126.1840886
end if

lampway = "/home/sja3/yun/ncl/prog/make_netcdf/wrfout/"+domain+"/"
lampdirs = systemfunc ("ls "+lampway)
startday = ind(str_get_cols(lampdirs,0,7).eq.start)

nt=24*12+1
it=ispan(1,nt,1)

  i=startday
 print(station+" -> "+i+"/"+(dimsizes(lampdirs)-1))
 lampfils = systemfunc ("ls "+lampway+lampdirs(i)+"/wrfout*")
 lampfi = addfiles(lampfils,"r")
 lampref = addfile(lampfils(0),"r")
 ListSetType(lampfi,"cat")         ; cat : tie to time,  join : tie to
number of files

 opt = True
 opt at returnInt = True
 locij = wrf_user_ll_to_ij(lampref, slon, slat, opt)
 locij = locij-1
 locX = locij(0)
 locY = locij(1)

 input_utim=wrf_user_getvar(lampfi, "times", -1)
 ntim=dimsizes(input_utim)

 rainc=wrf_user_getvar(lampfi, "RAINC", -1)
 rainnc=wrf_user_getvar(lampfi, "RAINNC", -1)
 rain=rainc+rainnc
 rain(1:ntim-1,locY,locX)=rain(1:ntim-1,locY,locX) -
rain(0:ntim-2,locY,locX)

* rain_point=rain(1:ntim-1,locY,locX)*

======================================================================

error occured in this line ->  rain_point=rain(1:ntim-1,locY,locX)
How should i fix this?

Olivia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210421/8f98f264/attachment.html>


More information about the ncl-talk mailing list