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

950629: NetCDF:: Perl API



David,

> Subject: NetCDF:: Perl API
> To:       address@hidden
> From: "David E. Wilensky" <address@hidden>
> Organization: Louisiana State University
> Keywords: 199506291400.AA25907

In the above message you wrote:

> First of all thanks a GAJILLION for building the NetCDF::perl stuff.  It is a
> real boon.  I appreciate all the time you folks spend building stuff like it.

You're most welcome.
 
> Now on to the problem...  I am getting some strange results using
> NetCDF::varput1; specifically erroneous values in the cdf.  I like to start
> with thinking I am doing something dumb, so maybe you can help me out of my
> brain-lock.

> 1) Environment, Sun 4/690, SunOS 4.1.3, netcdf 2.3.2, perl 5.001, NetCDF::
> 1.0.2
>    built with Sun cc, perl was built with the Dynaloader.
> 
> 2) The perl script
> 
> #!/mnt/local/bin/perl -w
> 
> use NetCDF;
> 
> @start = (0,0,0);
> $in = 20;
> $out = 0;
> 
>   $ncid=NetCDF::open("test.cdf",RDWR);
> 
>   $varid=NetCDF::varid($ncid,"TMax");
> 
>   $stats = NetCDF::varput1($ncid,$varid,\@start,$in);
>   $stats = NetCDF::varget1($ncid,$varid,\@start,$out);
> 
>   printf("In Value: %s  netCDF Value: %s\n",$in,$out);
> 
>   NetCDF::close($ncid);
> 
> 
> 3) The cdl used for this test, ncgen was used to prebuilt the empty cdf.
> 
> netcdf lais_daily {
> dimensions:
>         year = UNLIMITED ;
>         month = 12 ;
>         day = 31 ;
> 
> variables:
>         int TMax(year, month, day) ;
>                 TMax:long_name = "maximum temperature" ;
>                 TMax:units = "Celcius" ;
>                 TMax:_FillValue = -99 ;
> 
> // global attributes:
>                 :title = "Louisiana AgriClimatic Information System (LAIS)" ;
>                 :base_year = 1984s ;
> }
> 
> 
> 4) The run results.
> 
> In Value: 20  netCDF Value: 4
> 
> An ncdump of the result follows.  As you will see, the actual value in the cdf
> is INDEED 4, not 20.  It is interesting to note that using NetCDF::varput
> with both 'start' and 'count' works fine as does BOTH of varget1 and varget
> with their respective parameters.
> 
> uhhhh HELP???

You're code looks correct.  I can reproduce the problem, so I should
have a solution for you today.

--------
Steve Emmerson   <address@hidden>