<div dir="ltr"><div class="gmail_default" style="font-size:small">[I failed to send this back to ncl-talk.]</div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Mary Haley</b> <span dir="ltr"><<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>></span><br>
Date: Tue, Aug 19, 2014 at 10:43 PM<br>Subject: Re: [ncl-talk] ESMF Regridding Help<br>To: "HAVENER, KEVIN F GS-12 USAF AFWA 14 WS/WXED" <<a href="mailto:kevin.havener@us.af.mil">kevin.havener@us.af.mil</a>><br>
<br><br><div dir="ltr"><div style="font-size:small">Hi Kevin,</div><div style="font-size:small"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:small">
<font face="arial, helvetica, sans-serif">I think the issue may be with how you are trying to open the "<a href="http://regrid.nc" target="_blank">regrid.nc</a>" file for writing.</font></div><div style="font-size:small">
<font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:small"><font face="arial, helvetica, sans-serif">When you use "addfile" with the "w" option, this means you want to both read *and* write the file, so "addfile" is expecting "<a href="http://regrid.nc" target="_blank">regrid.nc</a>" to already exist.</font></div>
<div style="font-size:small"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:small"><font face="arial, helvetica, sans-serif">If "<a href="http://regrid.nc" target="_blank">regrid.nc</a>" is a new file you want to create, then you want to use the "c" option for "create".</font></div>
<div style="font-size:small"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:small"><font face="arial, helvetica, sans-serif">Also, if you will be running the script multiple times, NCL is not going to let you overwrite this file. So, you want to remove it before you open it:</font></div>
<div style="font-size:small"><br></div><div style="font-size:small">
<p><font face="courier new, monospace">;---Don't need to plot, need to write file, so open the output file<br> outFileName = <span>"<a href="http://regrid.nc" target="_blank">regrid.nc</a>"<br> system("rm -rf " + outFileName) ; remove file first<br>
</span></font><span style="font-family:'courier new',monospace"> ofile = </span><span style="font-family:'courier new',monospace">addfile</span><span style="font-family:'courier new',monospace">(outFileName, </span><span style="font-family:'courier new',monospace">"c"</span><span style="font-family:'courier new',monospace">)</span></p>
<p><font face="arial, helvetica, sans-serif">Your script looks mostly fine otherwise, but I think you have an error with this line:</font></p><p>
</p>
<p><span> ofile->var_regrid = varname </span>;; my attempt to write to output file </p><p>You probably want:</p><p><span> ofile->var_regrid = var_regrid </span>;; my attempt to write to output file </p>
<div>"varname" is just the name of the variable, while "var_regrid" is the variable that contains the values that have been regridded.</div><div><br></div><div>--Mary</div><div><br></div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote"><div><div class="h5">On Tue, Aug 19, 2014 at 7:46 AM, HAVENER, KEVIN F GS-12 USAF AFWA 14 WS/WXED <span dir="ltr"><<a href="mailto:kevin.havener@us.af.mil" target="_blank">kevin.havener@us.af.mil</a>></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 class="h5">I am attempting to use ESMF_regrid to regrid some data on a 7x181x360 to a<br>
7x180x360 grid. Not sure if ESMF_regrid is the most sane way to do this but<br>
it is the way I came up with. The attached script documents my attempts to<br>
modify a template from the ESMF_regrid section of the website.<br>
<br>
Unlike all the sample scripts, I do not wish to plot the data, but merely<br>
reformat it so I can perform calculations against an existing dataset. I<br>
think I've just about got it, except I can't get it to write out the data in<br>
a new file, getting this error:<br>
<br>
file_ext_q: <Undefined><br>
fatal:["FileSupport.c":4017]:_NclCreateFile: Can not open file:<br>
<<a href="http://regrid.nc" target="_blank">regrid.nc</a>> properly.<br>
<br>
However the script does complete and the ending printVarSummary seems<br>
reasonable.<br>
<br>
If anyone on the list who is familiar with ESMF_regrid would take a look at<br>
the attached script (my comments are generally marked by ";;;") and tell me<br>
where I've gone wrong, I'd appreciate it. I admit I had a hard time<br>
following the documentation for writing out a file in general, without the<br>
added regridding complexity.<br>
<br>
Thank you,<br>
Kevin Havener<br>
<br></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></blockquote></div><br></div>
</div><br></div>