[ncl-talk] Interpolation-subsetting strategy

Dennis Shea shea at ucar.edu
Mon Dec 2 19:22:15 MST 2019


I think wrote that example...... a LONG time ago.

Deep Background:  Virtually all NCL examples were created based on user
specified needs and files. What was done for one user may/may-not be ideal
for another user.

[1]
The example you referenced used a *pre-existing  ESMF weights file *created
created via ESMF This weights file interpolated  variables on NARR's
curvilinear grid to a rectilinear grid. Subsequent use of existing weight
file is extremely fast. [Basically, a sparse matrix multiply is used.].

;
;-[2] Interpolate to a rectilinear grid using existing weight file
;     This returns lon=[150..358.5] because the original weight file
returned this orientation.
;
  var_regrid = *ESMF_regrid_with_weights*
<http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_with_weights.shtml>(VarHgt,narrWgtPath,False)


In this case, it was more convenient to create the rectilinear grid and the
use *linint2_points_Wrap*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml>

====
[2]
A more direct approach would be
   (a) Open/read the NARR file [grib, netCDF, .... NCL does not care]
   (b) Specify desired location(s)
   (c) Use *rcm2points*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/rcm2points.shtml>
   (d) write text [ascii, CSV] file

Unfortunately, *rcm2points* is brute force. It is a bit slow and the crude
search *must be repeated for each variable*.

[3]
You could use *region_ind*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml>
to isolate a region around your specified location(s)
and then pass the subregion to *rcm2points *. Likely, this could be
*MUCH *faster
than [2].




On Mon, Dec 2, 2019 at 10:46 AM Jennifer Krauel via ncl-talk <
ncl-talk at ucar.edu> wrote:

> I'm new to NCL and have been studying all the reference material I can
> find. There are plenty of sample scripts, but many of them raise more
> questions than they answer. I'm hoping this is the best place to go for
> some answers.
>
> I need to access data from NARR, but only from a single lat/long point. I
> need temperature and wind (U,V) at 100m intervals from 50m up to 3000m,
> which I'll export to a csv file. This sample script is close to what I
> need, except I need many more vertical points:
>
> https://www.ncl.ucar.edu/Applications/Scripts/narr_7.ncl
>
> The script first interpolates vertically (int2p_n_Wrap), then curvilinear
> to rectilinear (ESMF_regrid_with_weights), then to specific points
> (linint2_points_Wrap).
>
> Is there a reason for this order? Won’t it take a long time to do vertical
> interpolation on the whole file if I just want one point? I will need these
> data from the 3h intervals over about 9 months, so efficiency is going to
> matter. I found some information about using masks with ESMF weight files
> to reduce the area for regridding, so why not do that first and mask out
> all but an area around the desired point? And how big of an area would I
> need? I haven't found any actual scripts that do this explicitly for
> geographic subsetting, so I am not sure if it is a good idea.
> https://www.ncl.ucar.edu/Applications/ESMF.shtml
>
> Thanks for any advice you can give me!
> Jennifer
> _______________________________________________
> 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/20191202/0c1664b7/attachment.html>


More information about the ncl-talk mailing list