s2d2.unit_conversion
Module Contents
Functions
|
Convert array of datetime64 to a day of year. |
|
given day of years, calculate the day and month |
Convert array of datetime64 to a calendar year, month, day. |
|
some write a date as a number "YYYYMMDD" conver this to numpy.datetime |
|
|
convert numpy.datetime to a date as a number "YYYYMMDD" |
|
convert decimal degrees to degree minutes seconds format |
|
convert degree minutes seconds format to decimal degrees |
|
adjust angle to be in bounds of a positive argument angle,like a compass |
|
adjust angle to be in bounds of an argument angle |
- s2d2.unit_conversion.datetime2doy(dt)[source]
Convert array of datetime64 to a day of year.
- Parameters:
dt (np.datetime64) – times of interest
- Returns:
year (integer, {x ∈ ℕ}) – calender year
doy (integer, {x ∈ ℕ}) – day of year
- s2d2.unit_conversion.doy2dmy(doy, year)[source]
given day of years, calculate the day and month
- Parameters:
year (integer, {x ∈ ℕ}) – calender year
doy (integer, {x ∈ ℕ}) – day of year
- Return type:
day, month, year
- s2d2.unit_conversion.datetime2calender(dt)[source]
Convert array of datetime64 to a calendar year, month, day.
- Parameters:
dt (np.datetime64) – times of interest
- Returns:
cal – calendar array with last axis representing year, month, day
- Return type:
numpy array
- s2d2.unit_conversion.datenum2datetime(t)[source]
some write a date as a number “YYYYMMDD” conver this to numpy.datetime
- Parameters:
t ({int,numpy.array}) – time, in format YYYYMMD
- Returns:
dt – times in numpy time format
- Return type:
{numpy.datetime64, numpy.array}, type=numpy.datetime64[D]
See also
- s2d2.unit_conversion.datetime2datenum(dt)[source]
convert numpy.datetime to a date as a number “YYYYMMDD”
- Parameters:
dt ({numpy.datetime64, numpy.array}, type=numpy.datetime64[D]) – times in numpy time format
- Returns:
t – time, in format YYYYMMD
- Return type:
{int, numpy.array}
See also
- s2d2.unit_conversion.deg2dms(ang)[source]
convert decimal degrees to degree minutes seconds format
- Parameters:
ang ({float,np.array}, unit=decimal degrees) – angle(s) of interest
- Returns:
deg ({integer,np.array}) – degrees
min ({integer,np.array}, range=0…60) – angular minutes
sec ({float,np.array}, range=0…60) – angular seconds
- s2d2.unit_conversion.dms2deg(deg, min, sec)[source]
convert degree minutes seconds format to decimal degrees
- Parameters:
deg ({integer,np.array}) – degrees
min ({integer,np.array}, range=0...60) – angular minutes
sec ({float,np.array}, range=0...60) – angular seconds
- Returns:
ang – angle(s) of interest
- Return type:
{float,np.array}, unit=decimal degrees
- s2d2.unit_conversion.deg2compass(θ)[source]
adjust angle to be in bounds of a positive argument angle,like a compass
- Parameters:
θ (unit=degrees) –
- Returns:
θ
- Return type:
unit=degrees, range=0…+360
See also
Notes
The angle is declared in the following coordinate frame:
^ North & y | - <--|--> + | +----> East & x