Re: error when converting GRB to NC

From: Rick Grubin <grubin_at_nyahnyahspammersnyahnyah>
Date: Wed, 26 Sep 2007 09:46:44 -0600

Hi Erik,

> I am getting this error when i try to convert a Grib file to
> NetCDF. I have not seen it before. How do I get around this?
>
> noble:/Volumes/Data_&_Models/FNL_SOP3_08_2006 enoble$ ls

Note that your directory name has the '&' character in it. The
ampersand has special meaning to a Unix shell: it has to
do with job control -- in particular, it allows the user to run a job
"in the background" -- that is, run the job but allow the
user to immediately continue using the shell, rather than waiting for
the job to complete.

> noble:/Volumes/Data_&_Models/FNL_SOP3_08_2006 enoble$
> ncl_convert2nc fnl_060807_00_00.grb

ncl_convert2nc determines some information about the environment in
which it runs by querying the shell for information.
Among this information collected is the current directory the command
is being run from [the default]. This information is
used to determine where output files will be written.

You can see more about this, as well as other defaults that
ncl_convert2nc uses, at:
     http://www.ncl.ucar.edu/Document/Tools/ncl_convert2nc.shtml

The '&' in your directory name /Volumes/Data_&_Models/
FNL_SOP3_08_2006 is interpreted by the shell as you wanting
your command to be run in the background. This is evident by the
text '[1] 19123' seen below:

> Processing file: fnl_060807_00_00.grb...
> [1] 19123

The shell has put your in the background, because ncl_convert2nc
invokes NCL with a number of arguments, one of which
is the output directory for netCDF files, and your output directory
contains a character that tells the shell to background the task.
When the shell backgrounds a task, it issues output that indicates
which job is backgrounded ('[1]') and what its process ID is
('19123').

Any text after the '&' -- which in your case is the remainder of your
current directory name -- is assumed by the shell to be
another command to execute. Thus you see:

> csh: _Models/FNL_SOP3_08_2006": Command not found.

which is obviously not a command. What does get passed to NCL to
execute is then an incomplete set of information needed
to properly execute. In particular, the output directory (denoted
internally to ncl_convert2nc as variable 'diro') is incomplete, and
ncl_convert2nc reports this.

> noble:/Volumes/Data_&_Models/FNL_SOP3_08_2006 enoble$ Copyright (C)
> 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.3.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> fatal:syntax error: line 5 in file /tmp/ncl19123.ncl before or near "
> diro="

The easiest solution to this problem is to rename your directory so
it does not contain the shell special character '&'.

-Rick.
----
Rick Grubin NCAR/TDD/CISL/VETS
Visualization + Enabling Technologies
grubin_at_ucar.edu 303.497.1832

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 26 2007 - 09:46:44 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 26 2007 - 10:02:41 MDT