File: netcdf-4.9.3.patch

package info (click to toggle)
minc-tools 2.3.00%2Bdfsg-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,716 kB
  • sloc: ansic: 65,674; perl: 7,423; yacc: 1,177; sh: 633; lex: 319; makefile: 224
file content (124 lines) | stat: -rw-r--r-- 5,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Description: Replace _FillValue by NC_FillValue for NetCDF 4.9.3.
Author: Bas Couwenberg <sebastic@debian.org>

--- a/progs/mincgen/ncgentab.y
+++ b/progs/mincgen/ncgentab.y
@@ -14,6 +14,10 @@
 #include        "ncgen.h"
 #include	"genlib.h"	/* for grow_darray() et al */
 
+#if defined(_FillValue) && !defined(NC_FillValue)
+#define NC_FillValue _FillValue
+#endif
+
 YYSTYPE symlist;		/* symbol table: linked list */
 
 extern int derror_count;	/* counts errors in netcdf definition */
@@ -68,7 +72,7 @@ static void *rec_start;		/* start of spa
 	NETCDF      /* keyword declaring netcdf name */
         HDF5        /* keyword declaring hdf5 name */
 	DATA        /* keyword starting data section, if any */
-        FILLVALUE   /* fill value, from _FillValue attribute or default */
+        FILLVALUE   /* fill value, from NC_FillValue attribute or default */
 
 %start	ncdesc /* start symbol for grammar */
 
@@ -204,7 +208,7 @@ varspec:        var
 		    vars[nvars].lname = decodify($1->name);
 		    vars[nvars].type = type_code;
 		    /* set default fill value.  You can override this with
-		     * the variable attribute "_FillValue". */
+		     * the variable attribute "NC_FillValue". */
 		    nc_getfill(type_code, &vars[nvars].fill_value);
 		    vars[nvars].has_data = 0; /* has no data (yet) */
 		   }
@@ -275,14 +279,14 @@ attdecl:        att
 		       /* shrink space down to what was really needed */
 		       att_space = erealloc(att_space, valnum*nctypesize(valtype));
 		       atts[natts].val = att_space;
-		       if (STREQ(atts[natts].name, _FillValue) &&
+		       if (STREQ(atts[natts].name, NC_FillValue) &&
 			   atts[natts].var != NC_GLOBAL) {
 			   nc_putfill(atts[natts].type,
 				       atts[natts].val,
 				       &vars[atts[natts].var].fill_value);
 			   if(atts[natts].type != vars[atts[natts].var].type) {
 			       derror("variable %s: %s type mismatch",
-				      vars[atts[natts].var].name, _FillValue);
+				      vars[atts[natts].var].name, NC_FillValue);
 			   }
 		       }
 		       natts++;
--- a/progs/mincdump/mincdump.c
+++ b/progs/mincdump/mincdump.c
@@ -19,6 +19,10 @@
 #include "dumplib.h"
 #include "vardata.h"
 
+#if defined(_FillValue) && !defined(NC_FillValue)
+#define NC_FillValue _FillValue
+#endif
+
 static void usage(void);
 static char* name_path(const char* path);
 static char* type_name(nc_type  type);
@@ -475,20 +479,20 @@ do_ncdump(char *path, struct fspec* spec
 		  vdims[id] = dims[var.dims[id]].size;
 		var.has_fillval = 1; /* by default, but turn off for bytes */
 
-		/* get _FillValue attribute */
+		/* get NC_FillValue attribute */
                 old_nc_opts = ncopts;
                 ncopts = 0;
-                nc_status = ncattinq(ncid,varid,_FillValue,&att.type,&att.len);
+                nc_status = ncattinq(ncid,varid,NC_FillValue,&att.type,&att.len);
                 ncopts = old_nc_opts;
 		if(nc_status == NC_NOERR &&
 		   att.type == var.type && att.len == 1) {
 		    if(var.type == NC_CHAR) {
 			char fillc;
-			ncattget(ncid, varid, _FillValue, &fillc );
+			ncattget(ncid, varid, NC_FillValue, &fillc );
 			var.fillval = fillc;
 		    } 
                     else {
-			ncattget(ncid, varid, _FillValue, &var.fillval);
+			ncattget(ncid, varid, NC_FillValue, &var.fillval);
 		    }
 		} else {
 		    switch (var.type) {
--- a/progs/mincdump/mincdump.man1
+++ b/progs/mincdump/mincdump.man1
@@ -52,8 +52,8 @@ and shapes; attribute names and values;
 data for all variables or selected variables in a netCDF file.
 .LP
 \fBmincdump\fP uses `_' to represent data values that are equal to the
-`_FillValue' attribute for a variable, intended to represent data that
-has not yet been written.  If a variable has no `_FillValue' attribute, the
+`NC_FillValue' attribute for a variable, intended to represent data that
+has not yet been written.  If a variable has no `NC_FillValue' attribute, the
 default fill value for the variable type is used if the variable is not of
 byte type.
 .SH OPTIONS
--- a/progs/mincgen/mincgen.man1
+++ b/progs/mincgen/mincgen.man1
@@ -167,7 +167,7 @@ arrays, the last dimension varies fastes
 column order is used for matrices.  If fewer values are supplied than
 are needed to fill a variable, it is extended with a type-dependent
 `fill value', which can be overridden by supplying a value for a
-distinguished variable attribute named `_FillValue'.  The
+distinguished variable attribute named `NC_FillValue'.  The
 types of constants need not match the type declared for a variable;
 coercions are done to convert integers to floating point, for example.
 The constant `_' can be used to designate the fill value for a variable.
--- a/progs/mincgen/ncgen.h
+++ b/progs/mincgen/ncgen.h
@@ -39,7 +39,7 @@ extern struct vars {
     nc_type type;
     int ndims;
     int *dims;			/* array of dimension ids */
-    union generic fill_value;	/* set to value of _FillValue attribute */
+    union generic fill_value;	/* set to value of NC_FillValue attribute */
     int has_data;		/* 1 if data specified, 0 otherwise */
     size_t nrecs;		/* for record variables, number of records
 				 * of data in CDL */