[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
970108: NCVGT returns all 0's on T90
- Subject: 970108: NCVGT returns all 0's on T90
- Date: Wed, 08 Jan 97 13:47:49 -0700
Hi John,
> cc: address@hidden (Joachin Dengg)
> From: address@hidden (John Sheldon)
> Subject: NCVGT returns all 0's on T90
> Organization: NOAA/GFDL
> Keywords: 199701081511.IAA16407 netCDF Cray
In the above message you wrote:
> We are trying to read some COADS netCDF cloudiness data on our Cray
> IEEE T90 ('uname -a' = sn7203 t90 9.1.0.1 gfd.8 CRAY TS") using netCDF
> 2.4.2. The dataset has 180 lon's, 90 lat's and 360 time's. (It can be
> obtained from ftp://ftp.cdc.noaa.gov/Datasets/coads1b.enh/cldc.mean.nc;
> the intro page is http://www.cdc.noaa.gov/cdc/data.coads1b.enh.html)
>
> If we try to read in the entire dataset with one NCVGT call, we get
> back all 0's and a return code of -1. None of the "possible causes"
> listed in the manual seem to apply. If we try to read in a more
> limited number of time-slices (say, 60), things work OK.
>
> By comparison, reading the dataset from our SGI's works just fine,
> regardless of how much we try to read.
>
> This may just be a Cray problem (surprise, surprise!), but maybe you
> can point me in the right direction.
>
> I'll paste in our quickie test code below.
>
> Thanks in advance for any help!
> John P. Sheldon
>
> (address@hidden)
> Geophysical Fluid Dynamics Laboratory/NOAA
> Princeton University/Forrestal Campus/Rte. 1
> P.O. Box 308
> Princeton, NJ, USA 08542
> (609) 987-5053
I suspect that you're tickling a bug in the FORTRAN interface of
the netCDF 2 library. An entire array of yours comprises 46656000
bytes (180*90*360*8-bytes). I suspect that a malloc() in the
file fortran/jackets.src is failing and that the FORTRAN-callable
interface routine isn't handling such errors the same way as the C
portion of the netCDF library (e.g. print an error message and
abort).
Though this is fixed in the next release of netCDF 2 (2.4.4), the next
version of netCDF 3 (which contains a FORTRAN interface) might be
released first.
I've enclosed a patch for the file fortran/jackets.src that should correct
the problem (i.e. it'll tell you why it failed). Please let me know if
it helps.
(Do we give good service or what! :-)
--Steve
--------Begin jackets.src patch
Index: jackets.src
===================================================================
RCS file: /upc/share/CVS/netcdf/fortran/jackets.src,v
retrieving revision 1.38
retrieving revision 1.40
diff -c -r1.38 -r1.40
*** 1.38 1996/02/27 23:01:47
--- 1.40 1996/12/17 17:08:17
***************
*** 2,8 ****
* Copyright 1990, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: jackets.src,v 1.38 1996/02/27 23:01:47 steve Exp $ */
%*
%* Meta-source for various versions of netCDF FORTRAN jacket library.
%*
--- 2,8 ----
* Copyright 1990, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: jackets.src,v 1.40 1996/12/17 17:08:17 steve Exp $ */
%*
%* Meta-source for various versions of netCDF FORTRAN jacket library.
%*
***************
*** 129,146 ****
}
! /* error handling function */
static void
! handle_err (pname, rcode)
char *pname; /* procedure name */
int rcode; /* error return */
{
extern char *cdf_routine_name; /* routine name in error messages */
cdf_routine_name = pname;
! NCadvise(rcode, "string won't fit in CHARACTER variable provided");
}
/* copy function used to copy strings with embedded blanks */
static void
fstrncpy (target, source, maxlen)
--- 129,157 ----
}
! /* general error handling function */
static void
! handle_err (pname, rcode, msg)
char *pname; /* procedure name */
int rcode; /* error return */
+ char *msg; /* message */
{
extern char *cdf_routine_name; /* routine name in error messages */
cdf_routine_name = pname;
! NCadvise(rcode, msg);
}
+
+ /* specific error handling function */
+ static void
+ handle_strerr (pname, rcode)
+ char *pname; /* procedure name */
+ int rcode; /* error return */
+ {
+ handle_err(pname, rcode, "string won't fit in CHARACTER variable
provided");
+ }
+
/* copy function used to copy strings with embedded blanks */
static void
fstrncpy (target, source, maxlen)
***************
*** 916,922 ****
*size = siz;
if ((int) strlen (name) > dimnamelen) {
*rcode = NC_ESTS;
! handle_err ("NCDINQ", *rcode);
return;
}
/* blank fill the input character string */
--- 927,933 ----
*size = siz;
if ((int) strlen (name) > dimnamelen) {
*rcode = NC_ESTS;
! handle_strerr ("NCDINQ", *rcode);
return;
}
/* blank fill the input character string */
***************
*** 967,973 ****
reverse (dimarray, *ndims);
if ((int) strlen (name) > varnamelen) {
*rcode = NC_ESTS;
! handle_err ("NCVINQ", *rcode);
return;
}
fcdcpy (varname, varnamelen, name);
--- 978,984 ----
reverse (dimarray, *ndims);
if ((int) strlen (name) > varnamelen) {
*rcode = NC_ESTS;
! handle_strerr ("NCVINQ", *rcode);
return;
}
fcdcpy (varname, varnamelen, name);
***************
*** 1104,1109 ****
--- 1115,1121 ----
char *bytes = itob (value, ncount, ndims);
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPT", *rcode, "couldn't allocate byte array")
return;
}
if (ncvarput (*ncid, *varid - 1, nstart, ncount,
***************
*** 1119,1124 ****
--- 1131,1137 ----
short *shorts = itos (value, ncount, ndims);
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPT", *rcode, "couldn't allocate short array")
return;
}
if (ncvarput (*ncid, *varid - 1, nstart, ncount,
***************
*** 1134,1139 ****
--- 1147,1153 ----
nclong *nclongs = itol (value, ncount, ndims);
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPT", *rcode, "couldn't allocate nclong array")
return;
}
if (ncvarput (*ncid, *varid - 1, nstart, ncount,
***************
*** 1149,1154 ****
--- 1163,1169 ----
float *floats = dtof (value, ncount, ndims);
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPT", *rcode, "couldn't allocate float array")
return;
}
if (ncvarput (*ncid, *varid - 1, nstart, ncount,
***************
*** 1193,1199 ****
revlongs (nstart, ndims);
if (dimprod(ncount,ndims) > *lenstr) {
*rcode = NC_ESTS;
! handle_err ("NCVPTC", *rcode);
return;
}
*rcode = 0;
--- 1208,1214 ----
revlongs (nstart, ndims);
if (dimprod(ncount,ndims) > *lenstr) {
*rcode = NC_ESTS;
! handle_strerr ("NCVPTC", *rcode);
return;
}
*rcode = 0;
***************
*** 1272,1277 ****
--- 1287,1293 ----
char *bytes = itobg (value, ncount, nbasis, ndims);
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPTG", *rcode, "couldn't allocate byte array")
return;
}
if (ncvarputg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1291,1296 ****
--- 1307,1313 ----
short *shorts = itosg (value, ncount, nbasis, ndims);
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPTG", *rcode, "couldn't allocate short array")
return;
}
if (ncvarputg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1306,1311 ****
--- 1323,1329 ----
nclong *nclongs = itolg (value, ncount, nbasis, ndims);
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPTG", *rcode, "couldn't allocate nclong array")
return;
}
if (ncvarputg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1321,1326 ****
--- 1339,1345 ----
float *floats = dtofg (value, ncount, nbasis, ndims);
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVPTG", *rcode, "couldn't allocate float array")
return;
}
if (ncvarputg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1542,1547 ****
--- 1561,1567 ----
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGT", *rcode, "couldn't allocate byte array")
return;
}
if (ncvarget (*ncid, *varid - 1, nstart, ncount,
***************
*** 1565,1570 ****
--- 1585,1591 ----
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGT", *rcode, "couldn't allocate short array")
return;
}
if (ncvarget (*ncid, *varid - 1, nstart, ncount,
***************
*** 1588,1593 ****
--- 1609,1615 ----
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGT", *rcode, "couldn't allocate nclong array")
return;
}
if (ncvarget (*ncid, *varid - 1, nstart, ncount,
***************
*** 1611,1616 ****
--- 1633,1639 ----
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGT", *rcode, "couldn't allocate float array")
return;
}
if (ncvarget (*ncid, *varid - 1, nstart, ncount,
***************
*** 1659,1665 ****
}
if (prod > *lenstr) {
*rcode = NC_ESTS;
! handle_err ("NCVGTC", *rcode);
return;
}
revlongs (ncount, ndims);
--- 1682,1688 ----
}
if (prod > *lenstr) {
*rcode = NC_ESTS;
! handle_strerr ("NCVGTC", *rcode);
return;
}
revlongs (ncount, ndims);
***************
*** 1744,1749 ****
--- 1767,1773 ----
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGTG", *rcode, "couldn't allocate byte array")
return;
}
if (ncvargetg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1770,1775 ****
--- 1794,1800 ----
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGTG", *rcode, "couldn't allocate short array")
return;
}
if (ncvargetg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1794,1799 ****
--- 1819,1825 ----
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGTG", *rcode, "couldn't allocate nclong array")
return;
}
if (ncvargetg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1814,1819 ****
--- 1840,1846 ----
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCVGTG", *rcode, "couldn't allocate float array")
return;
}
if (ncvargetg (*ncid, *varid - 1, nstart, ncount, nstride,
***************
*** 1926,1931 ****
--- 1953,1959 ----
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAPT", *rcode, "couldn't allocate byte array")
return;
}
if (ncattput (*ncid, *varid - 1, name, (nc_type) *datatype, *attlen,
***************
*** 1944,1949 ****
--- 1972,1978 ----
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAPT", *rcode, "couldn't allocate short array")
return;
}
if (ncattput (*ncid, *varid - 1, name, (nc_type) *datatype, *attlen,
***************
*** 1961,1966 ****
--- 1990,1996 ----
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAPT", *rcode, "couldn't allocate nclong array")
return;
}
if (ncattput (*ncid, *varid - 1, name, (nc_type) *datatype, *attlen,
***************
*** 1979,1984 ****
--- 2009,2015 ----
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAPT", *rcode, "couldn't allocate float array")
return;
}
if (ncattput (*ncid, *varid - 1, name, (nc_type) *datatype, *attlen,
***************
*** 2016,2022 ****
nstrncpy (name, attname, attnamelen);
if (((value = (char *)malloc ((unsigned) *lenstr + 1)) == NULL) ||
(*lenstr == 0)) {
*rcode = NC_ESTS;
! handle_err ("NCAPTC", *rcode);
return;
}
(void) fstrncpy (value, string, *lenstr);
--- 2047,2053 ----
nstrncpy (name, attname, attnamelen);
if (((value = (char *)malloc ((unsigned) *lenstr + 1)) == NULL) ||
(*lenstr == 0)) {
*rcode = NC_ESTS;
! handle_strerr ("NCAPTC", *rcode);
return;
}
(void) fstrncpy (value, string, *lenstr);
***************
*** 2083,2088 ****
--- 2114,2120 ----
if (bytes == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAGT", *rcode, "couldn't allocate byte array")
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) bytes) == -1) {
***************
*** 2104,2109 ****
--- 2136,2142 ----
if (shorts == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAGT", *rcode, "couldn't allocate short array")
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) shorts) == -1) {
***************
*** 2125,2130 ****
--- 2158,2164 ----
if (nclongs == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAGT", *rcode, "couldn't allocate nclong array")
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) nclongs) == -1) {
***************
*** 2146,2151 ****
--- 2180,2186 ----
if (floats == NULL) {
*rcode = NC_SYSERR;
+ handle_err("NCAGT", *rcode, "couldn't allocate float array")
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) floats) == -1) {
***************
*** 2191,2197 ****
}
if (attlen > *lenstr) {
*rcode = NC_ESTS;
! handle_err ("NCAGTC", *rcode);
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) string) == -1) {
--- 2226,2232 ----
}
if (attlen > *lenstr) {
*rcode = NC_ESTS;
! handle_strerr ("NCAGTC", *rcode);
return;
}
if (ncattget (*ncid, *varid - 1, name, (ncvoid *) string) == -1) {
***************
*** 2246,2252 ****
}
if ((int) strlen (name) > attnamelen) {
*rcode = NC_ESTS;
! handle_err ("NCANAM", *rcode);
return;
}
fcdcpy (attname, attnamelen, name);
--- 2281,2287 ----
}
if ((int) strlen (name) > attnamelen) {
*rcode = NC_ESTS;
! handle_strerr ("NCANAM", *rcode);
return;
}
fcdcpy (attname, attnamelen, name);