Skip to content

Commit

Permalink
bugfix: change handling of version (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwrnke committed Jan 17, 2024
1 parent 36dabf1 commit 98026f6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 35 deletions.
39 changes: 24 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# tpxo-tide-prediction - Changelog

## v0.2.5 (2024-01-18)

Fixed issue #8 with `VERSION` file.

## v0.2.4 (2023-01-31)

Fixed issues #1 and #2

## v0.2.3 (2022-10-17)

Release for Zenodo DOI.
No futher code changes.

Expand All @@ -15,8 +24,8 @@ Minor bugfix.
### Changed

- `utils.py`
- `subset_region()`:
- fix indexing when both minimum and maximum longitude are in between two grid nodes of loaded constituent netCDF files
- `subset_region()`:
- fix indexing when both minimum and maximum longitude are in between two grid nodes of loaded constituent netCDF files

## v0.2.1 (2022-06-02)

Expand All @@ -25,11 +34,11 @@ Minor bugfixes.
### Changed

- `predict_tide.py`
- `read_parameter_file()`
- fix error after parsing single time input from command line
- `read_parameter_file()`
- fix error after parsing single time input from command line
- `utils.py`
- `subset_region()`:
- selecting only single position
- `subset_region()`:
- selecting only single position

## v0.2.0 (2022-04-24)

Expand All @@ -44,16 +53,16 @@ Changed interpolation method from _cubic_ to _linear_ (according to [xarray.Data
### Changed

- `predict_tide.py`
- changed default interpolation method to *linear*
- raise `MemoryError` if interpolated tide array is too huge to allocate
- use **only** associated timestamp for tide predition if `mode = 'track'` (more efficient!)
- changed default interpolation method to *linear*
- raise `MemoryError` if interpolated tide array is too huge to allocate
- use **only** associated timestamp for tide predition if `mode = 'track'` (more efficient!)
- `utils.py`
- `subset_region()`:
- reworked indexing method
- changed default number of nodes to pad subset region from 10 to **3**
- `read_h_netCDFs()`:
- changed subset selection from _labeled_ (`.sel`) to _integer-based_ (`.isel`)
- changed default number of nodes to pad subset region from 10 to **3**
- `subset_region()`:
- reworked indexing method
- changed default number of nodes to pad subset region from 10 to **3**
- `read_h_netCDFs()`:
- changed subset selection from _labeled_ (`.sel`) to _integer-based_ (`.isel`)
- changed default number of nodes to pad subset region from 10 to **3**

## v0.1.1 (2022-02-27)

Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

25 changes: 8 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@
import setuptools

def read(fname, mode='r', encoding='utf-8'):
""" Wrapper for open() """
return open(os.path.join(os.path.dirname(__file__), fname),
mode=mode,
encoding=encoding)
"""Wrap open() function."""
return open(os.path.join(os.path.dirname(__file__), 'tpxo_tide_prediction', fname), mode=mode, encoding=encoding)

def get_version(fname='VERSION'):
""" Retrieve package version from VERSION file """
try:
with read(fname) as f:
version = f.read()
return version
except FileNotFoundError:
raise RuntimeError('Unable to find version string in file "VERSION"')

with read('README.md') as f:
with open('README.md') as f:
long_description = f.read()

# print(get_version())
VERSION = {}
with read('_version.py') as fp:
exec(fp.read(), VERSION)

setuptools.setup(
name='tpxo-tide-prediction',
version=get_version(),
version=VERSION['__version__'],
author='Fynn Warnke',
author_email='[email protected]',
description='Predict tidal elevation based on TPXO9-atlas model',
Expand Down Expand Up @@ -55,4 +46,4 @@ def get_version(fname='VERSION'):
'predict_tide=tpxo_tide_prediction.predict_tide:main',
],
},
)
)
3 changes: 1 addition & 2 deletions tpxo_tide_prediction/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os # noqa
from ._version import __version__ # noqa
from .predict_tide import ( # noqa
read_parameter_file,
tide_predict,
write_tides
)

__version__ = open(os.path.join(os.path.dirname(__file__), '../VERSION')).read().rstrip('\n')
1 change: 1 addition & 0 deletions tpxo_tide_prediction/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.2.5'

0 comments on commit 98026f6

Please sign in to comment.