Skip to content

Commit

Permalink
refactor: place PyYAML behind try/except statement to reduce build size
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutterley committed Aug 17, 2023
1 parent d5f3194 commit 238ad59
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v1.0.2.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`Release v1.0.2.7`__
####################

- Added download CATS2008 and read program check
- Added download `CATS2008` and read program check
- Added comparison with Antarctic tide gauges (AntTG) and RMS values from `King et al. (2011) <https://doi.org/10.1029/2011JC006949>`_
- Updated testing suite to directly call Matlab program through ``octave`` (and ``oct2py``)
- Will compare the python and matlab versions for most Antarctic station sites
Expand Down
4 changes: 2 additions & 2 deletions doc/source/release_notes/release-v1.0.2.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
`Release v1.0.2.9`__
####################

- added test for GOT models using perth3 outputs from GOT4.7
- GOT4.7 tide model data is stored on s3
- added test for GOT models using perth3 outputs from `GOT4.7`
- `GOT4.7` tide model data is stored on s3
- convert times for FES models to Dynamic time (`TT`)
- add equilibrium tide program
- add program for calculating equilibrium tides for Operation IceBridge
Expand Down
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v1.0.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- ``fix``: Operation IceBridge functions for geotrajectory outputs
- ``feat``: try to get grid mapping attributes from netCDF4 and HDF5
- ``refactor``: adjust longitude convention based on model longitude
- ``feat``: add TPXO9-atlas-v5 to standard models
- ``feat``: add `TPXO9-atlas-v5` to standard models
- ``feat``: add tide program for ATL10 freeboard files
- ``feat``: added function to calculate a tidal time series

Expand Down
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v1.0.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- ``feat``: added Greenland 1km model (`Gr1kmTM`) to list of models
- ``feat``: added field_mapping options to netCDF4 and HDF5 reads
- ``refactor``: changed keyword arguments to camel case
- ``refactor``: use pypi versions of ICESat-2 and ATM1b tools
- ``refactor``: use ``pypi`` versions of ICESat-2 and ATM1b tools
- ``docs``: add paragraph about delta times

.. __: https://github.com/tsutterley/pyTMD/releases/tag/1.0.7
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v1.1.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`Release v1.1.3`__
##################

- ``docs``: use sphinx-argparse v0.4.0
- ``docs``: use ``sphinx-argparse`` v0.4.0
- ``refactor``: use f-strings for ascii and verbose output
- ``chore``: automatic time and bulletin updates

Expand Down
4 changes: 2 additions & 2 deletions doc/source/release_notes/release-v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`Release v2.0.0`__
##################

- ``refactor``: single implicit import of pyTMD tools (`#130 <https://github.com/tsutterley/pyTMD/pull/130>`_)
- ``refactor``: single implicit import of ``pyTMD`` tools (`#130 <https://github.com/tsutterley/pyTMD/pull/130>`_)
- ``refactor``: reorganization of tide model readers under ``io`` (`#132 <https://github.com/tsutterley/pyTMD/pull/132>`_)
- ``refactor``: placed interpolation routines into new module (`#141 <https://github.com/tsutterley/pyTMD/pull/141>`_)
- ``refactor``: move ``model`` class to ``io``
Expand All @@ -15,7 +15,7 @@
- ``docs``: update documentation for new structure
- ``docs``: standardized citation format throughout docstrings
- ``docs``: add release notes for all prior public releases
- ``docs``: add new pyTMD logo
- ``docs``: add new ``pyTMD`` logo
- ``test``: read header from OPT test file and compare more variables
- ``test``: add tests for ``io`` methods

Expand Down
28 changes: 14 additions & 14 deletions doc/source/release_notes/release-v2.0.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
`Release v2.0.1`__
##################

* feat: default geotiff output as cog
* feat: added default field mapping for reading from netCDF4/HDF5 (`#152 <https://github.com/tsutterley/pyTMD/pull/152>`_)
* feat: split netCDF4 output for ``grid`` and ``drift`` types to address `#154 <https://github.com/tsutterley/pyTMD/issues/154>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* feat: use debug level logging instead of import warnings in ``tools.py`` to address `#156 <https://github.com/tsutterley/pyTMD/issues/156>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* feat: add ``time series`` type to address `#153 <https://github.com/tsutterley/pyTMD/discussions/153>`_ (`#162 <https://github.com/tsutterley/pyTMD/pull/162>`_)
* fix: verify warnings have type and only show once `#146 <https://github.com/tsutterley/pyTMD/issues/146>`_ (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* fix: pin ``scipy`` to 1.9.3 for `scipy/scipy#17716 <https://github.com/scipy/scipy/issues/17716>`_ (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* fix: use default context from ``utilities`` module (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* fix: include more possible dimension names for ``grid`` and ``time series`` outputs (`#163 <https://github.com/tsutterley/pyTMD/pull/163>`_)
* test: add default field mapping test (`#152 <https://github.com/tsutterley/pyTMD/pull/152>`_)
* test: validate gridded and time series netCDF/HDF5 io (`#163 <https://github.com/tsutterley/pyTMD/pull/163>`_)
* docs: update documentation colors to match new logo
* docs: don't have metavar for ``--tide`` to address `#155 <https://github.com/tsutterley/pyTMD/issues/155>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* docs: updated v2 link for Arc2km to address `#157 <https://github.com/tsutterley/pyTMD/issues/157>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* ``feat``: default geotiff output as cog
* ``feat``: added default field mapping for reading from netCDF4/HDF5 (`#152 <https://github.com/tsutterley/pyTMD/pull/152>`_)
* ``feat``: split netCDF4 output for ``grid`` and ``drift`` types to address `#154 <https://github.com/tsutterley/pyTMD/issues/154>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* ``feat``: use debug level logging instead of import warnings in ``tools.py`` to address `#156 <https://github.com/tsutterley/pyTMD/issues/156>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* ``feat``: add ``time series`` type to address `#153 <https://github.com/tsutterley/pyTMD/discussions/153>`_ (`#162 <https://github.com/tsutterley/pyTMD/pull/162>`_)
* ``fix``: verify warnings have type and only show once `#146 <https://github.com/tsutterley/pyTMD/issues/146>`_ (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* ``fix``: pin ``scipy`` to 1.9.3 for `scipy/scipy#17716 <https://github.com/scipy/scipy/issues/17716>`_ (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* ``fix``: use default context from ``utilities`` module (`#147 <https://github.com/tsutterley/pyTMD/pull/147>`_)
* ``fix``: include more possible dimension names for ``grid`` and ``time series`` outputs (`#163 <https://github.com/tsutterley/pyTMD/pull/163>`_)
* ``test``: add default field mapping test (`#152 <https://github.com/tsutterley/pyTMD/pull/152>`_)
* ``test``: validate gridded and time series netCDF/HDF5 io (`#163 <https://github.com/tsutterley/pyTMD/pull/163>`_)
* ``docs``: update documentation colors to match new logo
* ``docs``: don't have metavar for ``--tide`` to address `#155 <https://github.com/tsutterley/pyTMD/issues/155>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)
* ``docs``: updated v2 link for Arc2km to address `#157 <https://github.com/tsutterley/pyTMD/issues/157>`_ (`#159 <https://github.com/tsutterley/pyTMD/pull/159>`_)

.. __: https://github.com/tsutterley/pyTMD/releases/tag/2.0.1
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v2.0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`Release v2.0.2`__
##################

* ``chore``: bump scipy pin to 1.10.1 to address `#148 <https://github.com/tsutterley/pyTMD/issues/148>`_ (`#167 <https://github.com/tsutterley/pyTMD/pull/167>`_)
* ``chore``: bump ``scipy`` pin to 1.10.1 to address `#148 <https://github.com/tsutterley/pyTMD/issues/148>`_ (`#167 <https://github.com/tsutterley/pyTMD/pull/167>`_)
* ``refactor``: remove deprecated functions (`#171 <https://github.com/tsutterley/pyTMD/pull/171>`_)

.. __: https://github.com/tsutterley/pyTMD/releases/tag/2.0.2
4 changes: 2 additions & 2 deletions doc/source/release_notes/release-v2.0.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
* ``feat``: added option to change IERS mean or secular pole convention (`#176 <https://github.com/tsutterley/pyTMD/pull/176>`_)
* ``feat``: added 2018 IERS secular pole convention (`#176 <https://github.com/tsutterley/pyTMD/pull/176>`_)
* ``feat``: set ellipsoid name and output units as ``constants`` attributes (`#176 <https://github.com/tsutterley/pyTMD/pull/176>`_)
* ``feat``: add ``'HAMTIDE11'`` model to address `#179 <https://github.com/tsutterley/pyTMD/issues/179>`_ (`#180 <https://github.com/tsutterley/pyTMD/pull/180>`_)
* ``feat``: add `HAMTIDE11` model to address `#179 <https://github.com/tsutterley/pyTMD/issues/179>`_ (`#180 <https://github.com/tsutterley/pyTMD/pull/180>`_)
* ``feat``: adding work for computing solid earth tides (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``feat``: add solid Earth tide (SET) correction program for files (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``feat``: add function for phase angles (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``test``: add solid Earth tide (SET) checks vs IERS and ICESat-2 (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``refactor``: renamed coordinate reference system conversion functions (`#174 <https://github.com/tsutterley/pyTMD/pull/174>`_)
* ``refactor``: mapping notebooks for matplotlib 3.5 (`#182 <https://github.com/tsutterley/pyTMD/pull/182>`_)
* ``fix``: setting directories for ``FES`` currents within ``model`` class (`#182 <https://github.com/tsutterley/pyTMD/pull/182>`_)
* ``fix``: check if datetime before converting to seconds (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``fix``: check if ``datetime`` before converting to seconds (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``fix``: copy inputs in cartesian to not modify original arrays (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
* ``docs``: remove deprecated ``.rst`` files (`#174 <https://github.com/tsutterley/pyTMD/pull/174>`_)
* ``docs``: update documentation to denote new solid Earth tide (SET) functionality (`#186 <https://github.com/tsutterley/pyTMD/pull/186>`_)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v2.0.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* ``test``: add test for more derived attributes in model (`#188 <https://github.com/tsutterley/pyTMD/pull/188>`_)
* ``test``: parse all multiple file types for constituent names (`#190 <https://github.com/tsutterley/pyTMD/pull/190>`_)
* ``test``: test permanent tide conversion in solid earth (`#190 <https://github.com/tsutterley/pyTMD/pull/190>`_)
* ``test``: get IODEM3 from AWS s3 (NSIDC is currently down) (`#192 <https://github.com/tsutterley/pyTMD/pull/192>`_)
* ``test``: get `IODEM3` from AWS s3 (NSIDC is currently down) (`#192 <https://github.com/tsutterley/pyTMD/pull/192>`_)
* ``test``: add ``timescale`` checks for conversions and constants (`#198 <https://github.com/tsutterley/pyTMD/pull/198>`_)
* ``test``: add test for leap seconds in ``timescale`` (`#198 <https://github.com/tsutterley/pyTMD/pull/198>`_)

Expand Down
2 changes: 1 addition & 1 deletion doc/source/release_notes/release-v2.0.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* ``feat``: add functions to retrieve and revoke Earthdata tokens (`#209 <https://github.com/tsutterley/pyTMD/pull/209>`_)
* ``fix``: don't set a default directory in ``tools`` for `#202 <https://github.com/tsutterley/pyTMD/issues/202>`_ (`#203 <https://github.com/tsutterley/pyTMD/pull/203>`_)
* ``fix``: setting path to output file in scripts where not defined as an argument
* ``fix``: extract variables for FES2012 ocean tide (`#212 <https://github.com/tsutterley/pyTMD/pull/212>`_)
* ``fix``: extract variables for `FES2012` ocean tide (`#212 <https://github.com/tsutterley/pyTMD/pull/212>`_)
* ``docs``: update solid earth section (`#205 <https://github.com/tsutterley/pyTMD/pull/205>`_)
* ``test``: add a time zone case to parsing (`#203 <https://github.com/tsutterley/pyTMD/pull/203>`_)

Expand Down
5 changes: 3 additions & 2 deletions doc/source/release_notes/release-v2.0.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
`Release v2.0.7`__
##################

* ``feat``: added model parameters for CATS2008-v2023 (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``refactor``: changed ESR netCDF4 format to TMD3 format (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``feat``: added model parameters for `CATS2008-v2023` (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``refactor``: changed ``ESR`` netCDF4 format to ``TMD3`` format (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``refactor``: place more imports behind try/except statements to reduce RTD build size (`#230 <https://github.com/tsutterley/pyTMD/pull/230>`_)
* ``fix``: remove possible `crs` variables from output netCDF4 fields list (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``ci``: bump actions to python 3.11 (`#229 <https://github.com/tsutterley/pyTMD/pull/229>`_)
* ``docs``: `switch to RTD <https://blog.readthedocs.com/use-build-os-config/>`_ ``build.os`` configuration (`#230 <https://github.com/tsutterley/pyTMD/pull/230>`_)
Expand Down
6 changes: 5 additions & 1 deletion pyTMD/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
UPDATE HISTORY:
Updated 08/2023: remove possible crs variables from output fields list
place PyYAML behind try/except statement to reduce build size
Updated 05/2023: use datetime parser within pyTMD.time module
Updated 04/2023: copy inputs in cartesian to not modify original arrays
added iterative methods for converting from cartesian to geodetic
Expand Down Expand Up @@ -70,7 +71,6 @@
import copy
import gzip
import uuid
import yaml
import logging
import pathlib
import datetime
Expand All @@ -91,6 +91,10 @@
import netCDF4
except (ImportError, ModuleNotFoundError) as exc:
logging.debug("netCDF4 not available")
try:
import yaml
except (ImportError, ModuleNotFoundError) as exc:
logging.debug("PyYAML not available")

def case_insensitive_filename(filename: str | pathlib.Path):
"""
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ netCDF4
numpy
pyproj
python-dateutil
pyyaml
scipy>=1.10.1
setuptools_scm

0 comments on commit 238ad59

Please sign in to comment.