Station
gravtools.models.station
Modelling gravity stations.
Copyright (C) 2021 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/.
Station
Holds information on stations with known attributes.
Attributes:
| Name | Type | Description |
|---|---|---|
station_files |
dict
|
The keys are the filenames (valid filename and path) and the values are the types of the station file (see: STATION_DATA_SOURCE_TYPES.keys()). |
stat_df |
:py:obj:`pandas.core.frame.DataFrame`
|
Pandas Dataframe that holds all station data. The columns are specified in :py:obj:
|
Source code in gravtools/models/station.py
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 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 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
get_all_stations
property
:py:obj:pandas.core.frame.DataFrame : Returns all available stations.
get_number_of_stations
property
int : Returns the number of stations.
__init__(station_files=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_files
|
dict
|
The keys are the filenames (valid filename and path) and the values are the types of the station file (see: STATION_DATA_SOURCE_TYPES.keys()). Default=None which implies that no stations are added to this object. |
None
|
Raises:
| Type | Description |
|---|---|
FileTypeError
|
Station file format not defined in :py:const: |
TypeError
|
Constructor arguments of wrong type. |
Source code in gravtools/models/station.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 | |
add_stations(stat_df_add, data_source_type, verbose=False)
Adds stations from various sources (e.g. station and observation files) to the station dataframe.
Notes
- Station names (column 'station_name') have to be unique in the resulting station dataframe
- Keep the added station and drop existing entries, if the station names match.
- If a station (with a unique station_name) is already available in the station dataframe and originates from a station file (e.g. ÖSGN file), the new station (from any source) is not added.
- If a station originating from an observation file is already available in the station dataframe an the same station (same name) should be added from a station file (e.g. ÖSGN), the old version is overwritten be the entry from the station file.
- If a station originating from an observation file is already available in the station dataframe and the same station (same name) should be added from an observation file (e.g. CG5 observation file), the old version is kept and the new version is discarded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stat_df_add
|
py:oby:`.Station.stat_df`
|
Station dataframe, that should be added so |
required |
data_source_type
|
str
|
Specifies the type of the data source. Valid data source types are defined in
:py:obj: |
required |
verbose
|
bool
|
If |
= `False`
|
Source code in gravtools/models/station.py
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 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
add_stations_from_csv_file(filename, verbose=False)
Adds (appends) all stations of the input OESGN table to the station dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name (and path) of the OESGN table file. |
required |
verbose
|
bool
|
Print notifications, if |
False
|
Source code in gravtools/models/station.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
add_stations_from_oesgn_table(filename, is_datum=False, verbose=False)
Adds (appends) all stations of the input OESGN table to the station dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name (and path) of the OESGN table file. |
required |
is_datum
|
(bool, optional(default=False))
|
|
False
|
verbose
|
bool
|
Print notifications, if |
False
|
Source code in gravtools/models/station.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
add_stations_from_survey(survey, verbose=False)
Add stations from a survey dataset, if they are not included in the station data yet.
Notes
The location information (longitude, latitude and height) are taken from the first appearance of a station in the survey dataframe, although this information may differ between setups if the location was determined (e.g. by GPS) for each individual measurement setup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
survey
|
py:obj:`Survey`
|
Survey object which is search for stations that are not included in the station dataframe yet. |
required |
verbose
|
bool, defualt=False
|
If |
False
|
Source code in gravtools/models/station.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 342 343 344 345 346 347 348 349 350 351 | |
delete_station(station_names, verbose=False)
Deletes all rows where the station name occurs in the station_names list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_names
|
list of str
|
List of station names. The according station records will be deleted from |
required |
verbose
|
bool
|
If |
False
|
Source code in gravtools/models/station.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
set_datum_stations(station_names, is_datum, verbose=False)
Dependent on the is_datum flag set the datum status of all stations in the list
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_names
|
list of str
|
List of station names. The according station records will be deleted from |
required |
is_datum
|
bool
|
|
required |
verbose
|
bool
|
If |
False
|
Source code in gravtools/models/station.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
set_observed_info_from_survey(survey)
Set the is_observed flags and the in_survey strings in the py:obj:Station.stat_df DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
survey
|
py:obj:`Survey`
|
Survey object which is used as reference to set the |
required |
Source code in gravtools/models/station.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |