[ncl-talk] Fwd: ESMF Regridding Help
Mary Haley
haley at ucar.edu
Fri Aug 22 08:12:24 MDT 2014
[I failed to send this back to ncl-talk.]
---------- Forwarded message ----------
From: Mary Haley <haley at ucar.edu>
Date: Tue, Aug 19, 2014 at 10:43 PM
Subject: Re: [ncl-talk] ESMF Regridding Help
To: "HAVENER, KEVIN F GS-12 USAF AFWA 14 WS/WXED" <kevin.havener at us.af.mil>
Hi Kevin,
I think the issue may be with how you are trying to open the "regrid.nc"
file for writing.
When you use "addfile" with the "w" option, this means you want to both
read *and* write the file, so "addfile" is expecting "regrid.nc" to already
exist.
If "regrid.nc" is a new file you want to create, then you want to use the
"c" option for "create".
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:
;---Don't need to plot, need to write file, so open the output file
outFileName = "regrid.nc"
system("rm -rf " + outFileName) ; remove file first
ofile = addfile(outFileName, "c")
Your script looks mostly fine otherwise, but I think you have an error with
this line:
ofile->var_regrid = varname ;; my attempt to write to output file
You probably want:
ofile->var_regrid = var_regrid ;; my attempt to write to output
file
"varname" is just the name of the variable, while "var_regrid" is the
variable that contains the values that have been regridded.
--Mary
On Tue, Aug 19, 2014 at 7:46 AM, HAVENER, KEVIN F GS-12 USAF AFWA 14
WS/WXED <kevin.havener at us.af.mil> wrote:
> I am attempting to use ESMF_regrid to regrid some data on a 7x181x360 to a
> 7x180x360 grid. Not sure if ESMF_regrid is the most sane way to do this
> but
> it is the way I came up with. The attached script documents my attempts to
> modify a template from the ESMF_regrid section of the website.
>
> Unlike all the sample scripts, I do not wish to plot the data, but merely
> reformat it so I can perform calculations against an existing dataset. I
> think I've just about got it, except I can't get it to write out the data
> in
> a new file, getting this error:
>
> file_ext_q: <Undefined>
> fatal:["FileSupport.c":4017]:_NclCreateFile: Can not open file:
> <regrid.nc> properly.
>
> However the script does complete and the ending printVarSummary seems
> reasonable.
>
> If anyone on the list who is familiar with ESMF_regrid would take a look at
> the attached script (my comments are generally marked by ";;;") and tell me
> where I've gone wrong, I'd appreciate it. I admit I had a hard time
> following the documentation for writing out a file in general, without the
> added regridding complexity.
>
> Thank you,
> Kevin Havener
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140822/e639bc6a/attachment.html
More information about the ncl-talk
mailing list