16 static constexpr
int MISSING_INT = INT_MAX;
39 Date(
int ye,
int mo=1,
int da=1);
67 bool operator<(
const Date& dt)
const;
68 bool operator>(
const Date& dt)
const;
69 bool operator==(
const Date& dt)
const;
70 bool operator!=(
const Date& dt)
const;
73 static void validate(
int ye,
int mo,
int da);
79 static void julian_to_calendar(
int jday,
unsigned short& year,
unsigned char& month,
unsigned char& day);
104 Time(
int ho,
int mi=0,
int se=0);
126 bool operator<(
const Time& dt)
const;
127 bool operator>(
const Time& dt)
const;
128 bool operator==(
const Time& dt)
const;
129 bool operator!=(
const Time& dt)
const;
137 static void validate(
int ho,
int mi,
int se);
153 unsigned char minute;
154 unsigned char second;
166 Datetime(
int ye,
int mo=1,
int da=1,
int ho=0,
int mi=0,
int se=0);
175 static Datetime lower_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
181 static Datetime upper_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
204 bool operator==(
const Datetime& dt)
const;
205 bool operator!=(
const Datetime& dt)
const;
206 bool operator<(
const Datetime& dt)
const;
207 bool operator>(
const Datetime& dt)
const;
208 bool operator<=(
const Datetime& dt)
const;
209 bool operator>=(
const Datetime& dt)
const;
214 void print_iso8601(FILE* out,
char sep=
'T',
const char* end=
"\n")
const;
222 void to_stream_iso8601(std::ostream& out,
char sep=
'T',
const char* tz=
"")
const;
229 static Datetime from_iso8601(
const char* str);
239 static void validate(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
245 static void normalise_h24(
int& ye,
int& mo,
int& da,
int& ho,
int& mi,
int& se);
265 int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
266 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
289 void set(
int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
290 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
299 bool contains(
const Datetime& dt)
const;
336 Coords(
double lat,
double lon);
342 void set(
int lat,
int lon);
345 void set(
double lat,
double lon);
365 bool operator==(
const Coords& dt)
const;
366 bool operator!=(
const Coords& dt)
const;
367 bool operator<(
const Coords& dt)
const;
368 bool operator>(
const Coords& dt)
const;
369 bool operator<=(
const Coords& dt)
const;
370 bool operator>=(
const Coords& dt)
const;
373 void print(FILE* out,
const char* end=
"\n")
const;
393 static constexpr
int IMIN = -9000000;
395 static constexpr
int IMAX = 9000000;
397 static constexpr
double DMIN = -90.0;
399 static constexpr
double DMAX = 90.0;
413 bool operator==(
const LatRange& lr)
const;
414 bool operator!=(
const LatRange& lr)
const;
426 void get(
double& min,
double& max)
const;
429 void set(
int min,
int max);
432 void set(
double min,
double max);
435 bool contains(
int lat)
const;
438 bool contains(
double lat)
const;
441 bool contains(
const LatRange& lr)
const;
467 int imin = MISSING_INT;
469 int imax = MISSING_INT;
478 bool operator==(
const LonRange& lr)
const;
479 bool operator!=(
const LonRange& lr)
const;
495 void get(
double& min,
double& max)
const;
498 void set(
int min,
int max);
501 void set(
double min,
double max);
504 bool contains(
int lon)
const;
507 bool contains(
double lon)
const;
510 bool contains(
const LonRange& lr)
const;
526 Level(
int ltype1=MISSING_INT,
int l1=MISSING_INT,
int ltype2=MISSING_INT,
int l2=MISSING_INT)
527 : ltype1(ltype1), l1(l1), ltype2(ltype2), l2(l2) {}
532 bool operator==(
const Level& l)
const;
533 bool operator!=(
const Level& l)
const;
534 bool operator<(
const Level& l)
const;
535 bool operator>(
const Level& l)
const;
549 std::string describe()
const;
552 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
555 static Level cloud(
int ltype2=MISSING_INT,
int l2=MISSING_INT);
558 void print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
574 Trange(
int pind=MISSING_INT,
int p1=MISSING_INT,
int p2=MISSING_INT)
575 : pind(pind), p1(p1), p2(p2) {}
589 bool operator==(
const Trange& tr)
const;
590 bool operator!=(
const Trange& tr)
const;
591 bool operator<(
const Trange& t)
const;
592 bool operator>(
const Trange& t)
const;
597 std::string describe()
const;
600 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
606 void print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
int ltype1
Type of the level or the first layer. See Level type values.
Definition: types.h:518
int ltype2
Type of the the second layer. See Level type values.
Definition: types.h:522
int to_julian() const
Convert the date to Julian day.
int compare(const Date &other) const
Generic comparison.
static void validate(int ye, int mo, int da)
Raise an exception if the three values do not represent a valid date.
static void julian_to_calendar(int jday, unsigned short &year, unsigned char &month, unsigned char &day)
Convert a Julian day into a calendar date.
void to_stream_iso8601(std::ostream &out) const
Write the date to an output stream in ISO8601 date format.
Calendar date.
Definition: types.h:24
Coordinates.
Definition: types.h:320
int p1
Time range P1 indicator. See Time range values.
Definition: types.h:570
static int calendar_to_julian(int year, int month, int day)
Convert a calendar date into a Julian day.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:565
int pind
Time range type indicator. See Time range values.
Definition: types.h:568
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
static Date from_julian(int jday)
Create a date from a Julian day.
Vertical level or layer.
Definition: types.h:515
int l2
L2 value of the second layer. See Level type values.
Definition: types.h:524
Range of datetimes.
Definition: types.h:255
Datetime max
Upper bound of the range.
Definition: types.h:260
int lat
Latitude in 1/100000 of a degree (5 significant digits preserved)
Definition: types.h:323
Range of latitudes.
Definition: types.h:390
Time of the day.
Definition: types.h:89
Datetime min
Lower bound of the range.
Definition: types.h:258
int lon
Longitude in 1/100000 of a degree (5 significant digits preserved) and normalised between -180...
Definition: types.h:329
bool is_missing() const
Check if this date is the missing value.
Date and time.
Definition: types.h:147
Date()
Construct a missing date.
static int days_in_month(int year, int month)
Return the number of days in the given month.
Range of longitudes.
Definition: types.h:464
int l1
L1 value of the level or the first layer. See Level type values.
Definition: types.h:520
int p2
Time range P2 indicator. See Time range values.
Definition: types.h:572