<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Dennis,</p>
<p>Thanks for looking at my issue. I did find that I made a mistake:</p>
<p> latCell = sfile1->lonCell(:)<br>
lonCell = sfile1->latCell(:)</p>
<p>They should be:</p>
<p> latCell = sfile1->latCell(:)<br>
lonCell = sfile1->lnCell(:)</p>
<div class="moz-cite-prefix">Now the script works just fine. I
apologize for wasting your time due to my fault. <br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Thanks again and have a good long
weekend!</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Ming<br>
</div>
<br>
<div class="moz-cite-prefix">On 9/4/20 3:00 PM, Dennis Shea wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOF1d_75z2C+3Nf+t8CS_wMd9GbOiRmVtygzUQdnchH+sD5-nA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hello, <br>
</div>
<div><br>
</div>
<div>I see nothing wrong with your script. <br>
</div>
<div>The ESMF package invoked by NCL has had some issues with
unstructured grids. <br>
</div>
<div>For "fun" I switched the method from "patch" to "bilibear".</div>
<div>The same error was encountered.</div>
<div><br>
</div>
<div>I will look a bit more bur ... likely after Labor Day.</div>
<div><br>
</div>
<div>Regards</div>
<div>D<br>
</div>
<div>[bilinear]</div>
<div><br>
</div>
<div>%> ncl MingChen.ncl</div>
<div><br>
</div>
Copyright (C) 1995-2019 - All Rights Reserved<br>
University Corporation for Atmospheric Research<br>
NCAR Command Language Version 6.6.2<br>
The use of this software is governed by a License Agreement.<br>
See <a href="http://www.ncl.ucar.edu/" moz-do-not-send="true">http://www.ncl.ucar.edu/</a>
for more details.<br>
(0) get_src_grid_info: source lat dims = (501576)<br>
(0) get_src_grid_info: source lon dims = (501576)<br>
(0) get_src_grid_info: source grid type is 'unstructured'<br>
(0) unstructured_to_ESMF: triangulating the data to create the
edges for your unstructured data.<br>
(0) This can be VERY slow if you have a
large array.<br>
(0) To speed up code, provide your own edge
vertices via the<br>
(0) 'ElementVertices' option.<br>
(0) min/max ElementVertices = 0/501575<br>
(0) unstructured_to_ESMF: total number of elements created:
1003004<br>
(0) unstructured_to_ESMF: Element Area:
min:8.240130582062269e-11 max:0.000118294428582022<br>
(0) write_grid_description_file: writing unstructured 'Src' grid
to an ESMF description file<br>
(0) get_dst_grid_info: destination lat dims = (250364)<br>
(0) get_dst_grid_info: destination lon dims = (250364)<br>
(0) unstructured_to_ESMF: triangulating the data to create the
edges for your unstructured data.<br>
(0) This can be VERY slow if you have a
large array.<br>
(0) To speed up code, provide your own edge
vertices via the<br>
(0) 'ElementVertices' option.<br>
(0) min/max ElementVertices = 0/250363<br>
(0) unstructured_to_ESMF: total number of elements created:
500658<br>
(0) unstructured_to_ESMF: Element Area:
min:1.381117442633695e-13 max:0.008010342243264967<br>
(0) write_grid_description_file: writing unstructured 'Dst' grid
to an ESMF description file<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) 'ESMF_RegridWeightGen --ignore_degenerate --src_loc corner
--dst_loc corner --source MPAS_ESMF.nc --destination
MPAS_CELL.nc --weight <a href="http://vertex_2_cell.nc"
moz-do-not-send="true">vertex_2_cell.nc</a> --method bilinear
--src_type ESMF --dst_type ESMF -i'<br>
(0) --------------------------------------------------<br>
(0) ESMF_regrid_gen_weights: output from 'ESMF_RegridWeightGen':<br>
(0) <br>
(1) WARNING: deprecated switch -src_type will be ignored.
The file type will be de<br>
<div>(2) tected automatically</div>
<div>(3) <br>
(4) WARNING: deprecated switch -dst_type will be
ignored. The file type will be de<br>
(5) tected automatically<br>
(6) Starting weight generation with these inputs: <br>
(7) Source File: MPAS_ESMF.nc<br>
(8) Destination File: MPAS_CELL.nc<br>
(9) Weight File: <a href="http://vertex_2_cell.nc"
moz-do-not-send="true">vertex_2_cell.nc</a><br>
(10) Source File is in ESMF format<br>
(11) Source Grid is a global grid<br>
(12) Source Grid is an unstructured grid<br>
(13) Use the corner coordinates of the source grid to
do the regrid<br>
(14) Destination File is in ESMF format<br>
(15) Destination Grid is a global grid<br>
(16) Destination Grid is an unstructured grid<br>
(17) Use the corner coordinates of the destination grid
to do the regrid<br>
(18) Regrid Method: bilinear<br>
(19) Pole option: ALL<br>
(20) Ignore unmapped destination points<br>
(21) Ignore degenerate cells in the input grids<br>
(22) Line Type: cartesian<br>
(23) Norm Type: dstarea<br>
(24) Extrap. Method: none<br>
(25) <br>
(26) Completed weight generation successfully.<br>
(27) <br>
(0) --------------------------------------------------<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: error: there are no weights on
this file.<br>
(0) This likely means there was a problem with the mapping<br>
(0) from the source grid to the destination grid.<br>
(0) Check that both grids are valid.</div>
<div>Variable: sp_regrid<br>
Type: float<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 3<br>
_FillValue : 9.96921e+36<br>
lat1d : <ARRAY of 250364 elements><br>
lon1d : <ARRAY of 250364 elements></div>
<div><br>
</div>
<div>===========</div>
<div>Variable: sp_regrid<br>
Type: float<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 3<br>
_FillValue : 9.96921e+36<br>
lat1d : <ARRAY of 250364 elements><br>
lon1d : <ARRAY of 250364 elements></div>
<div><br>
</div>
<div>========================</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Sep 3, 2020 at 12:33
PM Ming Chen via ncl-talk <<a
href="mailto:ncl-talk@mailman.ucar.edu"
moz-do-not-send="true">ncl-talk@mailman.ucar.edu</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear
NCL-experts,<br>
<br>
I am trying to remap data between different unstructured
grids, <br>
specifically, from MPAS mesh corners to MPAS cell centers.
However, the <br>
following error message appears:<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: error: there are no weights
on this file.<br>
(0) This likely means there was a problem with the
mapping<br>
(0) from the source grid to the destination grid.<br>
(0) Check that both grids are valid.<br>
<br>
Any help will be appreciated!<br>
<br>
<br>
Below is the script:<br>
<br>
begin<br>
srcFile = <br>
"/glade/scratch/chenming/mmm_20200616/MPAS_10km/2017022200/<a
href="http://history.2017-02-23_00.00.00.nc"
rel="noreferrer" target="_blank" moz-do-not-send="true">history.2017-02-23_00.00.00.nc</a>"<br>
dataFile = <br>
"/glade/scratch/chenming/mmm_20200616/MPAS_10km/2017022200/<a
href="http://diag.2017-02-23_00.00.00.nc" rel="noreferrer"
target="_blank" moz-do-not-send="true">diag.2017-02-23_00.00.00.nc</a>"<br>
<br>
sfile1 = addfile(srcFile,"r") ; Source grid<br>
sfile2 = addfile(dataFile,"r") ; Source data
file<br>
<br>
r2d = 180.0/(atan(1)*4.0)<br>
<br>
lonVertex = sfile1->lonVertex<br>
latVertex = sfile1->latVertex<br>
lonVertex = lonVertex*r2d<br>
latVertex = latVertex*r2d<br>
<br>
latCell = sfile1->lonCell(:)<br>
lonCell = sfile1->latCell(:)<br>
lonCell = lonCell*r2d<br>
latCell = latCell*r2d<br>
<br>
sp = ndtooned(sfile2->vorticity_500hPa(0,:))<br>
sp = sp*10.^5<br>
<br>
Opt = True<br>
Opt@SrcFileName = "MPAS_ESMF.nc"<br>
Opt@WgtFileName = "<a
href="http://vertex_2_cell.nc" rel="noreferrer"
target="_blank" moz-do-not-send="true">vertex_2_cell.nc</a>"<br>
Opt@DstFileName = "MPAS_CELL.nc"<br>
Opt@ForceOverwrite = True<br>
Opt@SrcGridLat = latVertex<br>
Opt@SrcGridLon = lonVertex<br>
Opt@SrcInputFileName = srcFile<br>
Opt@DstGridLat = latCell<br>
Opt@DstGridLon = lonCell<br>
Opt@DstTitle = "MPAS-Vertex2Cell"<br>
Opt@DstGridType = "unstructured"<br>
Opt@SrcGridType = "unstructured"<br>
Opt@InterpMethod = "patch"<br>
Opt@Debug = True<br>
<br>
sp_regrid = ESMF_regrid(sp,Opt)<br>
<br>
printVarSummary(sp_regrid)<br>
<br>
end<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank"
moz-do-not-send="true">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</blockquote>
</body>
</html>