API reference
eo_tides.model
¶
Functions:
Name | Description |
---|---|
model_phases |
Model tide phases (low-flow, high-flow, high-ebb, low-ebb) |
model_tides |
Model tide heights at multiple coordinates and/or timesteps |
model_phases
¶
model_phases(
x,
y,
time,
model="EOT20",
directory=None,
time_offset="15 min",
return_tides=False,
**model_tides_kwargs
)
Model tide phases (low-flow, high-flow, high-ebb, low-ebb) at multiple coordinates and/or timesteps using using one or more ocean tide models.
Ebb and low phases are calculated by running the
eo_tides.model.model_tides
function twice, once for
the requested timesteps, and again after subtracting a
small time offset (by default, 15 minutes). If tides
increased over this period, they are assigned as "flow";
if they decreased, they are assigned as "ebb".
Tides are considered "high" if equal or greater than 0
metres tide height, otherwise "low".
This function supports all parameters that are supported
by model_tides
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float or list of float
|
One or more x and y coordinates used to define the location at which to model tide phases. By default these coordinates should be lat/lon; use "crs" if they are in a custom coordinate reference system. |
required |
|
float or list of float
|
One or more x and y coordinates used to define the location at which to model tide phases. By default these coordinates should be lat/lon; use "crs" if they are in a custom coordinate reference system. |
required |
|
DatetimeLike
|
Times at which to model tide phases (in UTC). Accepts
any format that can be converted by |
required |
|
str or list of str
|
The tide model (or models) to use to compute tide phases.
Defaults to "EOT20"; for a full list of available/supported
models, run |
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
str
|
The time offset/delta used to generate a time series of
offset tide heights required for phase calculation. Defeaults
to "15 min"; can be any string passed to |
'15 min'
|
|
bool
|
Whether to return intermediate modelled tide heights as a "tide_height" column in the output dataframe. Defaults to False. |
False
|
|
Optional parameters passed to the |
{}
|
Returns:
Type | Description |
---|---|
DataFrame
|
A dataframe containing modelled tide phases. |
Source code in eo_tides/model.py
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
|
model_tides
¶
model_tides(
x,
y,
time,
model="EOT20",
directory=None,
crs="EPSG:4326",
crop=True,
method="linear",
extrapolate=True,
cutoff=None,
mode="one-to-many",
parallel=True,
parallel_splits="auto",
parallel_max=None,
output_units="m",
output_format="long",
ensemble_models=None,
**ensemble_kwargs
)
Model tide heights at multiple coordinates and/or timesteps using using one or more ocean tide models.
This function is parallelised to improve performance, and
supports all tidal models supported by pyTMD
, including:
- Empirical Ocean Tide model (EOT20)
- Finite Element Solution tide models (FES2022, FES2014, FES2012)
- TOPEX/POSEIDON global tide models (TPXO10, TPXO9, TPXO8)
- Global Ocean Tide models (GOT5.6, GOT5.5, GOT4.10, GOT4.8, GOT4.7)
- Hamburg direct data Assimilation Methods for Tides models (HAMTIDE11)
This function requires access to tide model data files.
These should be placed in a folder with subfolders matching
the structure required by pyTMD
. For more details:
https://geoscienceaustralia.github.io/eo-tides/setup/
https://pytmd.readthedocs.io/en/latest/getting_started/Getting-Started.html#directories
This function is a modification of the pyTMD
package's
pyTMD.compute.tide_elevations
function. For more info:
https://pytmd.readthedocs.io/en/latest/api_reference/compute.html#pyTMD.compute.tide_elevations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float or list of float
|
One or more x and y coordinates used to define the location at which to model tides. By default these coordinates should be lat/lon; use "crs" if they are in a custom coordinate reference system. |
required |
|
float or list of float
|
One or more x and y coordinates used to define the location at which to model tides. By default these coordinates should be lat/lon; use "crs" if they are in a custom coordinate reference system. |
required |
|
DatetimeLike
|
Times at which to model tide heights (in UTC). Accepts
any format that can be converted by |
required |
|
str or list of str
|
The tide model (or models) to use to model tides.
Defaults to "EOT20"; for a full list of available/supported
models, run |
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
str
|
Input coordinate reference system for x and y coordinates. Defaults to "EPSG:4326" (WGS84; degrees latitude, longitude). |
'EPSG:4326'
|
|
bool
|
Whether to crop tide model constituent files on-the-fly to improve performance. Cropping will be performed based on a 1 degree buffer around all input points. Defaults to True. |
True
|
|
str
|
Method used to interpolate tidal constituents from model files. Defaults to "linear"; options include:
|
'linear'
|
|
bool
|
Whether to extrapolate tides for x and y coordinates outside of the valid tide modelling domain using nearest-neighbor. |
True
|
|
float
|
Extrapolation cutoff in kilometers. The default is None, which will extrapolate for all points regardless of distance from the valid tide modelling domain. |
None
|
|
str
|
The analysis mode to use for tide modelling. Supports two options:
|
'one-to-many'
|
|
bool
|
Whether to parallelise tide modelling using |
True
|
|
str or int
|
Whether to split the input x and y coordinates into smaller, evenly-sized chunks that are processed in parallel. This can provide a large performance boost when processing large numbers of coordinates. The default is "auto", which will automatically attempt to determine optimal splits based on available CPUs, the number of input points, and the number of models. |
'auto'
|
|
int
|
Maximum number of processes to run in parallel. The default of None will automatically determine this from your available CPUs. |
None
|
|
str
|
Whether to return modelled tides in floating point metre units, or integer centimetre units (i.e. scaled by 100) or integer millimetre units (i.e. scaled by 1000. Returning outputs in integer units can be useful for reducing memory usage. Defaults to "m" for metres; set to "cm" for centimetres or "mm" for millimetres. |
'm'
|
|
str
|
Whether to return the output dataframe in long format (with results stacked vertically along "tide_model" and "tide_height" columns), or wide format (with a column for each tide model). Defaults to "long". |
'long'
|
|
list of str
|
An optional list of models used to generate the ensemble tide model if "ensemble" tide modelling is requested. Defaults to ["FES2014", "TPXO9-atlas-v5", "EOT20", "HAMTIDE11", "GOT4.10", "FES2012", "TPXO8-atlas-v1"]. |
None
|
|
Keyword arguments used to customise the generation of optional
ensemble tide models if "ensemble" modelling are requested.
These are passed to the underlying |
{}
|
Returns:
Type | Description |
---|---|
DataFrame
|
A dataframe containing modelled tide heights. |
Source code in eo_tides/model.py
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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
|
eo_tides.eo
¶
Functions:
Name | Description |
---|---|
pixel_tides |
Model tide heights for every pixel in a multi-dimensional |
tag_tides |
Model tide heights for every timestep in a multi-dimensional |
pixel_tides
¶
pixel_tides(
data,
time=None,
model="EOT20",
directory=None,
resample=True,
calculate_quantiles=None,
resolution=None,
buffer=None,
resample_method="bilinear",
dask_chunks=None,
dask_compute=True,
**model_tides_kwargs
)
Model tide heights for every pixel in a multi-dimensional dataset, using one or more ocean tide models.
This function models tides into a low-resolution tide modelling grid covering the spatial extent of the input data (buffered to reduce potential edge effects). These modelled tides can then be resampled back into the original higher resolution dataset's extent and resolution to produce a modelled tide height for every pixel through time.
This function uses the parallelised model_tides
function
under the hood. It supports all tidal models supported by
pyTMD
, including:
- Empirical Ocean Tide model (EOT20)
- Finite Element Solution tide models (FES2022, FES2014, FES2012)
- TOPEX/POSEIDON global tide models (TPXO10, TPXO9, TPXO8)
- Global Ocean Tide models (GOT5.6, GOT5.5, GOT4.10, GOT4.8, GOT4.7)
- Hamburg direct data Assimilation Methods for Tides models (HAMTIDE11)
This function requires access to tide model data files.
These should be placed in a folder with subfolders matching
the structure required by pyTMD
. For more details:
https://geoscienceaustralia.github.io/eo-tides/setup/
https://pytmd.readthedocs.io/en/latest/getting_started/Getting-Started.html#directories
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset or DataArray or GeoBox
|
A multi-dimensional dataset or GeoBox pixel grid that will
be used to define the spatial tide modelling grid. If |
required |
|
DatetimeLike
|
By default, tides will be modelled using times from the
"time" dimension of |
None
|
|
str or list of str
|
The tide model (or models) used to model tides. If a list is
provided, a new "tide_model" dimension will be added to the
|
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
bool
|
Whether to resample low resolution tides back into |
True
|
|
tuple of float or numpy.ndarray
|
Rather than returning all individual tides, low-resolution tides
can be first aggregated using a quantile calculation by passing in
a tuple or array of quantiles to compute. For example, this could
be used to calculate the min/max tide across all times:
|
None
|
|
float
|
The desired resolution of the low-resolution grid used for tide
modelling. The default None will create a 5000 m resolution grid
if |
None
|
|
float
|
The amount by which to buffer the higher resolution grid extent
when creating the new low resolution grid. This buffering
ensures that modelled tides are seamless across analysis
boundaries. This buffer is eventually be clipped away when
the low-resolution modelled tides are re-projected back to the
original resolution and extent of |
None
|
|
str
|
If resampling is requested (see |
'bilinear'
|
|
tuple of float
|
Can be used to configure custom Dask chunking for the final
resampling step. By default, chunks will be automatically set
to match y/x chunks from |
None
|
|
bool
|
Whether to compute results of the resampling step using Dask.
If False, |
True
|
|
Optional parameters passed to the |
{}
|
Returns:
Name | Type | Description |
---|---|---|
tides_da |
DataArray
|
A three-dimensional tide height array.
If |
Source code in eo_tides/eo.py
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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
|
tag_tides
¶
tag_tides(
data,
time=None,
model="EOT20",
directory=None,
tidepost_lat=None,
tidepost_lon=None,
**model_tides_kwargs
)
Model tide heights for every timestep in a multi-dimensional
dataset, and return a new tide_height
array that can
be used to "tag" each observation with tide heights.
The function models tides at the centroid of the dataset
by default, but a custom tidal modelling location can
be specified using tidepost_lat
and tidepost_lon
.
This function uses the parallelised model_tides
function
under the hood. It supports all tidal models supported by
pyTMD
, including:
- Empirical Ocean Tide model (EOT20)
- Finite Element Solution tide models (FES2022, FES2014, FES2012)
- TOPEX/POSEIDON global tide models (TPXO10, TPXO9, TPXO8)
- Global Ocean Tide models (GOT5.6, GOT5.5, GOT4.10, GOT4.8, GOT4.7)
- Hamburg direct data Assimilation Methods for Tides models (HAMTIDE11)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset or DataArray or GeoBox
|
A multi-dimensional dataset or GeoBox pixel grid that will
be used to define the tide modelling location. If |
required |
|
DatetimeLike
|
By default, tides will be modelled using times from the
"time" dimension of |
None
|
|
str or list of str
|
The tide model (or models) used to model tides. If a list is
provided, a new "tide_model" dimension will be added to the
|
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
float
|
Optional coordinates used to model tides. The default is None, which uses the centroid of the dataset as the tide modelling location. |
None
|
|
float
|
Optional coordinates used to model tides. The default is None, which uses the centroid of the dataset as the tide modelling location. |
None
|
|
Optional parameters passed to the |
{}
|
Returns:
Name | Type | Description |
---|---|---|
tides_da |
DataArray
|
A one-dimensional tide height array. This will contain either
tide heights for every timestep in |
Source code in eo_tides/eo.py
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 |
|
eo_tides.stats
¶
Functions:
Name | Description |
---|---|
pixel_stats |
Takes a multi-dimensional dataset and generate two-dimensional |
tide_stats |
Takes a multi-dimensional dataset and generate tide statistics |
pixel_stats
¶
pixel_stats(
data,
time=None,
model="EOT20",
directory=None,
resample=False,
modelled_freq="3h",
min_max_q=(0.0, 1.0),
extrapolate=True,
cutoff=10,
**pixel_tides_kwargs
)
Takes a multi-dimensional dataset and generate two-dimensional tide statistics and satellite-observed tide bias metrics, calculated based on every timestep in the satellte data and modelled into the spatial extent of the imagery.
By comparing the subset of tides observed by satellites against the full astronomical tidal range, we can evaluate whether the tides observed by satellites are biased (e.g. fail to observe either the highest or lowest tides).
Compared to tide_stats
, this function models tide metrics
spatially to produce a two-dimensional output.
For more information about the tidal statistics computed by this function, refer to Figure 8 in Bishop-Taylor et al. 2018: https://www.sciencedirect.com/science/article/pii/S0272771418308783#fig8
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset or DataArray or GeoBox
|
A multi-dimensional dataset or GeoBox pixel grid that will
be used to calculate 2D tide statistics. If |
required |
|
DatetimeLike
|
By default, tides will be modelled using times from the
"time" dimension of |
None
|
|
str or list of str
|
The tide model (or models) to use to model tides. If a list is
provided, a new "tide_model" dimension will be added to |
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
bool
|
Whether to resample tide statistics back into |
False
|
|
str
|
An optional string giving the frequency at which to model tides
when computing the full modelled tidal range. Defaults to '3h',
which computes a tide height for every three hours across the
temporal extent of |
'3h'
|
|
tuple
|
Quantiles used to calculate max and min observed and modelled
astronomical tides. By default |
(0.0, 1.0)
|
|
bool
|
Whether to extrapolate tides for x and y coordinates outside of the valid tide modelling domain using nearest-neighbor. Defaults to True. |
True
|
|
float
|
Extrapolation cutoff in kilometers. To avoid producing tide statistics too far inland, the default is 10 km. |
10
|
|
Optional parameters passed to the |
{}
|
Returns:
Name | Type | Description |
---|---|---|
stats_ds |
Dataset
|
An
|
Source code in eo_tides/stats.py
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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
tide_stats
¶
tide_stats(
data,
time=None,
model="EOT20",
directory=None,
tidepost_lat=None,
tidepost_lon=None,
plain_english=True,
plot=True,
plot_col=None,
modelled_freq="3h",
linear_reg=False,
min_max_q=(0.0, 1.0),
round_stats=3,
**model_tides_kwargs
)
Takes a multi-dimensional dataset and generate tide statistics and satellite-observed tide bias metrics, calculated based on every timestep in the satellte data and the geographic centroid of the imagery.
By comparing the subset of tides observed by satellites against the full astronomical tidal range, we can evaluate whether the tides observed by satellites are biased (e.g. fail to observe either the highest or lowest tides).
For more information about the tidal statistics computed by this function, refer to Figure 8 in Bishop-Taylor et al. 2018: https://www.sciencedirect.com/science/article/pii/S0272771418308783#fig8
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset or DataArray or GeoBox
|
A multi-dimensional dataset or GeoBox pixel grid that will
be used to calculate tide statistics. If |
required |
|
DatetimeLike
|
By default, tides will be modelled using times from the
"time" dimension of |
None
|
|
str
|
The tide model to use to model tides. Defaults to "EOT20";
for a full list of available/supported models, run
|
'EOT20'
|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
float or int
|
Optional coordinates used to model tides. The default is None, which uses the centroid of the dataset as the tide modelling location. |
None
|
|
float or int
|
Optional coordinates used to model tides. The default is None, which uses the centroid of the dataset as the tide modelling location. |
None
|
|
bool
|
An optional boolean indicating whether to print a plain english version of the tidal statistics to the screen. Defaults to True. |
True
|
|
bool
|
An optional boolean indicating whether to plot how satellite- observed tide heights compare against the full tidal range. Defaults to True. |
True
|
|
str
|
Optional name of a coordinate, dimension or variable in the array that will be used to plot observations with unique symbols. Defaults to None, which will plot all observations as circles. |
None
|
|
str
|
An optional string giving the frequency at which to model tides
when computing the full modelled tidal range. Defaults to '3h',
which computes a tide height for every three hours across the
temporal extent of |
'3h'
|
|
bool
|
Whether to return linear regression statistics that assess whether satellite-observed tides show any decreasing or increasing trends over time. This may indicate whether your satellite data may produce misleading trends based on uneven sampling of the local tide regime. |
False
|
|
tuple
|
Quantiles used to calculate max and min observed and modelled
astronomical tides. By default |
(0.0, 1.0)
|
|
int
|
The number of decimal places used to round the output statistics. Defaults to 3. |
3
|
|
Optional parameters passed to the |
{}
|
Returns:
Name | Type | Description |
---|---|---|
stats_df |
Series
|
A
If
|
Source code in eo_tides/stats.py
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 |
|
eo_tides.validation
¶
Functions:
Name | Description |
---|---|
eval_metrics |
Calculate a set of common statistical metrics |
load_gauge_gesla |
Load Global Extreme Sea Level Analysis (GESLA) tide gauge data. |
eval_metrics
¶
Calculate a set of common statistical metrics based on two input actual and predicted vectors.
These include:
- Pearson correlation
- Root Mean Squared Error
- Mean Absolute Error
- R-squared
- Bias
- Linear regression parameters (slope, p-value, intercept, standard error)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
array
|
An array providing "actual" variable values. |
required |
|
array
|
An array providing "predicted" variable values. |
required |
|
int
|
Number of decimal places to round each metric to. Defaults to 3. |
3
|
|
bool
|
Whether to return linear regression p-value, intercept and standard error (in addition to only regression slope). Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
Series
|
A |
Source code in eo_tides/validation.py
load_gauge_gesla
¶
load_gauge_gesla(
x=None,
y=None,
site_code=None,
time=("2018", "2020"),
max_distance=None,
correct_mean=False,
filter_use_flag=True,
site_metadata=True,
data_path="/gdata1/data/sea_level/gesla/",
metadata_path="/gdata1/data/sea_level/GESLA3_ALL 2.csv",
)
Load Global Extreme Sea Level Analysis (GESLA) tide gauge data.
Load and process all available GESLA measured sea-level data
with an x, y, time
spatio-temporal query, or from a list of
specific tide gauges. Can optionally filter by gauge quality
and append detailed gauge metadata.
Modified from original code in https://github.com/philiprt/GeslaDataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
numeric or list / tuple
|
Coordinates (in degrees longitude, latitude) used to load GESLA
tide gauge observations. If provided as singular values
(e.g. |
None
|
|
numeric or list / tuple
|
Coordinates (in degrees longitude, latitude) used to load GESLA
tide gauge observations. If provided as singular values
(e.g. |
None
|
|
str or list of str
|
GESLA site code(s) for which to load data (e.g. |
None
|
|
tuple or list of str
|
Time range to consider, given as a tuple of start and end dates,
e.g. |
('2018', '2020')
|
|
numeric
|
Optional max distance within which to return the nearest tide gauge
when |
None
|
|
bool
|
Whether to correct sea level measurements to a standardised mean sea level by subtracting the mean of all observed sea level observations. This can be useful when GESLA tide heights come from different or unknown tide datums. Note: the observed mean sea level calculated here may differ from true long-term/ astronomical Mean Sea Level (MSL) datum. |
False
|
|
bool
|
Whether to filter out low quality observations with a "use_flag" value of 0 (do not use). Defaults to True. |
True
|
|
bool
|
Whether to add tide gauge station metadata as additional columns in the output DataFrame. Defaults to True. |
True
|
|
str
|
Path to the raw GESLA data files. Default is
|
'/gdata1/data/sea_level/gesla/'
|
|
str
|
Path to the GESLA station metadata file.
Default is |
'/gdata1/data/sea_level/GESLA3_ALL 2.csv'
|
Returns:
Type | Description |
---|---|
DataFrame
|
Processed GESLA data as a DataFrame with columns including:
...and additional columns from station metadata. |
Source code in eo_tides/validation.py
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 |
|
eo_tides.utils
¶
Functions:
Name | Description |
---|---|
clip_models |
Clip NetCDF-format ocean tide models to a bounding box. |
idw |
Perform Inverse Distance Weighting (IDW) interpolation. |
list_models |
List all tide models available for tide modelling. |
clip_models
¶
Clip NetCDF-format ocean tide models to a bounding box.
This function identifies all NetCDF-format tide models in a
given input directory, including "ATLAS-netcdf" (e.g. TPXO9-atlas-nc),
"FES-netcdf" (e.g. FES2022, EOT20), and "GOT-netcdf" (e.g. GOT5.5)
format files. Files for each model are then clipped to the extent of
the provided bounding box, handling model-specific file structures.
After each model is clipped, the result is exported to the output
directory and verified with pyTMD
to ensure the clipped data is
suitable for tide modelling.
For instructions on accessing and downloading tide models, see: https://geoscienceaustralia.github.io/eo-tides/setup/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str or PathLike
|
Path to directory containing input NetCDF-format tide model files. |
required |
|
str or PathLike
|
Path to directory where clipped NetCDF files will be exported. |
required |
|
tuple of float
|
Bounding box for clipping the tide models in EPSG:4326 degrees
coordinates, specified as |
required |
|
str or list of str
|
The tide model (or models) to clip. Defaults to None, which will automatically identify and clip all NetCDF-format models in the input directly. |
None
|
|
float
|
Buffer distance (in degrees) added to the bounding box to provide sufficient data on edges of study area. Defaults to 1 degree. |
1
|
|
bool
|
If True, overwrite existing files in the output directory. Defaults to False. |
False
|
Examples:
>>> clip_models(
... input_directory="tide_models/",
... output_directory="tide_models_clipped/",
... bbox=(-8.968392, 50.070574, 2.447160, 59.367122),
... )
Source code in eo_tides/utils.py
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 |
|
idw
¶
idw(
input_z,
input_x,
input_y,
output_x,
output_y,
p=1,
k=10,
max_dist=None,
k_min=1,
epsilon=1e-12,
)
Perform Inverse Distance Weighting (IDW) interpolation.
This function performs fast IDW interpolation by creating a KDTree
from the input coordinates then uses it to find the k
nearest
neighbors for each output point. Weights are calculated based on the
inverse distance to each neighbor, with weights descreasing with
increasing distance.
Code inspired by: https://github.com/DahnJ/REM-xarray
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
array - like
|
Array of values at the input points. This can be either a 1-dimensional array, or a 2-dimensional array where each column (axis=1) represents a different set of values to be interpolated. |
required |
|
array - like
|
Array of x-coordinates of the input points. |
required |
|
array - like
|
Array of y-coordinates of the input points. |
required |
|
array - like
|
Array of x-coordinates where the interpolation is to be computed. |
required |
|
array - like
|
Array of y-coordinates where the interpolation is to be computed. |
required |
|
int or float
|
Power function parameter defining how rapidly weightings should
decrease as distance increases. Higher values of |
1
|
|
int
|
Number of nearest neighbors to use for interpolation. |
10
|
|
int or float
|
Restrict neighbouring points to less than this distance. By default, no distance limit is applied. |
None
|
|
int
|
If |
1
|
|
float
|
Small value added to distances to prevent division by zero errors in the case that output coordinates are identical to input coordinates. Defaults to 1e-12. |
1e-12
|
Returns:
Name | Type | Description |
---|---|---|
interp_values |
ndarray
|
Interpolated values at the output coordinates. If |
Examples:
>>> input_z = [1, 2, 3, 4, 5]
>>> input_x = [0, 1, 2, 3, 4]
>>> input_y = [0, 1, 2, 3, 4]
>>> output_x = [0.5, 1.5, 2.5]
>>> output_y = [0.5, 1.5, 2.5]
>>> idw(input_z, input_x, input_y, output_x, output_y, k=2)
array([1.5, 2.5, 3.5])
Source code in eo_tides/utils.py
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
|
list_models
¶
List all tide models available for tide modelling.
This function scans the specified tide model directory
and returns a list of models that are available in the
directory as well as the full list of all models supported
by eo-tides
and pyTMD
.
For instructions on setting up tide models, see: https://geoscienceaustralia.github.io/eo-tides/setup/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The directory containing tide model data files. If no path is
provided, this will default to the environment variable
|
None
|
|
bool
|
Whether to print a list of locally available models. |
True
|
|
bool
|
Whether to print a list of all supported models, in addition to models available locally. |
True
|
|
bool
|
If True, raise an error if no available models are found. If False, raise a warning. |
False
|
Returns:
Name | Type | Description |
---|---|---|
available_models |
list of str
|
A list of all tide models available within |
supported_models |
list of str
|
A list of all tide models supported by |
Source code in eo_tides/utils.py
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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
|