Tides
gravtools.tides.abstract_tide_data
Abstract base class for tide data.
Copyright (C) 2023 Andreas Hellerschmied andreas.hellerschmied@bev.gv.at
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
AbstractTideData
Bases: ABC
Abstract base class for tidal data.
Source code in gravtools/tides/abstract_tide_data.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
endtime
abstractmethod
property
Returns the end time of the tidal timeseries.
endtime_str
property
Returns the end time of the tidal timeseries as string.
filename
abstractmethod
property
Returns the name of the data file.
filename_without_path
property
Returns the filename without path.
filetype
abstractmethod
property
Returns the type of the data file.
get_tide_corr_df
abstractmethod
property
Returns the complete tidal gravity time-series as pandas DataFrame
number_channels
abstractmethod
property
Returns the number of data channels.
number_records
abstractmethod
property
Returns the number of data records.
starttime
abstractmethod
property
Returns the start time of the tidal timeseries.
starttime_str
property
Returns the start time of the tidal timeseries as string.
get_channel_df(channel)
abstractmethod
Return the specified channel and the time reference (DateTime) as pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
str or int or last
|
If |
required |
Returns:
| Type | Description |
|---|---|
pandas.DataFrame containing the data records of the selected channel and the time reference as DateTime.
|
|
Source code in gravtools/tides/abstract_tide_data.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
gravtools.tides.tide_data_tfs
Class for TSF-formatted tidal data.
TSF Files are created e.g. by TSoft
Copyright (C) 2023 Andreas Hellerschmied andreas.hellerschmied@bev.gv.at
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
ChannelMetadata
dataclass
Class for channel metadata in TSF files.
Source code in gravtools/tides/tide_data_tfs.py
33 34 35 36 37 38 39 40 41 42 43 44 45 | |
channel_name
property
Returns the channels name as read from the TSF file
TSF
Bases: AbstractTideData
Class for tidal data loaded from TSF files.
TSF files are the native format for the TSoft which allows to calculate time-series of synthetic tide for a specific station defined by geographical coordinates and height.
TSoft: Download TSoft and its manual: http://seismologie.oma.be/en/downloads/tsoft Reference: Michel Van Camp, Paul Vauterin: Tsoft: graphical and interactive software for the analysis of time series and Earth tides. Comput. Geosci. 31(5): 631-640 (2005) DOI: https://doi.org/10.1016/j.cageo.2004.11.015
Attributes:
| Name | Type | Description |
|---|---|---|
_filename |
str
|
Path and name of the TSF file. |
tfs_format |
str
|
Format version of the TSF file (from block: [TSF-file]). Only version v01.0 is supported! |
timeformat |
str
|
Format of the time reference (from block: [TIMEFORMAT]). Has to be "DATETIME" or "DATETIMEFRAC"! |
undetval |
float
|
Determines which number is used to denote undetermined or unknown values in the [DATA] block (from block: [UNDETVAL]). |
increment |
float
|
Determines the time delay (in seconds) between two consecutive data points (from block: [INCREMENT]). |
channel_metadata |
list of ChannelMetadata objects
|
List of ChannelMetadata objects with one item per channel. Contains metadata such as location, instrument name, data type und unit. |
data_df |
DataFrame
|
Contains all columns from the [DATA] block. Additionally, the column |
countinfo |
(int, optiona(default=-1))
|
Specifies the number of data points in the file (from block: [COUNTINFO]). If this block is missing the in the TSF file the default value -1 is set. |
comment |
(str, optional(default=''))
|
Optional multiline comment (from block: [COMMENT]). |
Source code in gravtools/tides/tide_data_tfs.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
channel_names
property
Returns a list of the names of all data channels.
data_types
property
Returns a list of the data types of all stations.
endtime
property
Returns the end time of the tidal timeseries.
filename
property
Returns the name of the data file.
filename_without_path
property
Returns the TSF filename without path.
filetype
property
Returns the type of the data file.
get_tide_corr_df
property
Returns the complete tidal gravity time-series as pandas DataFrame
instruments
property
Returns a list of the instruments of all stations.
locations
property
Returns a list of the locations of all stations.
number_channels
property
Returns the number of data channels.
number_records
property
Returns the number of data records.
starttime
property
Returns the start time of the tidal timeseries.
units
property
Returns a list of the units of all stations.
__init__(filename, tfs_format, timeformat, undetval, increment, channel_metadata, data_df, countinfo=-1, comment='')
Default constructor.
Source code in gravtools/tides/tide_data_tfs.py
85 86 87 88 89 90 91 92 93 94 95 96 | |
from_tfs_file(filename)
classmethod
Create class instance from TSF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path and name of TSF file. |
required |
Returns:
| Type | Description |
|---|---|
Class instance
|
|
Source code in gravtools/tides/tide_data_tfs.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
get_channel_df(channel)
Return the specified channel and the time reference (DateTime) as pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
str or int or last
|
If |
required |
Returns:
| Type | Description |
|---|---|
pandas.DataFrame containing the data records of the selected channel and the time reference as DateTime.
|
|
Source code in gravtools/tides/tide_data_tfs.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
get_channel_np(channel)
Return the time reference and the data of the specified channel as numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
str or int or last
|
If |
required |
Returns:
| Type | Description |
|---|---|
numpy.array of reference epochs (DateTime), numpy.array of channel data.
|
|
Source code in gravtools/tides/tide_data_tfs.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
gravtools.tides.correction_time_series
Class for correction data provided as time series per station and survey.
Copyright (C) 2023 Andreas Hellerschmied andreas.hellerschmied@bev.gv.at
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
CorrectionTimeSeries
Class for correction data provided as time series per station and survey.
Attributes:
| Name | Type | Description |
|---|---|---|
surveys |
dict of `gravtools.tides.correction_time_series.SurveyCorrections`
|
Dict of |
Source code in gravtools/tides/correction_time_series.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
__init__()
Default initializer.
Source code in gravtools/tides/correction_time_series.py
42 43 44 | |
delete_survey_correction(survey_name)
Removes a survey correction object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
survey_name
|
Survey name. |
required |
Source code in gravtools/tides/correction_time_series.py
141 142 143 144 145 146 147 148 149 | |
load_tfs_file(survey_name, filename_tsf, location='', instrument='', data_type='', overwrite_channel=True, is_correction='False')
Load time series data from a TSoft TSF file for one survey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
survey_name
|
str
|
Name of the survey for which the data is loaded. |
required |
filename_tsf
|
str
|
Name and path of the TSF file from which the correction time series data is loaded. |
required |
location
|
str
|
If not empty, only channels with matching locations are loaded. |
''
|
instrument
|
str
|
If not empty, only channels with matching instruments are loaded. |
''
|
data_type
|
str
|
If not empty, only channels with matching data types are loaded. |
''
|
overwrite_channel
|
bool
|
|
True
|
is_correction
|
bool
|
|
'False'
|
Source code in gravtools/tides/correction_time_series.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
StationCorrections
dataclass
Correction time series data for one station.
Notes
For each station and correction type (e.g. tidal correction) only ONE time series can be added!
Source code in gravtools/tides/correction_time_series.py
309 310 311 312 313 314 315 316 317 318 | |
SurveyCorrections
dataclass
Correction time series data for one survey with multiple stations.
Source code in gravtools/tides/correction_time_series.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
number_of_stations
property
Returns the number of station correction objects.
station_names
property
Returns the names of all stations.
add_station_correction(station_name, station_correction, overwrite=True, warn=True)
Add a StationCorrection object to self.stations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_name
|
str
|
Station name. |
required |
station_correction
|
StationCorrections
|
StationCorrections object containing correction time series data for a specific station. |
required |
overwrite
|
bool
|
|
True
|
warn
|
bool
|
|
True
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
`True`, if the station correction data was added. Otherwise, `False`.
|
|
Source code in gravtools/tides/correction_time_series.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
delete_station_correction(station_name)
Removes a station correction object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_name
|
Station name. |
required |
Source code in gravtools/tides/correction_time_series.py
363 364 365 366 367 368 369 370 371 | |
TimeSeries
dataclass
Uniformly or irregularly sampled correction or effect time series for a single channel.
This dataclass stores a paired array of reference epochs and scalar values together with
metadata describing the source and physical meaning of the data. It is the lowest-level
building block used by :class:StationCorrections and :class:SurveyCorrections to hold,
e.g., tidal corrections or atmospheric loading effects that are later interpolated onto
individual gravity observations.
The sign convention follows the TSoft convention (see TSoft manual v2.2.4, p. 15):
- Correction (
is_correction=True): the value is added to the raw gravity observation (e.g. the tidal loading correction as exported by TSoft). - Effect (
is_correction=False): the value represents the gravitational effect of a phenomenon and must be subtracted from the observation to reduce it.
Attributes:
| Name | Type | Description |
|---|---|---|
ref_time_dt |
numpy.ndarray of datetime64
|
Reference epochs of the time series, in UTC. |
data |
numpy.ndarray of float
|
Scalar values associated with each epoch. Must have the same length as
|
unit |
str
|
Physical unit of |
data_source |
str
|
Human-readable identification of the data origin, e.g. the file name and file type from which the series was loaded. |
description |
(str, optional)
|
Short free-text label for the time series (e.g. the TSF channel name).
Defaults to |
is_correction |
(bool, optional)
|
|
created_utc_dt |
datetime
|
UTC timestamp set automatically in :meth: |
Source code in gravtools/tides/correction_time_series.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
created_datetime_utc
property
Returns the time and date (in UTC) when the times series was created as datetime object.
created_datetime_utc_str
property
Returns the time and date (in UTC) when the times series was created as string.
duration_dhms_str
property
Returns the duration as string (days, hours, minutes and seconds)
duration_timedelta64_ns
property
Returns the duration as numpy.timedelta64[ns] object.
end_datetime
property
Returns the end date and time.
end_datetime_str
property
Returns the end date and time as string.
model_type
property
Returns the model type, i.e. whether effects or corrections are modeled.
number_of_datapoints
property
Returns the number of datapoints.
ref_time_unix
property
Returns the reference times as UNIX timestamps (seconds since Jan 1, 1970).
start_datetime
property
Returns the start date and time.
start_datetime_str
property
Returns the start date and time as string.
__post_init__()
Executed at the very end of init
Source code in gravtools/tides/correction_time_series.py
200 201 202 | |
duration_dhms()
Returns the duration as days, hours, minutes and seconds.
Source code in gravtools/tides/correction_time_series.py
239 240 241 242 243 244 245 246 | |
interpolate(interp_times, kind='quadratic', return_correction=False)
Return an interpolated value for the given interpolation epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interp_times
|
[array, List[datetime]]
|
Interpolation epoch given as |
required |
kind
|
str
|
Specifies, which interpolation method is used. This argument is directly passed to
|
'quadratic'
|
return_correction
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
`numpy.ndarray`: Interpolated value for the given interpolation times.
|
|
Source code in gravtools/tides/correction_time_series.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
to_df()
Returns the time series as pandas DataFrame with the time reference as index (sorted!).
Source code in gravtools/tides/correction_time_series.py
297 298 299 300 301 | |
convert_to_mugal(data, data_unit)
staticmethod
Converts data to from a given unit to µGal.
Source code in gravtools/tides/correction_time_series.py
383 384 385 386 387 388 389 | |
gravtools.tides.longman1959
Longman Earth Tide Calculator - Adapted from John Leeman's implementation of I. M. Longman's earth tide calculations (see references below)
Parts of this program (c) 2017 John Leeman Any other modifications from the base LongmanTide (c) 2018 Zachery Brady
Licensed under the MIT License, see LICENSE text below
References
I.M. Longman "Formulas for Computing the Tidal Accelerations Due to the Moon and the Sun" Journal of Geophysical Research, vol. 64, no. 12, 1959, pp. 2351-2355 P. Schureman "Manual of harmonic analysis and prediction of tides" U.S. Coast and Geodetic Survey, 1958 John Leeman's GitHub page for the original implementation of this library: https://github.com/jrleeman/LongmanTide
Notes
Unicode greek symbols are used to more clearly name variables based on the equations in Longman's paper. This is simply a style decision and may not reflect Python best practices. Python's Datetime.datetime objects are timezone-naive - e.g. when creating a datetime of
datetime(1899, 12, 31, 12, 0, 0) The object refers to exactly the time specified, with no knowledge of the time-zone - when doing calculations against such an object we need to make sure that whatever datetime being used is specified in the same time zone.
LICENSE
MIT License
Copyright (c) 2017 John Leeman Copyright (c) 2018-2020 Zachery Brady
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
calculate_julian_century(dates)
Calculate the decimal Julian century and floating point hour, as referenced from 1899, December 31 at 12:00:00 This function accepts either a numpy ndarray or pandas DatetimeIndex as input, and returns a 2-tuple of the corresponding Julian century decimals and floating point hours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dates
|
Union[ndarray, DatetimeIndex]
|
1-dimensional array of DateTime objects to convert into century/hours arrays |
required |
Notes
All DateTimes should be supplied as UTC values, using a timezone-naive DateTime object. This can be accomplished either by using datetime.utcnow(), or by constructing datetime objects where the times are specified as UTC values Reference Date: 1899 December 31 12:00:00 Reference ordinal: 693961.5 (MATLAB Serial date from January 0, 0000) Delta 366 days Reference ordinal: 694327.5 (Python ordinal from January 1, 0001)
Returns:
| Type | Description |
|---|---|
2-tuple of:
|
T : np.ndarray Number of Julian centuries (36525 days) from GMT Noon on December 31, 1899 t0 : np.ndarray Greenwich civil dates measured in hours |
Source code in gravtools/tides/longman1959.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
solve_longman_tide(lat, lon, alt, time)
Find the total gravity correction due to the Sun/Moon for the given latitude, longitude, altitude, and time - supplied as numpy 1-d arrays. Corrections are calculated for each corresponding set of data in the supplied arrays, all arrays must be of the same shape (length and dimension) This function returns the Lunar, Solar, and Total gravity corrections as a 3-tuple of numpy 1-d arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
ndarray
|
1-dimensional array of float values denoting latitudes |
required |
lon
|
ndarray
|
1-dimensional array of float values denoting longitudes |
required |
alt
|
ndarray
|
1-dimensional array of float values denoting altitude in meters |
required |
time
|
ndarray
|
1-dimensional array of DateTime objects denoting the time series |
required |
Returns:
| Type | Description |
|---|---|
3 - Tuple
|
gMoon (gm): Vertical component of tidal acceleration due to the moon gSun (gs): Vertical component of tidal acceleration due to the sun gTotal (g0): Total vertical component of tidal acceleration (moon + sun) |
Source code in gravtools/tides/longman1959.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
solve_longman_tide_scalar(lat, lon, alt, time)
Simple wrapper around solve_longman_tide that allows passing of singular scalar values instead of an array. This function simply wraps the scalar values within an ndarray and then extracts the result elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
float
|
Latitude as a scalar float value |
required |
lon
|
float
|
Longitude as a scalar float value |
required |
alt
|
float
|
Altitude as a scalar float value |
required |
time
|
datetime
|
Time as a scalar datetime object |
required |
Returns:
| Type | Description |
|---|---|
gm, gs, g0 : float, float, float
|
Where gm is the gravitational effect due to the moon gs is the gravitational effect due to the sun g0 is the total gravitational effect of the sun and moon (gm+gs) |
Source code in gravtools/tides/longman1959.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
solve_point_corr(lat, lon, alt, t0=datetime.utcnow(), n=3600, increment='S')
Utility function to generate a tide correction DataFrame for a static lat/lon/alt given start time t0, an increment, and count (n) of datapoints to generate. Default parameters are supplied that will generate a correction series with one second increment over a one hour period, with start time being the time of execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
float
|
Latitude in decimal degrees |
required |
lon
|
float
|
Longitude in decimal degrees |
required |
alt
|
float
|
Altitude (height) above sea level in meters |
required |
t0
|
DateTime
|
Starting date/time |
utcnow()
|
n
|
int
|
Number of data points to generate |
3600
|
increment
|
String
|
Increment between data points, uses Pandas offset aliases: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Timedelta.html#pandas.Timedelta Common options: * H : Hourly Frequency * T, min : Minutely frequency * S : Secondly frequency * L, ms : millisecond frequency * U, us : microsecond frequency * N : nanosecond frequency |
'S'
|
Returns:
| Name | Type | Description |
|---|---|---|
df |
DataFrame
|
DataFrame (index=DateTime, lat, lon, alt, gm, gs, g0) shape: (n, 4) Pandas DataFrame indexed by DateTime containing the latitude, longitude, altitude, lunar, solar, and total corrections. |
Notes
total_corr column renamed to g0 and gm/gs added in v0.3.0
Source code in gravtools/tides/longman1959.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
solve_tide_df(df, lat='lat', lon='lon', alt='alt')
Solve tidal gravity corrections for a given Pandas DataFrame, returning the source DataFrame with an appended 'tide_corr' column. Source DataFrame should be indexed by datetime and must contain latitude, longitude, and altitude columns. Source column names can be specified by passing the applicable column name to the lat, lon, alt parameters as required. Time is assumed to be the index of the DataFrame
Returns:
| Name | Type | Description |
|---|---|---|
df |
DataFrame
|
Copy of source df with added columns 'gm' 'gs' and 'g0': lunar, solar and total corrections respectively |
Source code in gravtools/tides/longman1959.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |