17 static constexpr
int MISSING_INT = INT_MAX;
40 Date(
int ye,
int mo=1,
int da=1);
73 bool operator<(
const Date& dt)
const;
74 bool operator>(
const Date& dt)
const;
75 bool operator==(
const Date& dt)
const;
76 bool operator!=(
const Date& dt)
const;
79 static void validate(
int ye,
int mo,
int da);
85 static void julian_to_calendar(
int jday,
unsigned short& year,
unsigned char& month,
unsigned char& day);
110 Time(
int ho,
int mi=0,
int se=0);
137 bool operator<(
const Time& dt)
const;
138 bool operator>(
const Time& dt)
const;
139 bool operator==(
const Time& dt)
const;
140 bool operator!=(
const Time& dt)
const;
148 static void validate(
int ho,
int mi,
int se);
164 unsigned char minute;
165 unsigned char second;
177 Datetime(
int ye,
int mo=1,
int da=1,
int ho=0,
int mi=0,
int se=0);
186 static Datetime lower_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
192 static Datetime upper_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
215 bool operator==(
const Datetime& dt)
const;
216 bool operator!=(
const Datetime& dt)
const;
217 bool operator<(
const Datetime& dt)
const;
218 bool operator>(
const Datetime& dt)
const;
219 bool operator<=(
const Datetime& dt)
const;
220 bool operator>=(
const Datetime& dt)
const;
225 int print_iso8601(FILE* out,
char sep=
'T',
const char* end=
"\n")
const;
234 void to_stream_iso8601(std::ostream& out,
char sep=
'T',
const char* tz=
"")
const;
246 static Datetime from_iso8601(
const char* str);
256 static void validate(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
262 static void normalise_h24(
int& ye,
int& mo,
int& da,
int& ho,
int& mi,
int& se);
282 int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
283 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
306 void set(
int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
307 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
316 bool contains(
const Datetime& dt)
const;
353 Coords(
double lat,
double lon);
359 void set(
int lat,
int lon);
362 void set(
double lat,
double lon);
382 bool operator==(
const Coords& dt)
const;
383 bool operator!=(
const Coords& dt)
const;
384 bool operator<(
const Coords& dt)
const;
385 bool operator>(
const Coords& dt)
const;
386 bool operator<=(
const Coords& dt)
const;
387 bool operator>=(
const Coords& dt)
const;
390 int print(FILE* out,
const char* end=
"\n")
const;
410 static constexpr
int IMIN = -9000000;
412 static constexpr
int IMAX = 9000000;
414 static constexpr
double DMIN = -90.0;
416 static constexpr
double DMAX = 90.0;
430 bool operator==(
const LatRange& lr)
const;
431 bool operator!=(
const LatRange& lr)
const;
443 void get(
double& min,
double& max)
const;
446 void set(
int min,
int max);
449 void set(
double min,
double max);
452 bool contains(
int lat)
const;
455 bool contains(
double lat)
const;
458 bool contains(
const LatRange& lr)
const;
484 int imin = MISSING_INT;
486 int imax = MISSING_INT;
495 bool operator==(
const LonRange& lr)
const;
496 bool operator!=(
const LonRange& lr)
const;
512 void get(
double& min,
double& max)
const;
515 void set(
int min,
int max);
518 void set(
double min,
double max);
521 bool contains(
int lon)
const;
524 bool contains(
double lon)
const;
527 bool contains(
const LonRange& lr)
const;
543 Level(
int ltype1=MISSING_INT,
int l1=MISSING_INT,
int ltype2=MISSING_INT,
int l2=MISSING_INT)
544 : ltype1(ltype1), l1(l1), ltype2(ltype2), l2(l2) {}
549 bool operator==(
const Level& l)
const;
550 bool operator!=(
const Level& l)
const;
551 bool operator<(
const Level& l)
const;
552 bool operator>(
const Level& l)
const;
566 std::string describe()
const;
569 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
577 static Level cloud(
int ltype2=MISSING_INT,
int l2=MISSING_INT);
580 int print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
596 Trange(
int pind=MISSING_INT,
int p1=MISSING_INT,
int p2=MISSING_INT)
597 : pind(pind), p1(p1), p2(p2) {}
611 bool operator==(
const Trange& tr)
const;
612 bool operator!=(
const Trange& tr)
const;
613 bool operator<(
const Trange& t)
const;
614 bool operator>(
const Trange& t)
const;
619 std::string describe()
const;
622 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
633 int 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:535
int ltype2
Type of the the second layer. See Level type values.
Definition: types.h:539
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:25
Coordinates.
Definition: types.h:337
int p1
Time range P1 indicator.
Definition: types.h:592
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:587
int pind
Time range type indicator.
Definition: types.h:590
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:532
int l2
L2 value of the second layer. See Level type values.
Definition: types.h:541
void to_csv_iso8601(CSVWriter &out) const
Write the date as a CSV field in ISO8601 date format.
Range of datetimes.
Definition: types.h:272
Datetime max
Upper bound of the range.
Definition: types.h:277
int lat
Latitude in 1/100000 of a degree (5 significant digits preserved)
Definition: types.h:340
Range of latitudes.
Definition: types.h:407
Time of the day.
Definition: types.h:95
Datetime min
Lower bound of the range.
Definition: types.h:275
int lon
Longitude in 1/100000 of a degree (5 significant digits preserved) and normalised between -180...
Definition: types.h:346
bool is_missing() const
Check if this date is the missing value.
Date and time.
Definition: types.h:158
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:481
int l1
L1 value of the level or the first layer. See Level type values.
Definition: types.h:537
int p2
Time range P2 indicator.
Definition: types.h:594