[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: perl script fix.



Bill,

>Date: Wed, 21 Jul 1999 13:19:50 GMT
>From: "William C. Mattison" <address@hidden>
>Organization: NOAA/NWS
>To: address@hidden
>Subject: perl script fix.
>Keywords: 199907191509.JAA17058

In the above message, you wrote:

> Well, I f-i-n-a-l-l-y got it to work.
> 
> I had a lot of trouble getting the varget to work.  The variable I was trying
> to "varget" kept coming back empty.  This was because I was anticipating a
> 3-dimensional variable later in the data file, and so made the "start" and
> "count" arrays size 3, and put zeros in the third element of each array.

If you specify zero for the number of elements to retrieve along any
dimension, then you'll always get nothing---regardless of the shape of
the data.

> I eventually got lucky by taking a shot in the dark, and eliminating
> the third element of each array altogether.  Only then did the script
> finally work.  In C and C++, oversized arrays would not have hurt in
> this situation.

With a zero specification in them, they wouldn't have helped either.

> I'm glad you forewarned me about how netCDF string variables are handled in
> perl.  Without the code fragment you provided, I'd never have gotten the
> script to work.  I'm an experienced C programmer, but I've been doing perl
> for less than a week.  In C, an array of characters *is* a string; so perl's
> inability to treat an array of characters as a string was unexpected, and not
> something I would have thought of.

Yeah.  It's a bit of a pain.  I'll see if I can work up a Perl function
and make it available.

> Thank-you for your help.

You're welcome.

> I do not know who maintains the netCDFPerl man page.

Me.

> Could you please pass
> the following on to who ever that is...
> 
> 1. The man page for netCDFPerl in the netCDF web site claims "netCDFPerl is
>    a port of the netcdf(3) package", but the description text and examples
>    use netCDF version 2 APIs.  I also found in my work that netCDF(3) APIs
>    were not recognized.

The "(3)" in the specification "netcdf(3)" refers to chapter 3 of the
Unix manual and not to version 3.0 of the netCDF package.  Chapter 3
is where libraries are documented.  To old Unix hackers like myself,
this is very useful information.  In these days of MS/Windows and
on-line hypertext help, however, it might now cause more confusion than
understanding.  I'll see what I can do.

> 2. The man page for netCDFPerl should forewarn readers of those situations
>    (calls) where arrays cannot be oversized.

Please retry your call with 1's for the size of the implicit dimension
first and get back to me on this if it still fails.

> 3. The other thing netCDFPerl users ought to be warned about is getting
>    variables with string values.  A sample script fragment should be
>    provided showing the reader how to do it.

I'll see about that function I mentioned.

> I'm currently working on a programming manual to be delivered to all the
> National Weather Service field offices as a part of AWIPS.  One of my
> responsibilities in this manual is to tell forecasters and SOOs about those
> aspects of using tools such as netCDFPerl that are specific to the AWIPS
> environment, such as the "#!" line at the top of a perl script.  But this
> manual does not serve as a reference manual or user's guide for the tools
> provided to the WFOs.  This manual refers forecasters and SOOs to manuals
> and web sites produced by the tool makers.  So I need for the netCDFPerl man
> page to warn of tricky things such as 2 and 3 above.

We appreciate feedback on things like this.  It helps us improve our
offerings.

> 
> Bill.

--------
Steve Emmerson   <http://www.unidata.ucar.edu>