SAGA API v9.10
Loading...
Searching...
No Matches
datetime.cpp File Reference
#include <time.h>
#include <wx/datetime.h>
#include "datetime.h"
#include "mat_tools.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ SG_Date_To_JulianDayNumber() [1/2]

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 756 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]

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 742 of file datetime.cpp.

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

◆ SG_Get_Day_Length() [1/2]

double SG_Get_Day_Length ( const CSG_DateTime & Date,
double Latitude )

Definition at line 990 of file datetime.cpp.

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

◆ SG_Get_Day_Length() [2/2]

double SG_Get_Day_Length ( int DayOfYear,
double Latitude )

Definition at line 976 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()

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 790 of file datetime.cpp.

◆ SG_Get_Sun_Position() [1/6]

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

Definition at line 872 of file datetime.cpp.

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

◆ SG_Get_Sun_Position() [2/6]

bool SG_Get_Sun_Position ( const CSG_DateTime & Time,
double Longitude,
double Latitude,
CSG_Vector & Position,
bool bRefraction )

◆ SG_Get_Sun_Position() [3/6]

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

Definition at line 922 of file datetime.cpp.

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

◆ SG_Get_Sun_Position() [4/6]

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 841 of file datetime.cpp.

References M_DEG_TO_RAD.

Referenced by SG_Get_Sun_Position(), SG_Get_Sun_Position(), SG_Get_Sun_Position(), SG_Get_Sun_Position(), and SG_Get_Sun_Position().

◆ SG_Get_Sun_Position() [5/6]

bool SG_Get_Sun_Position ( double JDN,
double Longitude,
double Latitude,
CSG_Vector & Position,
bool bRefraction )

Definition at line 928 of file datetime.cpp.

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

◆ SG_Get_Sun_Position() [6/6]

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 885 of file datetime.cpp.

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

◆ SG_Get_Sun_Refraction()

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 947 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]

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 712 of file datetime.cpp.

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

◆ SG_JulianDayNumber_To_Date() [2/3]

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

Expects 'Value' to be the Julian Day Number.

Definition at line 682 of file datetime.cpp.

References A, B, and C.

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

◆ SG_JulianDayNumber_To_Date() [3/3]

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 729 of file datetime.cpp.

References SG_JulianDayNumber_To_Date().