[ncl-talk] Get hourly precipitation (.txt file)
Dennis Shea
shea at ucar.edu
Wed Apr 21 09:05:05 MDT 2021
rain_point = rain(1:ntim-1,locY,locX) - rain(0:ntim-2,locY,locX)
print(rain_point)
===
Likely, the time dimension is of size [ntim2].
Hence, there is a dimension size mismatch between the right-hand-side of
the assignment statement an the left-hand-side
Maybe, the following is what you want:
rain(1:ntim-2,locY,locX)=rain(1:ntim-1,locY,locX) -
rain(0:ntim-2,locY,locX)
On Tue, Apr 20, 2021 at 11:33 PM 소윤영 via ncl-talk <ncl-talk at mailman.ucar.edu>
wrote:
> 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
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210421/b0d9cdde/attachment.html>
More information about the ncl-talk
mailing list