[ncl-talk] Batch processing
Arka Banerjee
arka354deb at gmail.com
Fri Dec 15 14:22:29 MST 2017
Thank you for the clarification.
Will check.
Arka
On Dec 16, 2017 12:26 AM, "Adam Phillips" <asphilli at ucar.edu> wrote:
> Hi Arka,
> As I stated to you before please do not write individual ncl-talk
> contributors, and always respond to the ncl-talk email list. Further
> communications that are directed solely to ncl-talk contributors and not to
> the ncl-talk email list will be ignored.
>
> You stated the following in your email to me:
> --
> I made a script as per your direction in NCL. But it is not running and
> showing error at first line.
> My script is attached below.
> What is the error in this?
> --
> Always send along the error message when communicating with ncl-talk. You
> are receiving the following message:
> fatal:syntax error: line -1 before or near
>
> You should become familiar with searching the NCL FAQ page:
> http://www.ncl.ucar.edu/FAQ/
>
> Search on that page for "syntax error" and you will see that you need an
> "end" at the end of your script as you have a "begin". Thus put a "end" at
> your line 25 and a blank line at line 26 and things should work.
>
> If they do not, or if you have any further questions respond to the
> ncl-talk email list and not to me personally.
> Adam
>
> On Mon, Dec 11, 2017 at 11:52 AM, Karin Meier-Fleischer <
> meier-fleischer at dkrz.de> wrote:
>
>> Adam is right, I've missed that you want to convert numerous files. It is
>> not possible to have one common ctl file for numerous binary files! Each
>> data file has to have its own ctl file. So, follow Adams instructions and
>> you'll be fine.
>>
>> -Karin
>>
>> Am 11.12.17 um 19:44 schrieb Adam Phillips:
>>
>> Hi Arka,
>> To be clear to everyone on ncl-talk you are asking how to convert
>> numerous dat files to .nc files using a single control file and the CDO
>> import_binary option whose use is illustrated here:
>> https://www.ncl.ucar.edu/Applications/grads.shtml
>>
>> You can write a script (in any language, NCL, c-shell, etc) that runs a
>> do loop for each .dat file, that will create a new ctl file and convert to
>> a NetCDF file:
>>
>> ; UNTESTED. You will need to alter the following to suit your needs.
>> fn = (/"file1.dat","file2.dat","file3.dat"/)
>>
>> ctl = new(8,string) ; set up control file (or alternatively read in
>> existing one)
>> ctl(1) = "UNDEF 1E30"
>> ctl(2) = "XDEF 128 LINEAR 0.0 2.8125"
>> ..... <snip>
>> ctl(5) = "VARS 1"
>> ctl(6) = "z 1 99 sea surface temperature"
>> ctl(7) = "ENDVARS"
>>
>> do gg = 0,dimsizes(fn)-1
>> ctl(0) = "DSET "+fn(gg)
>> asciiwrite("file.ctl",ctl)
>> system("cdo -f nc import_binary file.ctl "+fn(gg)+".nc")
>> system("rm file.ctl") ; optional
>> end do
>>
>> Hope that helps. If you have any further questions please respond to
>> ncl-talk.
>> Adam
>>
>>
>>
>> On Mon, Dec 11, 2017 at 11:25 AM, Arka Banerjee <arka354deb at gmail.com>
>> wrote:
>>
>>> Hi..
>>>
>>> How to convert .dat files to .nc files using one .ctl file?
>>>
>>> Thanks
>>> Arka
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726 <(303)%20497-1726>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing listncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726 <(303)%20497-1726>
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171216/e6b36e8e/attachment.html>
More information about the ncl-talk
mailing list