<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Peter,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">That&#39;s certainly unpleasant to have everything look like it&#39;s going well and the seg fault near the end.  All the ESMF debug output looks good, and usually the &quot;sparse_matrix_mult&quot; part is the part that goes quickly and always works.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">My guess is that it ran out of memory somewhere.  </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Would it be possible for you to provide the full script and necessary files so I can run it here? You can provide this information offline if preferred.  </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can use ftp, Google Drive, or dropbox.  The ftp information is here:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style><a href="http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP">http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP</a><br></div><div class="gmail_default" style><br></div><div class="gmail_default" style>Thanks,</div><div class="gmail_default" style><br></div><div class="gmail_default" style>--Mary</div><div class="gmail_default" style><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 19, 2014 at 5:34 AM, Peter Watson <span dir="ltr">&lt;<a href="mailto:watson@atm.ox.ac.uk" target="_blank">watson@atm.ox.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Hi again all,<br><br></div>This is a follow-on from a previous conversation I began when I was having trouble regridding data from an irregular grid (a reduced Gaussian grid) to a lat-lon grid. I waited for the next version of NCL to be released, but then I suddenly had to do work for another project and have only been able to pick this up again now. The problem does not seem to have been fixed in NCL 6.2.1 - I get a segmentation fault. Is there anything I can do to get this to work, or does NCL just not have the capacity to do this for now?<br><br></div>My input data on an irregular grid is in a file called &quot;<a href="http://regrid_cons_rg.nc" target="_blank">regrid_cons_rg.nc</a>&quot;, and an ncdump -h on this file gives:<span class=""><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></span></div>corner_lons and corner_lats give the positions of the corners of each grid cell.<br><br></div>I tried running the following NCL code to do regridding to a 5x5 lat-lon grid (the same as I posted before):<span class=""><br><br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;<br>file_in=addfile(&quot;<a href="http://regrid_cons_rg.nc" target="_blank">regrid_cons_rg.nc</a>&quot;,&quot;r&quot;)<br>data = file_in-&gt;data<br>lats = file_in-&gt;lat1d<br>lons = file_in-&gt;lon1d<br>corner_lats = file_in-&gt;corner_lats<br>corner_lons = file_in-&gt;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    = &quot;5x5&quot;<br>Opt@ForceOverwrite   = True<br>Opt@InterpMethod=&quot;conserve&quot;<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></span></div>This gives the following output, ending in a segmentation fault:<br><br>(0)     get_src_grid_info: source lat dims = (35718)<br>(0)     get_src_grid_info: source lon dims = (35718)<br>(0)     get_src_grid_info: source grid type is &#39;unstructured&#39;<br>(0)     unstructured_to_ESMF: triangulating the data ... this can be slow<br>(0)     min/max ElementVertices = 0/35717<br>(0)     unstructured_to_ESMF: total number of elements created: 71432<br>(0)     unstructured_to_ESMF: Element Area: min:4.629831710012411e-06 max:0.0002461602913053085<br>(0)     curvilinear_to_SCRIP: calculating grid corners...<br>(0)     curvilinear_to_SCRIP: no lat values are at the poles, so<br>(0)            calculating grid corners using<br>(0)            calc_SCRIP_corners_noboundaries...<br>(0)     calc_SCRIP_corners_noboundaries<br>(0)          min/max original lat: -85/85<br>(0)          min/max original lon: 0/355<br>(0)     calc_SCRIP_corners_noboundaries<br>(0)          min/max Extlat2d: -90/90<br>(0)          min/max Extlon2d: -5/360<br>(0)     calc_SCRIP_corners_noboundaries<br>(0)          min/max ExtGridCenter_lat: -87.5/87.5<br>(0)          min/max ExtGridCenter_lon: -2.5/357.5<br>(0)     ESMF_regrid_gen_weights: number of processors used: 1<br>(0)     --------------------------------------------------<br>(0)     ESMF_regrid_gen_weights: the following command is about to be executed on the system:<br>(0)     &#39;ESMF_RegridWeightGen --source <a href="http://source_grid_file.nc" target="_blank">source_grid_file.nc</a> --destination <a href="http://destination_grid_file.nc" target="_blank">destination_grid_file.nc</a> --weight <a href="http://weights_file.nc" target="_blank">weights_file.nc</a> --method conserve --src_type ESMF -i --norm_type fracarea&#39;<br>(0)     --------------------------------------------------<br>(0)     ESMF_regrid_gen_weights: output from &#39;ESMF_RegridWeightGen&#39;:<br>(0)           Starting weight generation with these inputs: <br>(1)             Source File: <a href="http://source_grid_file.nc" target="_blank">source_grid_file.nc</a><br>(2)             Destination File: <a href="http://destination_grid_file.nc" target="_blank">destination_grid_file.nc</a><br>(3)             Weight File: <a href="http://weights_file.nc" target="_blank">weights_file.nc</a><br>(4)             Source File is in ESMF format<br>(5)             Source Grid is a global grid<br>(6)             Source Grid is an unstructured grid<br>(7)             Destination File is in SCRIP format<br>(8)             Destination Grid is a global grid<br>(9)             Destination Grid is a logically rectangular grid<br>(10)            Regrid Method: conserve<br>(11)            Pole option: NONE<br>(12)            Ignore unmapped destination points<br>(13)            Norm Type: fracarea<br>(14)         <br>(15)          Completed weight generation successfully.<br>(16)         <br>(0)     --------------------------------------------------<span class=""><br>(0)     ESMF_regrid_gen_weights: &#39;ESMF_RegridWeightGen&#39; 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></span>(0)                               latitude min/max: -89.14151942646112/89.14151942646112<span class=""><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></span>(0)     ESMF_regrid_with_weights: calling sparse_matrix_mult to apply weights...<br>Segmentation fault<br><br><br></div>The code works if I specify &quot;patch&quot; as the regridding method.<br><br><br></div>Kind regards,<br><br></div>Peter Watson<br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Aug 26, 2014 at 3:35 AM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<div dir="ltr"><span class="">
<div class="gmail_default" style="font-size:small">I&#39;m hoping next week for a release of V6.2.1.  I want to get to get it out by Tuesday after labor day. </div></span><span><font color="#888888">
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
</font></span></div><div><div class="h5"><div><div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Aug 25, 2014 at 11:06 AM, Peter Watson <span dir="ltr">
&lt;<a href="mailto:watson@atm.ox.ac.uk" target="_blank">watson@atm.ox.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Thanks Mary. Trying that gave me a segmentation fault, though. When will the next version of NCL be released?<br>
<br>
</div>
Kind regards,<br>
<br>
Peter<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>On Mon, Aug 25, 2014 at 5:58 PM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi Peter,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">You may have run into a bug that we fixed in the upcoming release of NCL. I&#39;ve attached a new &quot;ESMF_regridding.ncl&quot; script.  Try saving it to the same directory as your script, and then comment out this line:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">
<div class="gmail_default">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">and add this line after or before it:</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">
<div class="gmail_default">load &quot;./ESMF_regridding.ncl&quot;</div>
<div><br>
</div>
</div>
<div>I&#39;m not entirely sure this will work, because you may need to have the latest version of NCL to use this, but it&#39;s worth a try.</div>
<span><font color="#888888">
<div><br>
</div>
<div>--Mary</div>
</font></span></div>
</div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>On Mon, Aug 25, 2014 at 10:37 AM, Peter Watson <span dir="ltr">&lt;<a href="mailto:watson@atm.ox.ac.uk" target="_blank">watson@atm.ox.ac.uk</a>&gt;</span> wrote:<br>
</div>
<div>
<div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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" target="_blank">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 ;
<div><br>
variables:<br>
    double data(space) ;<br>
    double lon1d(space) ;<br>
    double lat1d(space) ;<br>
</div>
    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" target="_blank">regrid_cons_rg.nc</a> by ftp as before.<br>
<br>
</div>
The following lines of ncl:<br>
<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;<br>
file_in=addfile(&quot;<a href="http://regrid_cons_rg.nc" target="_blank">regrid_cons_rg.nc</a>&quot;,&quot;r&quot;)
<div><br>
data = file_in-&gt;data<br>
lats = file_in-&gt;lat1d<br>
lons = file_in-&gt;lon1d<br>
</div>
corner_lats = file_in-&gt;corner_lats<br>
corner_lons = file_in-&gt;corner_lons
<div><br>
Opt=True<br>
Opt@SrcGridLat = lats<br>
Opt@SrcGridLon = lons<br>
</div>
Opt@SrcGridCornerLat = corner_lats<br>
Opt@SrcGridCornerLon = corner_lons
<div><br>
Opt@DstGridType    = &quot;5x5&quot;<br>
Opt@ForceOverwrite   = True<br>
</div>
Opt@InterpMethod=&quot;conserve&quot;
<div><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>
</div>
give the error:<br>
<br>
(0)    ESMF_regrid_gen_weights: &#39;ESMF_RegridWeightGen&#39; 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
<div><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>
</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">
<div>On Sat, Aug 23, 2014 at 3:28 AM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</span> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div dir="ltr">The attached works with the bilinear and patch methods. The conserve method requires &#39;corner&#39; information. NCL&#39;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>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>
<div>On Thu, Aug 21, 2014 at 1:52 PM, Peter Watson <span dir="ltr">&lt;<a href="mailto:watson@atm.ox.ac.uk" target="_blank">watson@atm.ox.ac.uk</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div>
<div>
<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 &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;<br>
<br>
file_in=addfile(&quot;<a href="http://regrid_cons_irreg.nc" target="_blank">regrid_cons_irreg.nc</a>&quot;,&quot;r&quot;)<br>
data = file_in-&gt;data<br>
lats = file_in-&gt;lat1d<br>
lons = file_in-&gt;lon1d<br>
<br>
Opt=True<br>
Opt@SrcGridLat         = lats<br>
Opt@SrcGridLon        = lons<br>
Opt@DstGridType      = &quot;5x5&quot;<br>
Opt@ForceOverwrite  = True<br>
Opt@InterpMethod     = &quot;conserve&quot;<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&#39;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>
</div>
<div>
<div>_______________________________________________<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>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
_______________________________________________<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>
</blockquote>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div></div></div>

</blockquote></div><br></div>
</blockquote></div><br></div>