[ncl-talk] wrf_user_getvar - select time period
Dennis Shea
shea at ucar.edu
Wed Mar 18 09:20:49 MDT 2020
Unfortunately, that 'custom script' has disappeared.
[1] If the variable is on the file, then you can read it directly. If there
are (say) 25 time steps but you only want 5 specified times,then:
it = ispan(7,11,1)
u = f->U(it,:,:,:)
even
it = (/3,7,8,9,21/)
u = f->U(it,:,:,:)
[2] I **speculate** that what was done was something like the following
undef("wrf_user_getvar_time_subset")
function wrf_user_getvar_time_subset(f, varName[1]:string, it[*]:integer)
local nit, dims, rank, n, x
begin
nit = dimsizes(it)
dims = getfilevardimsizes(f,varName)
rank = dimsizes(dims)
if (rank.eq.3) then
x = new((/nit,dims(1),dims(2)/),"float")
do n=0,nit-1
x(n,:,:) = wrf_user_getvar(f,varName,it(n))
end do
elseif (rank.eq.4) then
x = new((/nit,dims(1),dims(2),dims(3)/),"float")
do n=0,nit-1
x(n,:,:,:) = wrf_user_getvar(f, varName, it(n))
end do
end if
x!0 = "Time"
return(x)
end
;------------------
dirwrf = "./"
filwrf = "wrfout_d01_000000.nc"
pthwrf = dirwrf+filwrf
fwrf = addfile(pthwrf,"r")
it = (/3,7,8,9,21/)
varName= "U"
u = wrf_user_getvar_time_subset(fwrf, varName, it)
printVarSummary(u)
On Mon, Mar 16, 2020 at 9:47 PM Dong via ncl-talk <ncl-talk at ucar.edu> wrote:
> Hi,
> I'm using NCL 6.5 in Ununtu and have a question.
>
> I found that "wrf_user_getvar" only can get a specific time or all
> times but I want to retrieve a subset of times.
>
> Fortunately ,I find a solution in your website
> http://www.ncl.ucar.edu/Support/talk_archives/2009/2720.html
>
> The website said there are two ways I can do this. My data is so big that
> I can't retrieve all times (the .ncl script will be killed without any error
> message )and I want to use the second way :
>
> load "./wrfslp.ncl"
>
> and then call with:
>
> times = ispan(0,10,1)
>
> slp = wrf_user_get_slp(z,times)
> However, I can't load "./wrfslp.ncl" or download you attachment from your
> talk_archives: http://www.ncl.u
> car.edu/Support/talk_archives/2009/2720.html
>
> Any help greatly appreciated.
>
> Thanks,
> Dong
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200318/ad4bd2d0/attachment.html>
More information about the ncl-talk
mailing list