<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Dennis, <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
[1] I overlooked the short to float, will try that and see if it resolves anything.
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
[2] I thought the weight files should be compatible? I used ncremap using NCL weight files successfully to get unstructured VR-CESM to rectilinear.
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Liz<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font face="Corbel, sans-serif">Dr. Elizabeth A Burakowski</font></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font face="Corbel, sans-serif">She/Her/Hers<br>
</font>
<div><font face="Corbel, sans-serif">Research Assistant Professor</font></div>
<div><font face="Corbel, sans-serif">Earth Systems Research Center & </font></div>
<div><font face="Corbel, sans-serif">Institute for the Study of Earth, Oceans, and Space</font></div>
<div><font face="Corbel, sans-serif">University of New Hampshire</font></div>
<div><font face="Corbel, sans-serif">8 College Road Durham, NH 03824</font></div>
<div><font face="Corbel, sans-serif">603-862-1796</font></div>
<div><font face="Corbel, sans-serif">elizabeth.burakowski@unh.edu</font></div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Monday, November 25, 2019 11:25 PM<br>
<b>To:</b> Burakowski, Elizabeth <Elizabeth.Burakowski@unh.edu><br>
<b>Cc:</b> ncl-talk@ucar.edu <ncl-talk@ucar.edu><br>
<b>Subject:</b> Re: [ncl-talk] Generating weights using ESMF_regrid_gen_weights</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>I have not looked carefully at this.</div>
<div><br>
</div>
<div>[1] <b><br>
</b></div>
<div><b>The SWE variable is type short. </b><br>
</div>
<div><br>
</div>
<div><span style="color:rgb(0,0,255)"><b>short </b></span>SWE(time, lat, lon) ;<br>
SWE:_FillValue = -999s ;<br>
SWE:long_name = "Snow Water Equivalent" ;<br>
SWE:grid_mapping = "crs" ;<br>
SWE:units = "millimeters h20" ;<br>
</div>
<div><br>
</div>
<div><b>You *must* unpack before use.</b></div>
<div>
<pre></pre>
</div>
<div>swe =<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Document_Functions_Contributed_short2flt.shtml&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=NwMtAWSn6DUG3SStTejycr4eTCrruoiJvqxf4eFOXHw&e=">
<b>short2flt</b></a>(sfile->SWE)</div>
<div>or, for a focused regional subset<br>
</div>
<div>swe = <b>short2flt</b>(sfile->SWE({latS:latN},{lonW:lonE}))</div>
<div><br>
</div>
<div>===</div>
<div>[2] <b><br>
</b></div>
<div><b>ncremap</b> is a netCDF Operator. It looks like you want the weights generated by NCL's
<b>ESMF </b>regrid package.</div>
<div>Are the weight files compatible?</div>
<div><br>
</div>
<div>===</div>
<div><br>
</div>
<div>D<br>
</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, Nov 25, 2019 at 2:35 PM Burakowski, Elizabeth via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm attempting to generate weights for regridding a 4 km grid to a 14 km grid using ESMF_regrid_gen_weights.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Source grid:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Univ. Arizon Snow Depth and SWE grids<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
4 km rectilinear, [lat | 621] x [lon |1405]</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Destination grid:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
VR-CESM CONUS (already regridded using ESMF)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
14 km rectilinear, [lat | 361] x [lon |560]</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
In the below NCL script, I use rectilinear_to_SCRIP on source and destination grids, then ESMF_regrid_gen_weights to create the weight file. No errors occur, however, when I try to regrid using ncremap, I get a bunch of zeros. I'd like to use the weight file
 on hundreds of files, hence using ncremap. <br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
When I test the weight file on one source variable using NCL's ESMF_regrid_with_weights, I get an argument type mismatch error, but I can't figure out why.  Any ideas how to fix this? Files are on cheyenne.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Script to generate weights:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>;======================================================================<br>
</span>
<div>; ESMF Regrid:   UA-SNOW-4km (rectilinear) to VRCESM-CONUS (rectilinear)<br>
</div>
<div>;======================================================================<br>
</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br>
</div>
<div><br>
</div>
<div>;======================================================================<br>
</div>
<div>;                         The main code<br>
</div>
<div>;======================================================================<br>
</div>
<div><br>
</div>
<div>begin<br>
</div>
<div>;---Specify interpolation to be used<br>
</div>
<div>    method = "patch"<br>
</div>
<div><br>
</div>
<div>;---Specify weight file name<br>
</div>
<div>    wgtFileName = "UASnow4km2VRCESMCONUS14km_"+method+".nc"<br>
</div>
<div><br>
</div>
<div>;---Input file (Source)<br>
</div>
<div>    srcFileDir  = "/glade/work/burakows/plot/validation/UA_Snow_4km/"<br>
</div>
<div>    srcFileName = "4km_SWE_Depth_WY2014_v01.nc"       ; any UA-Snow file<br>
</div>
<div>    srcGridName = "UASnow_4km_SCRIP.nc"<br>
</div>
<div><br>
</div>
<div>;---Retrieve a sample variable (used in plot)<br>
</div>
<div>    sfile       = addfile(srcFileDir+srcFileName,"r")<br>
</div>
<div>    srcVarName  = "SWE"                                ; [lat | 621] x [x | 1405]<br>
</div>
<div>    var_in      = sfile->$srcVarName$<br>
</div>
<div>    printVarSummary(var_in)<br>
</div>
<div><br>
</div>
<div>    Opt                 = True<br>
</div>
<div>    Opt@ForceOverwrite  = True<br>
</div>
<div>    Opt@Title           = "UA Snow 4km Grid"<br>
</div>
<div><br>
</div>
<div>;--- Convert UA Snow 4 km grid to SCRIP convention file<br>
</div>
<div>    rectilinear_to_SCRIP(srcGridName,var_in&lat,var_in&lon,Opt)<br>
</div>
<div>    delete(Opt)<br>
</div>
<div><br>
</div>
<div>;================================================================<br>
</div>
<div><br>
</div>
<div>;---File that contains the destination file coordinates<br>
</div>
<div>    dstFileDir  = "/glade/scratch/burakows/archive/VR-CESM_FHISTSTUB.1984-2015.CONUS30x4_prod/lnd/remap/"<br>
</div>
<div>    dstFileName = "<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__VR-2DCESM-5FFHISTSTUB.1984-2D2015.CONUS30x4-5Fprod.clm2.h0.2014-2D01-2D01-2D00000-5Fregrid.nc&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=9S8vxSlf_i2YzThseQwePEY4m0J2XrINsK9l6u4Pwzw&e=" target="_blank">VR-CESM_FHISTSTUB.1984-2015.CONUS30x4_prod.clm2.h0.2014-01-01-00000_regrid.nc</a>"
  ; any VR-CESM file<br>
</div>
<div>    dstGridName = "VRCESMCONUS_14km_SCRIP.nc"<br>
</div>
<span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>;---open VR-CESM file that contains the VR-CESM grid coordinates<br>
</span>
<div>    dfile       = addfile(dstFileDir+dstFileName,"r")<br>
</div>
<div>    dstVarName  = "H2OSNO"<br>
</div>
<div>    dvar_in     = dfile->$dstVarName$           ; [lat | 361 ] x [lon | 560]<br>
</div>
<div>    printVarSummary(dvar_in)<br>
</div>
<div><br>
</div>
<div>    Opt                 = True<br>
</div>
<div>    Opt@ForceOverwrite  = True<br>
</div>
<div>    Opt@Title           = "VR-CESM CONUS (14 km) grid"<br>
</div>
<div><br>
</div>
<div>;--- Convert VR-CESM CONUS 14 km to SCRIP convention file<br>
</div>
<div>    rectilinear_to_SCRIP(dstGridName,dvar_in&lat,dvar_in&lon,Opt)<br>
</div>
<div>    delete(Opt)<br>
</div>
<div><br>
</div>
<div><span>;--- Generate the weights to convert UA Snow 4 km grid to VR-CESM CONUS 14 km grid<br>
</span>
<div><br>
</div>
<div>    Opt         = True<br>
</div>
<div>    Opt@InterpMethod    = "patch"<br>
</div>
<div>    Opt@ForceOverwrite  = "True"<br>
</div>
<div><br>
</div>
<div>    ESMF_regrid_gen_weights(srcGridName,dstGridName,wgtFileName,Opt)<br>
</div>
<div>    delete(Opt)<br>
</div>
<span></span>end</div>
<div><br>
</div>
<span>;===============================================================</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="x_gmail-m_-3375074179553437793Signature">
<div></div>
<div name="x_divtagdefaultwrapper"><font face="Corbel, sans-serif">Dr. Elizabeth A Burakowski</font></div>
<div name="x_divtagdefaultwrapper"><font face="Corbel, sans-serif">She/Her/Hers<br>
</font>
<div><font face="Corbel, sans-serif">Research Assistant Professor</font></div>
<div><font face="Corbel, sans-serif">Earth Systems Research Center & </font></div>
<div><font face="Corbel, sans-serif">Institute for the Study of Earth, Oceans, and Space</font></div>
<div><font face="Corbel, sans-serif">University of New Hampshire</font></div>
<div><font face="Corbel, sans-serif">8 College Road Durham, NH 03824</font></div>
<div><font face="Corbel, sans-serif">603-862-1796</font></div>
<div><font face="Corbel, sans-serif"><a href="mailto:elizabeth.burakowski@unh.edu" target="_blank">elizabeth.burakowski@unh.edu</a></font></div>
</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=iaf2-zcxf3E8sZChmMYMznx0UoFQUQmcmNBbSwkBMkM&e=" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</body>
</html>