SAGA API  v9.7
datetime.h File Reference
#include "api_core.h"

Go to the source code of this file.

Classes

class  CSG_TimeSpan
 
class  CSG_DateTime
 

Functions

SAGA_API_DLL_EXPORT bool SG_JulianDayNumber_To_Date (double JDN, int &y, int &m, int &d)
 
SAGA_API_DLL_EXPORT CSG_String SG_JulianDayNumber_To_Date (double JDN)
 
SAGA_API_DLL_EXPORT CSG_String SG_JulianDayNumber_To_Date (int JDN)
 
SAGA_API_DLL_EXPORT double SG_Date_To_JulianDayNumber (int y, int m, int d)
 
SAGA_API_DLL_EXPORT double SG_Date_To_JulianDayNumber (const CSG_String &Date)
 
SAGA_API_DLL_EXPORT int SG_Get_Day_MidOfMonth (int Month, bool bLeapYear=false)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (double JulianDayNumber, double &RA, double &Dec)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (const CSG_DateTime &Time, double &RA, double &Dec)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (double JulianDayNumber, double Longitude, double Latitude, double &Height, double &Azimuth, bool bRefraction=false)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (const CSG_DateTime &Time, double Longitude, double Latitude, double &Height, double &Azimuth, bool bRefraction=false)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (double JulianDayNumber, double Longitude, double Latitude, class CSG_Vector &Position, bool bRefraction=false)
 
SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position (const CSG_DateTime &Time, double Longitude, double Latitude, class CSG_Vector &Position, bool bRefraction=false)
 
SAGA_API_DLL_EXPORT double SG_Get_Sun_Refraction (double Height, bool bRadians)
 
SAGA_API_DLL_EXPORT double SG_Get_Day_Length (int DayOfYear, double Latitude)
 
SAGA_API_DLL_EXPORT double SG_Get_Day_Length (const CSG_DateTime &Date, double Latitude)
 

Detailed Description

Simplified wrappers for wxDateTime and related classes including functions for the calculation of the Sun's position and the day length.

See also
CSG_DateTime
CSG_TimeSpan
SG_Get_Sun_Position
SG_Get_Day_Length

Definition in file datetime.h.

Function Documentation

◆ SG_Date_To_JulianDayNumber() [1/2]

SAGA_API_DLL_EXPORT double SG_Date_To_JulianDayNumber ( const CSG_String Date)

Returns the Julian Day Number for the requested date. Date string is best provided be given in ISO format (YYYY-MM-DD), or alternatively as YY-MM-DD or DD-MM-YYYY.

Definition at line 752 of file datetime.cpp.

References CSG_String::AfterFirst(), CSG_Strings::Get_Count(), CSG_String::Length(), SG_Date_To_JulianDayNumber(), and SG_String_Tokenize().

◆ SG_Date_To_JulianDayNumber() [2/2]

SAGA_API_DLL_EXPORT double SG_Date_To_JulianDayNumber ( int  Year,
int  Month,
int  Day 
)

Returns the Julian Day Number for the requested Gregorian date (year, month, day). Month should be in the range of 1 (= january) to 12 (= december), day in the range of 1 to 31.

Definition at line 738 of file datetime.cpp.

Referenced by CSG_Table_Value_Date::Set_Value(), and SG_Date_To_JulianDayNumber().

◆ SG_Get_Day_Length() [1/2]

SAGA_API_DLL_EXPORT double SG_Get_Day_Length ( const CSG_DateTime Date,
double  Latitude 
)

Definition at line 986 of file datetime.cpp.

References CSG_DateTime::Get_DayOfYear(), and SG_Get_Day_Length().

◆ SG_Get_Day_Length() [2/2]

SAGA_API_DLL_EXPORT double SG_Get_Day_Length ( int  DayOfYear,
double  Latitude 
)

Definition at line 972 of file datetime.cpp.

References M_DEG_TO_RAD, M_PI, and M_PI_360.

Referenced by SG_Get_Day_Length().

◆ SG_Get_Day_MidOfMonth()

SAGA_API_DLL_EXPORT int SG_Get_Day_MidOfMonth ( int  Month,
bool  bLeapYear 
)

Returns the day number (starting with zero for the first of January) for the mid of the requested month (January = 0).

Definition at line 786 of file datetime.cpp.

◆ SG_Get_Sun_Position() [1/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( const CSG_DateTime Time,
double &  RA,
double &  Dec 
)

Definition at line 868 of file datetime.cpp.

References CSG_DateTime::Get_JDN(), and SG_Get_Sun_Position().

◆ SG_Get_Sun_Position() [2/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( const CSG_DateTime Time,
double  Longitude,
double  Latitude,
class CSG_Vector Position,
bool  bRefraction = false 
)

◆ SG_Get_Sun_Position() [3/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( const CSG_DateTime Time,
double  Longitude,
double  Latitude,
double &  Height,
double &  Azimuth,
bool  bRefraction = false 
)

Definition at line 918 of file datetime.cpp.

References CSG_DateTime::Get_JDN(), and SG_Get_Sun_Position().

◆ SG_Get_Sun_Position() [4/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( double  JDN,
double &  RA,
double &  Dec 
)

Calculates the Sun's position for given date and time as declination and right ascension angles (radians). Solar coordinates according to Jean Meeus: Astronomical Algorithms, accuracy of 0.01 degree

Definition at line 837 of file datetime.cpp.

References M_DEG_TO_RAD.

Referenced by SG_Get_Sun_Position().

◆ SG_Get_Sun_Position() [5/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( double  JulianDayNumber,
double  Longitude,
double  Latitude,
class CSG_Vector Position,
bool  bRefraction = false 
)

Definition at line 924 of file datetime.cpp.

References CSG_Vector::Create(), and SG_Get_Sun_Position().

◆ SG_Get_Sun_Position() [6/6]

SAGA_API_DLL_EXPORT bool SG_Get_Sun_Position ( double  JDN,
double  Longitude,
double  Latitude,
double &  Height,
double &  Azimuth,
bool  bRefraction 
)

Calculates the Sun's position for given date and time and position on Earth as given by longitude and latitude (radians). Height and Azimuth are calculated as radians. Returns true if Sun is above horizon.

Definition at line 881 of file datetime.cpp.

References M_DEG_TO_RAD, SG_Get_Sun_Position(), and SG_Get_Sun_Refraction().

◆ SG_Get_Sun_Refraction()

SAGA_API_DLL_EXPORT double SG_Get_Sun_Refraction ( double  Height,
bool  bRadians 
)

Refraction correction for U.S. Standard Atmosphere. If bRadians is true input Height is expected to be given in radians and returned height will be in radians too.

Definition at line 943 of file datetime.cpp.

References M_DEG_TO_RAD, and M_RAD_TO_DEG.

Referenced by SG_Get_Sun_Position().

◆ SG_JulianDayNumber_To_Date() [1/3]

SAGA_API_DLL_EXPORT CSG_String SG_JulianDayNumber_To_Date ( double  JDN)

Calculates Gregorian date from Julian Day Number and returns it as ISO 8601 string (yyyy-mm-dd).

Definition at line 708 of file datetime.cpp.

References CSG_String::Printf(), and SG_JulianDayNumber_To_Date().

◆ SG_JulianDayNumber_To_Date() [2/3]

SAGA_API_DLL_EXPORT bool SG_JulianDayNumber_To_Date ( double  JDN,
int &  y,
int &  m,
int &  d 
)

Expects 'Value' to be the Julian Day Number.

Definition at line 678 of file datetime.cpp.

References A, B, and C.

Referenced by CSG_Table_Value_Date::Set_Value(), and SG_JulianDayNumber_To_Date().

◆ SG_JulianDayNumber_To_Date() [3/3]

SAGA_API_DLL_EXPORT CSG_String SG_JulianDayNumber_To_Date ( int  JDN)

Calculates Gregorian date from Julian Day Number and returns it as ISO 8601 string (yyyy-mm-dd).

Definition at line 725 of file datetime.cpp.

References SG_JulianDayNumber_To_Date().