Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
de3c8b2f
Commit
de3c8b2f
authored
Sep 09, 2015
by
Uwe Schulzweida
Browse files
added env. CDI_VERSION_INFO; set to 0 to disable netCDF global attribute CDI
parent
0c825dfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cdf.c
View file @
de3c8b2f
...
...
@@ -83,7 +83,6 @@ void cdfComment(int ncid)
}
cdf_put_att_text
(
ncid
,
NC_GLOBAL
,
"CDI"
,
strlen
(
comment
),
comment
);
cdf_put_att_text
(
ncid
,
NC_GLOBAL
,
"Conventions"
,
6
,
"CF-1.4"
);
}
#endif
...
...
@@ -95,6 +94,7 @@ int cdfOpenFile(const char *filename, const char *mode, int *filetype)
int
writemode
=
NC_CLOBBER
;
int
readmode
=
NC_NOWRITE
;
int
status
;
extern
int
CDI_Version_Info
;
if
(
filename
==
NULL
)
ncid
=
CDI_EINVAL
;
...
...
@@ -126,7 +126,8 @@ int cdfOpenFile(const char *filename, const char *mode, int *filetype)
else
if
(
*
filetype
==
FILETYPE_NC4C
)
writemode
|=
NC_NETCDF4
|
NC_CLASSIC_MODEL
;
#endif
cdf_create
(
filename
,
writemode
,
&
ncid
);
cdfComment
(
ncid
);
if
(
CDI_Version_Info
)
cdfComment
(
ncid
);
cdf_put_att_text
(
ncid
,
NC_GLOBAL
,
"Conventions"
,
6
,
"CF-1.4"
);
break
;
case
'a'
:
cdf_open
(
filename
,
NC_WRITE
,
&
ncid
);
...
...
src/cdi_int.c
View file @
de3c8b2f
...
...
@@ -38,6 +38,7 @@ int cdiIgnoreValidRange = FALSE;
int
cdiSkipRecords
=
0
;
int
cdiConvention
=
CDI_CONVENTION_ECHAM
;
int
cdiInventoryMode
=
1
;
int
CDI_Version_Info
=
1
;
size_t
CDI_netcdf_hdr_pad
=
0UL
;
char
*
cdiPartabPath
=
NULL
;
...
...
@@ -273,7 +274,7 @@ void cdiSetChunk(const char *chunkAlgo)
void
cdiInitialize
(
void
)
{
static
int
Init_CDI
=
FALSE
;
char
*
env
S
tr
ing
;
char
*
env
s
tr
;
long
value
;
if
(
!
Init_CDI
)
...
...
@@ -309,38 +310,38 @@ void cdiInitialize(void)
value
=
cdiGetenvInt
(
"CDI_NETCDF_HDR_PAD"
);
if
(
value
>=
0
)
CDI_netcdf_hdr_pad
=
(
size_t
)
value
;
env
S
tr
ing
=
getenv
(
"CDI_MISSVAL"
);
if
(
env
S
tr
ing
)
cdiDefaultMissval
=
atof
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"CDI_MISSVAL"
);
if
(
env
s
tr
)
cdiDefaultMissval
=
atof
(
env
s
tr
);
/*
env
S
tr
ing
= getenv("NC_MISSING_VALUE");
if ( env
S
tr
ing
) cdiNcMissingValue = atoi(env
S
tr
ing
);
env
s
tr = getenv("NC_MISSING_VALUE");
if ( env
s
tr ) cdiNcMissingValue = atoi(env
s
tr);
*/
env
S
tr
ing
=
getenv
(
"NC_CHUNKSIZEHINT"
);
if
(
env
S
tr
ing
)
cdiNcChunksizehint
=
atoi
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"NC_CHUNKSIZEHINT"
);
if
(
env
s
tr
)
cdiNcChunksizehint
=
atoi
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"CDI_CHUNK_ALGO"
);
if
(
env
S
tr
ing
)
cdiSetChunk
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"CDI_CHUNK_ALGO"
);
if
(
env
s
tr
)
cdiSetChunk
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"SPLIT_LTYPE_105"
);
if
(
env
S
tr
ing
)
cdiSplitLtype105
=
atoi
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"SPLIT_LTYPE_105"
);
if
(
env
s
tr
)
cdiSplitLtype105
=
atoi
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"IGNORE_ATT_COORDINATES"
);
if
(
env
S
tr
ing
)
cdiIgnoreAttCoordinates
=
atoi
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"IGNORE_ATT_COORDINATES"
);
if
(
env
s
tr
)
cdiIgnoreAttCoordinates
=
atoi
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"IGNORE_VALID_RANGE"
);
if
(
env
S
tr
ing
)
cdiIgnoreValidRange
=
atoi
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"IGNORE_VALID_RANGE"
);
if
(
env
s
tr
)
cdiIgnoreValidRange
=
atoi
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"CDI_SKIP_RECORDS"
);
if
(
env
S
tr
ing
)
env
s
tr
=
getenv
(
"CDI_SKIP_RECORDS"
);
if
(
env
s
tr
)
{
cdiSkipRecords
=
atoi
(
env
S
tr
ing
);
cdiSkipRecords
=
atoi
(
env
s
tr
);
cdiSkipRecords
=
cdiSkipRecords
>
0
?
cdiSkipRecords
:
0
;
}
env
S
tr
ing
=
getenv
(
"CDI_CONVENTION"
);
if
(
env
S
tr
ing
)
env
s
tr
=
getenv
(
"CDI_CONVENTION"
);
if
(
env
s
tr
)
{
if
(
strcmp
(
env
S
tr
ing
,
"CF"
)
==
0
||
strcmp
(
env
S
tr
ing
,
"cf"
)
==
0
)
if
(
strcmp
(
env
s
tr
,
"CF"
)
==
0
||
strcmp
(
env
s
tr
,
"cf"
)
==
0
)
{
cdiConvention
=
CDI_CONVENTION_CF
;
if
(
CDI_Debug
)
...
...
@@ -348,10 +349,10 @@ void cdiInitialize(void)
}
}
env
S
tr
ing
=
getenv
(
"CDI_INVENTORY_MODE"
);
if
(
env
S
tr
ing
)
env
s
tr
=
getenv
(
"CDI_INVENTORY_MODE"
);
if
(
env
s
tr
)
{
if
(
strncmp
(
env
S
tr
ing
,
"time"
,
4
)
==
0
)
if
(
strncmp
(
env
s
tr
,
"time"
,
4
)
==
0
)
{
cdiInventoryMode
=
2
;
if
(
CDI_Debug
)
...
...
@@ -359,34 +360,47 @@ void cdiInitialize(void)
}
}
envString
=
getenv
(
"CDI_CALENDAR"
);
if
(
envString
)
envstr
=
getenv
(
"CDI_VERSION_INFO"
);
if
(
envstr
)
{
int
ival
=
atoi
(
envstr
);
if
(
ival
==
0
||
ival
==
1
)
{
CDI_Version_Info
=
ival
;
if
(
CDI_Debug
)
Message
(
"CDI_Version_Info = %s"
,
envstr
);
}
}
envstr
=
getenv
(
"CDI_CALENDAR"
);
if
(
envstr
)
{
if
(
strncmp
(
env
S
tr
ing
,
"standard"
,
8
)
==
0
)
if
(
strncmp
(
env
s
tr
,
"standard"
,
8
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_STANDARD
;
else
if
(
strncmp
(
env
S
tr
ing
,
"proleptic"
,
9
)
==
0
)
else
if
(
strncmp
(
env
s
tr
,
"proleptic"
,
9
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_PROLEPTIC
;
else
if
(
strncmp
(
env
S
tr
ing
,
"360days"
,
7
)
==
0
)
else
if
(
strncmp
(
env
s
tr
,
"360days"
,
7
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_360DAYS
;
else
if
(
strncmp
(
env
S
tr
ing
,
"365days"
,
7
)
==
0
)
else
if
(
strncmp
(
env
s
tr
,
"365days"
,
7
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_365DAYS
;
else
if
(
strncmp
(
env
S
tr
ing
,
"366days"
,
7
)
==
0
)
else
if
(
strncmp
(
env
s
tr
,
"366days"
,
7
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_366DAYS
;
else
if
(
strncmp
(
env
S
tr
ing
,
"none"
,
4
)
==
0
)
else
if
(
strncmp
(
env
s
tr
,
"none"
,
4
)
==
0
)
cdiDefaultCalendar
=
CALENDAR_NONE
;
if
(
CDI_Debug
)
Message
(
"Default calendar set to %s!"
,
env
S
tr
ing
);
Message
(
"Default calendar set to %s!"
,
env
s
tr
);
}
#if defined (HAVE_LIBCGRIBEX)
gribSetCalendar
(
cdiDefaultCalendar
);
#endif
env
S
tr
ing
=
getenv
(
"PARTAB_INTERN"
);
if
(
env
S
tr
ing
)
cdiPartabIntern
=
atoi
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"PARTAB_INTERN"
);
if
(
env
s
tr
)
cdiPartabIntern
=
atoi
(
env
s
tr
);
env
S
tr
ing
=
getenv
(
"PARTAB_PATH"
);
if
(
env
S
tr
ing
)
cdiPartabPath
=
strdup
(
env
S
tr
ing
);
env
s
tr
=
getenv
(
"PARTAB_PATH"
);
if
(
env
s
tr
)
cdiPartabPath
=
strdup
(
env
s
tr
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment