[ncl-talk] Regridding data on unstructured grid with ESMF_Regrid

Peter Watson watson at atm.ox.ac.uk
Thu Aug 21 13:52:48 MDT 2014


Dear fellow NCL users,

I am trying to do conservative regridding of precipitation data from a
reduced Gaussian grid to a lat-lon grid using the ESMF_Regrid function in
NCL 6.1.2, but I get an error that I do not understand. My input data is in
a NetCDF file, with the precip data and the latitudes and longitudes of the
grid points stored as 1D arrays. An ncdump -h of the input file gives:

dimensions:
    space = 35718 ;
variables:
    double data(space) ;
    double lon1d(space) ;
    double lat1d(space) ;


I use the following lines of NCL, based on the example script at
http://www.ncl.ucar.edu/Applications/Templates/ESMF_unstruct_to_0.25deg.ncl
:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

file_in=addfile("regrid_cons_irreg.nc","r")
data = file_in->data
lats = file_in->lat1d
lons = file_in->lon1d

Opt=True
Opt at SrcGridLat         = lats
Opt at SrcGridLon        = lons
Opt at DstGridType      = "5x5"
Opt at ForceOverwrite  = True
Opt at InterpMethod     = "conserve"
Opt at DstLLCorner      = (/-85.0d, 0.0d /)
Opt at DstURCorner     = (/ 85.0d, 355.0d /)

Opt at Debug            = True

data_latlon=ESMF_regrid(data,Opt)

This gives the error:

(0)    ESMF_regrid_with_weights: retrieving interpolation weights ...
(0)    ESMF_regrid_with_weights: error: source data on the description
(0)         file does not have proper dimensions.

I don't understand why this fails. Is there something wrong with how I am
reading in the data and coordinates? Are there any conditions that need to
be satisfied, like the coordinates increasing monotonically (mine do not)?
If anyone has a script and NetCDF file for which this sort of regridding
succeeds that they could let me see, then that would be very helpful.

Thanks very much for any help you can give.

Kind regards,

Peter Watson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140821/76535bc6/attachment.html 


More information about the ncl-talk mailing list