[ncl-talk] Batch process
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Mon Dec 18 09:23:07 MST 2017
Please, reply to the ncl-talk list!
Are you familiar with the array subscripts? NCL array indices start with
index 0.
The "END VARS" line has to be "ENDVARS"; the index of ctl starts with 0.
Correct Tmin.ncl script:
;Tmin
begin
fn =(/"MINT1971.GRD","MINT1972.GRD"/) ; file paths
ctl=new(8,string)
ctl(*0*)="UNDEF 99.9"
ctl(*1*)="XDEF 35 LINEAR 66.5 1"
ctl(*2*)="YDEF 32 LINEAR 6.5 1"
ctl(*3*)="ZDEF 1 Linear 1 1"
;* CHANGE TDEF TO 366 FOR LEAP YEARS
ctl(*4*)="TDEF 365 LINEAR 1JAN1994 1DY"
ctl(*5*)="VARS 1"
ctl(*6*)="T 0 99 DAILYTEMP"
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
end
-Karin
Am 18.12.17 um 16:51 schrieb Arka Banerjee:
> You told me Adam was right.
> I also follow the steps if you have seen my script.
> At the end there will be end but script is nt running
>
> On Dec 18, 2017 9:17 PM, "Arka Banerjee" <arka354deb at gmail.com
> <mailto:arka354deb at gmail.com>> wrote:
>
> Seen already.
> But not helpful.
>
> On Dec 18, 2017 9:15 PM, "Karin Meier-Fleischer"
> <meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
>
> Have you seen the example
> https://www.ncl.ucar.edu/Applications/Scripts/grads_2.ncl
> <https://www.ncl.ucar.edu/Applications/Scripts/grads_2.ncl>
>
> The script reads the same simple GrADS file in *Example 1* but
> creates a netCDF file and plots the data. The creation of
> netCDF necessitates the creation of coordinate variables and
> other information.
>
> -Karin
>
> Am 18.12.17 um 16:40 schrieb Karin Meier-Fleischer:
>> Hi Arka,
>>
>> please, don't send the same question again by changing the
>> subject! And always reply to the ncl-talk mailing list.
>>
>> If you don't have the CDOs available, hopefully you have Ruby
>> installed. See
>> https://www.ncl.ucar.edu/Applications/grads.shtml#ruby
>> <https://www.ncl.ucar.edu/Applications/grads.shtml#ruby>
>>
>> The hardest way would be to write a program e.g. Fortran to
>> read the GrADS binary and write netCDF using the netCDF library.
>>
>> Maybe you should install CDO, see
>> https://code.mpimet.mpg.de/projects/cdo/wiki#Installation-and-Supported-Platforms
>> <https://code.mpimet.mpg.de/projects/cdo/wiki#Installation-and-Supported-Platforms>
>>
>> -Karin
>>
>> Am 18.12.17 um 07:28 schrieb Arka Banerjee:
>>> Hi,
>>>
>>> I’d like to convert data from .grd files to netcdf files
>>> using a CTL file. If somebody has the solution for it
>>> please inform me.
>>>
>>>
>>> Thanks
>>>
>>> Arka
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171218/40e0e6c6/attachment.html>
More information about the ncl-talk
mailing list