NOAA-PMEL / Ferret

The Ferret program from NOAA/PMEL
https://ferret.pmel.noaa.gov/Ferret/
The Unlicense
55 stars 20 forks source link

On IA64: cannot parse "units since date" #730

Closed karlmsmith closed 6 years ago

karlmsmith commented 6 years ago

Reported by remik.ziemlinski on 11 Oct 2006 18:38 UTC Ferret 6.00 on IA64 has trouble parsing netcdf attributes, which previously worked on IRIX 6.5 with FERRET v5.70.

To reproduce the problem at GFDL:

ssh ic1
module load ferret-6.00
ferret
use "/net/rsz/users/bls/icferretbug/bug.nc"

==========================================
Transcript of error:
        NOAA/PMEL TMAP
        FERRET v6
        Linux(g77) 2.4.20 - 09/11/06
        11-Oct-06 14:35

yes? use "/net/rsz/users/bls/icferretbug/bug.nc"
 *** NOTE: Units on axis "nv" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: m: "unitsSINCEsinceyyyymmddhhmmss -4713" in netCDF variable: zt
 Maximum characters:   48
 *** NOTE: cannot parse "units since date", date= "yyyymmddhhmmss -4713" in
netCDF variable: zt"; leaving units string
 *** NOTE: Units on axis "zt" are not recognized: m:
"unitsSINCEsinceyyyymmddhhmmss -4713" in netCDF
 *** NOTE: They will not be convertible:
 *** NOTE: Evenly spaced axis has edges definition: zt - ignored

Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/1455

karlmsmith commented 6 years ago

Comment by @AnsleyManke on 11 Oct 2006 19:04 UTC This occurs also on our linux systems, so I can work on it here and track down what's happening

karlmsmith commented 6 years ago

Comment by @AnsleyManke on 11 Oct 2006 20:11 UTC This seems to be an interaction with this particular file and perhaps this version of the netcdf/DODS library (does it happen with both the Altix netcdf and DODS executables?)

For some reason, the netcdf library routine nc_inq_att called by Ferret, is returning an incorrect string length for the units attribute of the variable zt. Its units are "m" but the nc call returns a string length of 128.

The buffers used to convert C strings to Fortran strings are not blanked out between calls, and so variable ZT gets this wierd string for its units "m: \unitsSINCEsinceyyyymmddhhmmss -4713DAY" which is resulting in the parsing error in the code that follows.

For robustness, Ferret can check the actual length of the attribute string after it's read from the netcdf file, and reset the attribute length to that length. (NCF_Util.c, routine ncf_add_dset). Also initialize hollerith buffers in tm_ftoc_strng.F and tm_ctof_strng.F

karlmsmith commented 6 years ago

Comment by remik.ziemlinski on 11 Oct 2006 20:39 UTC This error has been confirmed with GFDL's IA64 DODS and CDF2 builds of Ferret 6.00.

karlmsmith commented 6 years ago

Comment by @AnsleyManke on 16 Oct 2006 18:22 UTC This may be something nonstandard in the file, but a workaround is to compare the actual length of the attribute string after it's read, against the value of the returned value of "attlen", and if the string that has been is shorter than "attlen" use the actual length instead. This is in NC_Util.c, routine ncf_add_dset

karlmsmith commented 6 years ago

Attachment from remik.ziemlinski on 11 Oct 2006 18:40 UTC Opening this file results in the errors. bug.nc.zip