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
2cfa0540
Commit
2cfa0540
authored
Feb 12, 2020
by
Uwe Schulzweida
Browse files
cfortran.h: define SXFortran.
parent
cfeaddd1
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
2cfa0540
2020-02-12 Uwe Schulzweida
* cfortran.h: define SXFortran [patch: Florian Prill]
* Preserve NetCDF attribute positive on data variables
2020-01-10 Uwe Schulzweida
...
...
src/cfortran.h
View file @
2cfa0540
...
...
@@ -236,6 +236,9 @@ only C calling FORTRAN subroutines will work using K&R style.*/
#if defined(_SX)
#define SXFortran
#endif
#if defined(__NEC__)
#define SXFortran
#endif
#if defined(mips) || defined(__mips)
#define mipsFortran
#endif
...
...
src/gribapi_utilities.c
View file @
2cfa0540
...
...
@@ -251,7 +251,7 @@ static int addToDate(struct tm* me, long long amount, long unit)
}
}
static
char
*
makeDateString
(
struct
tm
*
me
)
static
char
*
makeDateString
(
struct
tm
*
me
)
{
char
*
result
=
(
char
*
)
Malloc
(
4
+
1
+
2
+
1
+
2
+
1
+
2
+
1
+
2
+
1
+
2
+
4
+
1
);
sprintf
(
result
,
"%04d-%02d-%02dT%02d:%02d:%02d.000"
,
me
->
tm_year
+
1900
,
me
->
tm_mon
+
1
,
me
->
tm_mday
,
me
->
tm_hour
,
me
->
tm_min
,
me
->
tm_sec
);
...
...
@@ -290,40 +290,41 @@ static int getAvailabilityOfRelativeTimes(grib_handle* gh, bool* outHaveForecast
char
*
gribMakeTimeString
(
grib_handle
*
gh
,
CdiTimeType
timeType
)
{
//Get the parts of the reference date.
//
Get the parts of the reference date.
struct
tm
date
;
date
.
tm_mon
=
(
int
)
gribGetLong
(
gh
,
"month"
)
-
1
;
//months are zero based in struct tm and one based in GRIB
date
.
tm_mon
=
(
int
)
gribGetLong
(
gh
,
"month"
)
-
1
;
//
months are zero based in struct tm and one based in GRIB
date
.
tm_mday
=
(
int
)
gribGetLong
(
gh
,
"day"
);
date
.
tm_hour
=
(
int
)
gribGetLong
(
gh
,
"hour"
);
date
.
tm_min
=
(
int
)
gribGetLong
(
gh
,
"minute"
);
date
.
tm_isdst
=
0
;
if
(
gribEditionNumber
(
gh
)
==
1
)
{
date
.
tm_year
=
(
int
)
gribGetLong
(
gh
,
"yearOfCentury"
);
//years are -1900 based both in struct tm and GRIB1
date
.
tm_year
=
(
int
)
gribGetLong
(
gh
,
"yearOfCentury"
);
//
years are -1900 based both in struct tm and GRIB1
}
else
{
date
.
tm_year
=
(
int
)
gribGetLong
(
gh
,
"year"
)
-
1900
;
//years are -1900 based in struct tm and zero based in GRIB2
date
.
tm_year
=
(
int
)
gribGetLong
(
gh
,
"year"
)
-
1900
;
//
years are -1900 based in struct tm and zero based in GRIB2
date
.
tm_sec
=
(
int
)
gribGetLong
(
gh
,
"second"
);
//If the start or end time are requested, we need to take the relative times into account.
//
If the start or end time are requested, we need to take the relative times into account.
if
(
timeType
!=
kCdiTimeType_referenceTime
)
{
//Determine whether we have a forecast time and a time range.
//
Determine whether we have a forecast time and a time range.
bool
haveForecastTime
,
haveTimeRange
;
if
(
getAvailabilityOfRelativeTimes
(
gh
,
&
haveForecastTime
,
&
haveTimeRange
))
return
NULL
;
if
(
timeType
==
kCdiTimeType_endTime
&&
!
haveTimeRange
)
return
NULL
;
//tell the caller that the requested time does not exist
//If we have relative times, apply the relative times to the date
//
If we have relative times, apply the relative times to the date
if
(
haveForecastTime
)
{
long
offset
=
gribGetLongDefault
(
gh
,
"forecastTime"
,
0
);
//if(stepUnits == indicatorOfUnitOfTimeRange) assert(startStep == forecastTime)
long
offset
=
gribGetLongDefault
(
gh
,
"forecastTime"
,
0
);
//
if(stepUnits == indicatorOfUnitOfTimeRange) assert(startStep == forecastTime)
long
offsetUnit
=
gribGetLongDefault
(
gh
,
"indicatorOfUnitOfTimeRange"
,
255
);
if
(
addToDate
(
&
date
,
offset
,
offsetUnit
))
return
NULL
;
if
(
timeType
==
kCdiTimeType_endTime
)
{
assert
(
haveTimeRange
);
long
range
=
gribGetLongDefault
(
gh
,
"lengthOfTimeRange"
,
0
);
//if(stepUnits == indicatorOfUnitForTimeRange) assert(endStep == startStep + lengthOfTimeRange)
long
range
=
gribGetLongDefault
(
gh
,
"lengthOfTimeRange"
,
0
);
//
if(stepUnits == indicatorOfUnitForTimeRange) assert(endStep == startStep + lengthOfTimeRange)
long
rangeUnit
=
gribGetLongDefault
(
gh
,
"indicatorOfUnitForTimeRange"
,
255
);
if
(
addToDate
(
&
date
,
range
,
rangeUnit
))
return
NULL
;
}
...
...
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