<div dir="ltr"><div><div><div><div><div>Thanks for your help Dennis. I tried this again, this time providing the corner information as shown below, but got the same error message. My input netCDF file <a href="http://regrid_cons_rg.nc">regrid_cons_rg.nc</a> (note I changed the filename) is now structured as follows:<br>
<br>netcdf regrid_cons_rg {<br>dimensions:<br> space = 35718 ;<br> corner = 4 ;<br>variables:<br> double data(space) ;<br> double lon1d(space) ;<br> double lat1d(space) ;<br> double corner_lons(space, corner) ;<br>
double corner_lats(space, corner) ;<br>}<br><br></div>I added the corner_lons and corner_lats arrays, which define tessellating rectangular cells centred on each grid point (except at the northernmost and southernost latitudes, where the cells stretch to the pole). I transferred the file <a href="http://regrid_cons_rg.nc">regrid_cons_rg.nc</a> by ftp as before.<br>
<br></div>The following lines of ncl:<br><br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br>file_in=addfile("<a href="http://regrid_cons_rg.nc">regrid_cons_rg.nc</a>","r")<br>
data = file_in->data<br>lats = file_in->lat1d<br>lons = file_in->lon1d<br>corner_lats = file_in->corner_lats<br>corner_lons = file_in->corner_lons<br>Opt=True<br>Opt@SrcGridLat = lats<br>Opt@SrcGridLon = lons<br>
Opt@SrcGridCornerLat = corner_lats<br>Opt@SrcGridCornerLon = corner_lons<br>Opt@DstGridType = "5x5"<br>Opt@ForceOverwrite = True<br>Opt@InterpMethod="conserve"<br>Opt@DstLLCorner = (/-85.0d, 0.0d /)<br>
Opt@DstURCorner = (/ 85.0d, 355.0d /)<br><br>Opt@Debug = True<br><br>data_latlon=ESMF_regrid(data,Opt)<br><br><br></div>give the error:<br><br>(0) ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was successful.<br>
(0) ESMF_regrid_with_weights: regridding using interpolation weights ...<br>(0) ESMF_regrid_with_weights: warning: destination grid is not<br>(0) completely covered by the source grid. This is not an error.<br>
(0) It just means your destination grid covers a larger area<br>(0) than your source grid.<br>(0) ESMF_regrid_with_weights: Source Grid:<br>(0) rank: 1<br>(0) dimensions: 71432<br>
(0) original source rank: 1<br>(0) latitude min/max: -89.1415/89.1415<br>(0) longitude min/max:0.375/358.5<br>(0) ESMF_regrid_with_weights: Destination Grid:<br>
(0) dimensions: 35 72<br>(0) latitude min/max: -85/85<br>(0) longitude min/max:0/355<br>(0) ESMF_regrid_with_weights: retrieving interpolation weights ...<br>
(0) ESMF_regrid_with_weights: error: source data on the description<br>(0) file does not have proper dimensions.<br><br><br></div>Is it possible to tell what is going wrong here? Or is there another way of doing this?<br>
<br></div>Kind regards,<br><br>Peter<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 23, 2014 at 3:28 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">The attached works with the bilinear and patch methods. The conserve method requires 'corner' information. NCL's implementation tries to derive the corner info but is not always successful. I think that is what is happening in your case. This
will be looked at more when we get a chance.<br>
<br>
<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote"><div class="">On Thu, Aug 21, 2014 at 1:52 PM, Peter Watson <span dir="ltr">
<<a href="mailto:watson@atm.ox.ac.uk" target="_blank">watson@atm.ox.ac.uk</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>Dear fellow NCL users,<br>
<br>
</div>
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:<br>
<br>
dimensions:<br>
space = 35718 ;<br>
variables:<br>
double data(space) ;<br>
double lon1d(space) ;<br>
double lat1d(space) ;<br>
<br>
<br>
</div>
I use the following lines of NCL, based on the example script at <a href="http://www.ncl.ucar.edu/Applications/Templates/ESMF_unstruct_to_0.25deg.ncl" target="_blank">
http://www.ncl.ucar.edu/Applications/Templates/ESMF_unstruct_to_0.25deg.ncl</a> :<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br>
<br>
file_in=addfile("<a href="http://regrid_cons_irreg.nc" target="_blank">regrid_cons_irreg.nc</a>","r")<br>
data = file_in->data<br>
lats = file_in->lat1d<br>
lons = file_in->lon1d<br>
<br>
Opt=True<br>
Opt@SrcGridLat = lats<br>
Opt@SrcGridLon = lons<br>
Opt@DstGridType = "5x5"<br>
Opt@ForceOverwrite = True<br>
Opt@InterpMethod = "conserve"<br>
Opt@DstLLCorner = (/-85.0d, 0.0d /)<br>
Opt@DstURCorner = (/ 85.0d, 355.0d /)<br>
<br>
Opt@Debug = True<br>
<br>
data_latlon=ESMF_regrid(data,Opt)<br>
<br>
</div>
This gives the error:<br>
<br>
(0) ESMF_regrid_with_weights: retrieving interpolation weights ...<br>
(0) ESMF_regrid_with_weights: error: source data on the description<br>
(0) file does not have proper dimensions.<br>
<br>
</div>
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.<br>
<br>
</div>
Thanks very much for any help you can give.<br>
<br>
</div>
Kind regards,<br>
<br>
</div>
Peter Watson<br>
</div>
<br></div></div><div class="">
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</div></blockquote>
</div>
<br>
</div>
</div>
</blockquote></div><br></div>