Skip to content

Commit

Permalink
internal mean pole and finals EOP files (#31)
Browse files Browse the repository at this point in the history
add automatic update of leap second, delta time and EOP files

normalize source and destination paths in copy

add more servers for mean-pole and iers coordinates

add test for calculating EOP differentials
  • Loading branch information
tsutterley committed Nov 17, 2020
1 parent eb28370 commit 9c41a2c
Show file tree
Hide file tree
Showing 26 changed files with 21,052 additions and 406 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/auto-update-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will install Python dependencies and update the time and EOP files

name: Auto-Update Files

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1 * *'

jobs:
build:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libproj-dev proj-data proj-bin libgeos-dev octave
sudo apt-get install libhdf5-dev libnetcdf-dev
pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Update required files
run: |
pip install --no-deps .
pytest test/test_leap_seconds.py
- name: Test with pytest
run: |
pytest test/test_leap_seconds.py test/test_time.py test/test_eop.py
--username=${{ secrets.EARTHDATA_USERNAME }} \
--password=${{ secrets.EARTHDATA_PASSWORD }}
- name: Check for changes
id: changes
run: |
if [ -n "$(git status --porcelain)" ] ; then
echo "::set-output name=detected::true";
echo "::debug::Changes detected";
else
echo "::set-output name=detected::false";
echo "::debug::No changes detected";
fi
- name: Create pull request
if: steps.changes.outputs.detected == 'true'
uses: peter-evans/create-pull-request@v3
with:
assignees: ${{ github.actor }}
title: "Automatic time updates"
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Tyler C. Sutterley'

# The full version, including alpha/beta/rc tags
release = '1.0.2.14'
release = '1.0.2.15'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ calculating radial pole tide displacements
user_guide/bilinear_interp.md
user_guide/calc_astrol_longitudes.md
user_guide/calc_delta_time.md
user_guide/calc_iers_mean_pole.md
user_guide/compute_equilibrium_tide.md
user_guide/compute_LPET_elevations.md
user_guide/compute_LPET_icebridge_data.md
Expand All @@ -59,6 +58,7 @@ calculating radial pole tide displacements
user_guide/convert_julian.md
user_guide/convert_ll_xy.md
user_guide/count_leap_seconds.md
user_guide/eop.rst
user_guide/iers_mean_pole.md
user_guide/infer_minor_corrections.md
user_guide/load_constituent.md
Expand Down
14 changes: 0 additions & 14 deletions doc/source/user_guide/calc_iers_mean_pole.md

This file was deleted.

3 changes: 1 addition & 2 deletions doc/source/user_guide/compute_LPT_displacements.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ compute_LPT_displacements.py

#### Calling Sequence
```bash
python compute_LPT_displacements.py --directory <path_to_directory> input_file output_file
python compute_LPT_displacements.py input_file output_file
```
[Source code](https://github.com/tsutterley/pyTMD/blob/main/scripts/compute_LPT_displacements.py)

Expand All @@ -16,7 +16,6 @@ python compute_LPT_displacements.py --directory <path_to_directory> input_file o
2. `output_file`: name of output file

#### Command Line Options
- `-D X`, `--directory X`: Working data directory
- `--format X`: input and output data format
* `'csv'` (default)
* `'netCDF4'`
Expand Down
3 changes: 1 addition & 2 deletions doc/source/user_guide/compute_LPT_icebridge_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ compute_LPT_icebridge_data.py

#### Calling Sequence
```bash
python compute_LPT_icebridge_data.py --directory <path_to_directory> input_file
python compute_LPT_icebridge_data.py input_file
```
[Source code](https://github.com/tsutterley/pyTMD/blob/main/compute_LPT_icebridge_data.py)

#### Inputs
1. `input_file`: input ATM1B, ATM icessn or LVIS file from NSIDC

#### Command Line Options
- `-D X`, `--directory X`: Working data directory
- `-M X`, `--mode X`: Permission mode of output file
- `-V`, `--verbose`: Output information about each created file
3 changes: 1 addition & 2 deletions doc/source/user_guide/compute_OPT_displacements.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ compute_OPT_displacements.py

#### Calling Sequence
```bash
python compute_OPT_displacements.py --directory <path_to_directory> input_file output_file
python compute_OPT_displacements.py input_file output_file
```
[Source code](https://github.com/tsutterley/pyTMD/blob/main/scripts/compute_OPT_displacements.py)

Expand All @@ -16,7 +16,6 @@ python compute_OPT_displacements.py --directory <path_to_directory> input_file o
2. `output_file`: name of output file

#### Command Line Options
- `-D X`, `--directory X`: Working data directory
- `--format X`: input and output data format
* `'csv'` (default)
* `'netCDF4'`
Expand Down
3 changes: 1 addition & 2 deletions doc/source/user_guide/compute_OPT_icebridge_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ compute_OPT_icebridge_data.py

#### Calling Sequence
```bash
python compute_OPT_icebridge_data.py --directory <path_to_directory> input_file
python compute_OPT_icebridge_data.py input_file
```
[Source code](https://github.com/tsutterley/pyTMD/blob/main/scripts/compute_OPT_icebridge_data.py)

#### Inputs
1. `input_file`: input ATM1B, ATM icessn or LVIS file from NSIDC

#### Command Line Options
- `-D X`, `--directory X`: Working data directory
- `-I X`, `--interpolate X`: Interpolation method
* `'spline'`
* `'linear'`
Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/compute_tides_ICESat2_ATL03.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ compute_tides_ICESat2_ATL03.py
==============================

- Calculates tidal elevations for correcting ICESat-2 photon height data
- Calculated at ATL03 segment level using reference photon geolocation and time
- Segment level corrections can be applied to the individual photon events (PEs)
- Can use OTIS format tidal solutions provided by Ohio State University and ESR
- Can use Global Tide Model (GOT) solutions provided by Richard Ray at GSFC
- Can use Finite Element Solution (FES) models provided by AVISO
Expand Down
70 changes: 70 additions & 0 deletions doc/source/user_guide/eop.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
======
eop.py
======

Utilities for maintaining Earth Orientation Parameter (EOP) files

- Syncs mean pole files with IERS servers
- Can calculate update mean pole files using data from IERS servers
- Syncs finals orientation files with IERS servers

`Source code`__

.. __: https://github.com/tsutterley/pyTMD/blob/main/pyTMD/eop.py


General Methods
===============


.. method:: pyTMD.eop.update_mean_pole(verbose=False, mode=0o775)

Connects to servers to download mean-pole.tab files from `IERS servers`__

.. __: ftp://hpiers.obspm.fr/iers/eop/eopc01/mean-pole.tab

Keyword arguments:

`verbose`: print file information about output file

`mode`: permissions mode of output file


.. method:: pyTMD.eop.calculate_mean_pole(verbose=False, mode=0o775)

Calculates the mean pole coordinates x and y are obtained by a Gaussian-weighted average of the `IERS pole coordinates`__

Follows ftp://hpiers.obspm.fr/iers/eop/eopc01/mean-pole.readme

.. __: ftp://ftp.iers.org/products/eop/long-term/c01/eopc01.1900-now.dat

Keyword arguments:

`verbose`: print file information about output file

`mode`: permissions mode of output file

Returns:

`T`: date [decimal-years]

`xm`: mean pole coordinate x [arcsec]

`ym`: mean pole coordinate y [arcsec]


.. method:: pyTMD.eop.update_finals_file(username=None, password=None, verbose=False, mode=0o775)

Connects to `servers`__ and downloads finals EOP files

.. __: ftp://cddis.nasa.gov/products/iers/

Keyword arguments:

`username`: NASA Earthdata username

`password`: NASA Earthdata password

`verbose`: print file information about output file

`mode`: permissions mode of output file
5 changes: 1 addition & 4 deletions notebooks/Plot Antarctic Tide Range.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
"import numpy as np\n",
"import matplotlib\n",
"matplotlib.rcParams['axes.linewidth'] = 2.0\n",
"matplotlib.rcParams[\"animation.html\"] = \"jshtml\"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.animation as animation\n",
"import cartopy.crs as ccrs\n",
"import ipywidgets as widgets\n",
"from IPython.display import HTML\n",
Expand All @@ -87,8 +85,7 @@
"#### Set parameters for program\n",
"\n",
"- Model directory \n",
"- Tide model \n",
"- Date to run "
"- Tide model "
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions pyTMD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Documentation is available at https://pytmd.readthedocs.io
"""
import pyTMD.eop
import pyTMD.time
import pyTMD.utilities
from pyTMD.bilinear_interp import bilinear_interp
Expand All @@ -19,21 +20,20 @@
from pyTMD.calc_delta_time import calc_delta_time
from pyTMD.calc_astrol_longitudes import calc_astrol_longitudes
from pyTMD.compute_equilibrium_tide import compute_equilibrium_tide
from pyTMD.compute_tide_corrections import compute_tide_corrections
from pyTMD.convert_ll_xy import convert_ll_xy
from pyTMD.iers_mean_pole import iers_mean_pole
from pyTMD.infer_minor_corrections import infer_minor_corrections
from pyTMD.load_constituent import load_constituent
from pyTMD.load_nodal_corrections import load_nodal_corrections
from pyTMD.output_otis_tides import output_otis_grid
from pyTMD.read_tide_model import extract_tidal_constants
from pyTMD.read_netcdf_model import extract_netcdf_constants
from pyTMD.read_GOT_model import extract_GOT_constants
from pyTMD.read_FES_model import extract_FES_constants
from pyTMD.predict_tidal_ts import predict_tidal_ts
from pyTMD.predict_tide_drift import predict_tide_drift
from pyTMD.predict_tide import predict_tide
from pyTMD.tidal_ellipse import tidal_ellipse
from pyTMD.calc_iers_mean_pole import calc_iers_mean_pole
from pyTMD.iers_mean_pole import iers_mean_pole
from pyTMD.read_iers_EOP import read_iers_EOP
from pyTMD.read_ocean_pole_tide import read_ocean_pole_tide
from pyTMD.output_otis_tides import output_otis_grid
from pyTMD.compute_tide_corrections import compute_tide_corrections
from pyTMD.tidal_ellipse import tidal_ellipse
69 changes: 0 additions & 69 deletions pyTMD/calc_iers_mean_pole.py

This file was deleted.

Loading

0 comments on commit 9c41a2c

Please sign in to comment.