[ncl-talk] interpolation
Dennis Shea
shea at ucar.edu
Wed Jul 25 15:35:55 MDT 2018
[1]
NCL uses a simple and fast version of bilinear interpolation. As noted in
the documentation it is developed for rectilinear grids
There are various forms of bilinear interpolation. Two are here:
http://www.ahinson.com/algorithms_general/Sections/InterpolationRegression/
InterpolationBilinear.pdf
http://www.ahinson.com/algorithms_general/Sections/InterpolationRegression/
InterpolationIrregularBilinear.pdf
I have no idea what is used by ESMF.
[2]
The following should not have been commented if you want netCDF-4. I did
not.
NCL's default is classic netCDF-3
setfileoption("nc", "Format", "NetCDF4Classic") ; nc4
*Advanced"* means NCL will use a newer file structure with the capability
of handling
groups and more advanced data structures. You do not have the need for this.
On Wed, Jul 25, 2018 at 8:09 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com
> wrote:
> Thank you so much for your help.
> The script works now, correctly.
> 1- However could I ask what the main reason(s) for the difference between "
> linint2_points" and "bilinear" in "ESMF_regrid" is(are)? I mean why the
> outputs of these two methods are different?
> I took a glance on these pages: "http://www.ncl.ucar.edu/
> Applications/ESMF.shtml", "http://earthsystemmodeling.
> org/esmf_releases/non_public/ESMF_6_1_1/ESMF_refdoc/node5.html#
> SECTION05012600000000000000", "http://earthsystemmodeling.
> org/esmf_releases/non_public/ESMF_6_1_1/ESMF_refdoc/node5.html#
> SECTION05012600000000000000" and they help me a lot.
>
> 2- Beside that why the following two lines have to be commented?
> "
> ; setfileoption("nc", "FileStructure", "Advanced")
> ; setfileoption("nc", "Format", "NetCDF4Classic")
> "
> Albeit there isn't setfileoption in examples like this "
> http://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_13.ncl".
>
> Sincerely
> Ehsan
> On Tuesday, July 24, 2018, 4:27:49 AM GMT+4:30, Dennis Shea <shea at ucar.edu>
> wrote:
>
>
> I modified your script.
>
> Use only "bilinear" and/or "nearest neighbor' .
>
> "patch" is *NOT* appropriate. I was/is for highly accurate derivatives. as
> needed for say ocean curl.
>
> Please read all ESMF documentation.
>
> On Sat, Jul 21, 2018 at 5:43 AM, Ehsan Taghizadeh <
> ehsantaghizadeh at yahoo.com> wrote:
>
> Thank you for your help.
> I'd used ncl scrip which was written by ncl-talk group, to interpolate GPM
> data to station points, in ASCII format.
> After finishing work, and sending paper to journal, referee wants to know
> the effect of other interpolating methods. So I decided to use some other
> methods to interpolate GPM data on station points.
> I've tried ESMF regridding library as you suggested. However I faced the
> error:
> "ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful."
> Beside that I have to write output file in ASCII format.
> I've attached first script (Interpolating_bilinear.ncl) which works
> correctly via bilinear method, and second script (Interpolating_ESMF.ncl)
> which uses ESMF regridding. Also input data are attached (GPM_IMERGV04DE_20160401_
> 20170228 directory and stations_NW.csv file which contains destination
> lat/lon).
> Could I have your help to modify "Interpolating_ESMF.ncl" to use
> different interpolating methods (bilinear", "neareststod", "patch")?
> Also could I have your opinion to answer the referee about using different
> interpolating methods? Is it necessary to use different interpolating
> methods and comparing them?
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> $ ncl -V
> 6.5.0
> $ uname -a
> Linux localhost.localdomain 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6
> 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> $ gcc --version
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> Sincerely
> Ehsan
>
> On Thursday, July 19, 2018, 10:22:38 PM GMT+4:30, Dennis Shea <
> shea at ucar.edu> wrote:
>
>
> Without the printVarSummary() of your 'z' variable, it is hard to tell
> what the problem might be:
>
> function dspnt2 (
> x [*] : numeric,
> y [*] : numeric,
> z : numeric,
> xo [*] : numeric,
> yo [*] : numeric
> )
>
> This assumes a cartesian grid. Still: lon[*] and lat[*] are commonly input
> to the function as x[*] and y[*]
>
> =====
> However, I am not evne going to deall with the 'dspnt2. Please use the
> ESMF regridding library.
>
>
> http://www.ncl.ucar.edu/ Applications/ESMF.shtml
> <http://www.ncl.ucar.edu/Applications/ESMF.shtml>
>
> Something like:
>
> var = f->FOO
> printVarSummary(var)
> printMinMax(var,0)
>
> interp_method = "bilinear" ; "neareststod", "patch"
> wgt_file_name = "wgt.ESHAN_"+interp_method+". nc"
>
> Opt = True
> Opt at SrcGridLat = lat ; rectilinear lat[*]
> Opt at SrcGridLon = lon ; " lon[*]
>
> Opt at DstGridLat = ulat ; unstructured latitudes
> Opt at DstGridLon = ulon ; " longitudes
>
> Opt at InterpMethod = interp_method
> Opt at WgtFileName = wgt_file_name
>
>
> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding
>
> printVarSummary(var_regrid))
> printMinMax(var_regrid,0)
>
> PLEASE *CAREFULLY* READ the documentation and examples.
>
>
> On Thu, Jul 19, 2018 at 2:04 AM, Ehsan Taghizadeh <
> ehsantaghizadeh at yahoo.com> wrote:
>
> Hi,
> Is there any interpolation method from rectilinear grid to an
> unstructured grid other than bilinear interpolation in NCL, like kriging,
> nearest point, etc? However I found this link (https://www.ncl.ucar.edu/
> Support/talk_archives/2011/ 0595.html
> <https://www.ncl.ucar.edu/Support/talk_archives/2011/0595.html>) which
> states "There is no kriging interpolation function in NCL".
> Beside that could "dspnt2" be used to interpolate from rectilinear grid
> to an unstructured grid? However it seems it couldn't and following error
> is the subject "fatal:dspnt2: the rightmost dimension of z must be the
> same as the dimension of x and y".
>
> I'll be thankful for any help.
>
> Sincerely
> Ehsan
>
> ______________________________ _________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
> ______________________________ _________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
> _______________________________________________
> 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/20180725/3b7f6e89/attachment.html>
More information about the ncl-talk
mailing list