[ncl-talk] problem with ncl_filedump *.nc ?
Karl-Hermann Wieners
karl-hermann.wieners at mpimet.mpg.de
Thu Sep 20 02:48:18 MDT 2018
On 09/19/2018 02:12 PM, Dylan White wrote:
> In a file called "ncl_filedump.ncl", I have written the line-
> print(addfile(filePath,"r"))
> Then, in a file called "ncl_filedump.csh", I have written the line -
> ncl filePath=\"$1\" ncl_filedump.ncl
> And in my "~/.bashrc" file, I have added the line - alias
> ncl_filedump="csh /path/to/ncl_filedump.csh"
Just as an aside (nothing to to with the problem, but with the work-around)
We've done several of those "executable NCL scripts" using a general
wrapper to ncl that allows to use ncl the same way as any other script
language, passing --option=value as an NCL variable "option" and
positional parameters as an "ARGS" array. Our wrapper is called nclsh
and uses perl (see gzipped attachment) - there might be other ways to do it.
With that unpacked into a directory, say, /your/home/bin, you would
write "ncl_filedump.ncl" simply as
print(addfile(ARGS(0),"r"))
and define your alias like
alias ncl_filedump="/your/home/bin/nclsh /path/to/ncl_filedump.ncl"
Alternatively, you could write a "/your/home/bin/ncl_filedump" as
#! /your/home/bin/nclsh
print(addfile(ARGS(0),"r"))
make that an executable script (chmod +x) and - for bash - do
PATH=/your/home/bin:$PATH
Best,
Karl
--
Karl-Hermann Wieners
Max-Planck-Institut für Meteorologie
Bundesstraße 53
20146 Hamburg
Germany
phone: +49 40 41173 161
email: karl-hermann.wieners at mpimet.mpg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nclsh.gz
Type: application/gzip
Size: 3609 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180920/73e714aa/attachment.gz>
More information about the ncl-talk
mailing list