Skip to content

Commit 6c12499

Browse files
authored
wrap up for version 0.2.2 (#34)
+ `version.py`: add release tag for v0.2.2 * `__init__`: explicit list of top-level functions + `tests`: remove "test_SET_" prefix for the testing scripts, to reflect the same naming in the src directory. + `tests`: add `__main__` function in the testing scripts. + `circleci/README`: update the new testing script names
1 parent 9a0ce9a commit 6c12499

File tree

10 files changed

+121
-110
lines changed

10 files changed

+121
-110
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ jobs:
6363
# setup environment variables
6464
export PATH=${CONDA_PREFIX}/bin:${PATH}
6565
# run tests
66-
python ${HOME}/tools/PySolid/tests/test_SET_point.py
67-
python ${HOME}/tools/PySolid/tests/test_SET_grid.py
66+
python ${HOME}/tools/PySolid/tests/point.py
67+
python ${HOME}/tools/PySolid/tests/grid.py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
*.DS_Store
2-
tests/*.png
2+
tests/*/*.png
33
solid.txt
44

55
# Byte-compiled / optimized / DLL files

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ To test the installation, run the following:
7171

7272
```bash
7373
python -c "import pysolid; print(pysolid.__version__)"
74-
python PySolid/tests/test_SET_grid.py
75-
python PySolid/tests/test_SET_point.py
74+
python PySolid/tests/grid.py
75+
python PySolid/tests/point.py
7676
```
7777

7878
### 2. Usage

setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@
3333
"Topic :: Scientific/Engineering",
3434
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
3535
"Operating System :: OS Independent",
36-
"Programming Language :: Python",
3736
"Programming Language :: Python :: 3",
38-
"Programming Language :: Python :: 3.6",
39-
"Programming Language :: Python :: 3.7",
40-
"Programming Language :: Python :: 3.8",
41-
"Programming Language :: Python :: 3.9",
4237
],
4338
keywords="solid Eartth tides, deformation, geodesy, geophysics",
4439

src/pysolid/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
from pysolid.grid import *
2-
from pysolid.point import *
3-
41
# get version info
5-
from pysolid.version import *
6-
__version__ = release_version
2+
from pysolid.version import release_version as __version__
3+
4+
# top-level functions
5+
from pysolid.grid import (
6+
calc_solid_earth_tides_grid,
7+
plot_solid_earth_tides_grid,
8+
)
9+
from pysolid.point import (
10+
TIDES,
11+
calc_solid_earth_tides_point,
12+
plot_solid_earth_tides_point,
13+
plot_power_spectral_density4tides,
14+
)

src/pysolid/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# release history
99
Tag = collections.namedtuple('Tag', 'version date')
1010
release_history = (
11+
Tag('0.2.2', '2022-07-20'),
1112
Tag('0.2.1', '2022-01-05'),
1213
Tag('0.2.0', '2021-11-10'),
1314
Tag('0.1.2', '2021-02-24'),

tests/grid.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python3
2+
# Author: Zhang Yunjun, Jan 2021
3+
# Copyright 2020, by the California Institute of Technology.
4+
5+
6+
import os
7+
import sys
8+
import datetime as dt
9+
10+
import pysolid
11+
12+
13+
if __name__ == '__main__':
14+
15+
# print the file/module path
16+
print('-'*50)
17+
print(os.path.abspath(__file__))
18+
19+
# prepare inputs
20+
dt_obj = dt.datetime(2020, 12, 25, 14, 7, 44)
21+
atr = {
22+
'LENGTH' : 400,
23+
'WIDTH' : 500,
24+
'X_FIRST' : -118.2,
25+
'Y_FIRST' : 33.8,
26+
'X_STEP' : 0.000833333,
27+
'Y_STEP' : -0.000833333,
28+
}
29+
30+
# calculate
31+
(tide_e,
32+
tide_n,
33+
tide_u) = pysolid.calc_solid_earth_tides_grid(dt_obj, atr, verbose=True)
34+
35+
# plot
36+
out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pic'))
37+
os.makedirs(out_dir, exist_ok=True)
38+
39+
out_fig = os.path.join(out_dir, 'grid.png')
40+
pysolid.plot_solid_earth_tides_grid(
41+
tide_e, tide_n, tide_u, dt_obj,
42+
out_fig=out_fig,
43+
display=False)
44+
45+
# open the plotted figures
46+
if sys.platform in ['linux']:
47+
os.system(f'display {out_fig}')
48+
elif sys.platform in ['darwin']:
49+
os.system(f'open {out_fig}')
50+
elif sys.platform.startswith('win'):
51+
os.system(out_fig)
52+
else:
53+
print(f'Unknown OS system ({sys.platform}). Check results in file: {out_fig}.')

tests/point.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python3
2+
# Author: Zhang Yunjun, Jan 2021
3+
# Copyright 2020, by the California Institute of Technology.
4+
5+
6+
import os
7+
import sys
8+
import datetime as dt
9+
10+
import pysolid
11+
12+
13+
if __name__ == '__main__':
14+
15+
# print the file/module path
16+
print('-'*50)
17+
print(os.path.abspath(__file__))
18+
19+
# prepare inputs
20+
lat, lon = 34.0, -118.0 # Los Angles, CA
21+
dt_obj0 = dt.datetime(2020, 11, 1, 4, 0, 0)
22+
dt_obj1 = dt.datetime(2020, 12, 31, 2, 0, 0)
23+
24+
# calculate
25+
(dt_out,
26+
tide_e,
27+
tide_n,
28+
tide_u) = pysolid.calc_solid_earth_tides_point(lat, lon, dt_obj0, dt_obj1, verbose=False)
29+
30+
# plot
31+
out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pic'))
32+
os.makedirs(out_dir, exist_ok=True)
33+
34+
out_fig = os.path.join(out_dir, 'point.png')
35+
pysolid.plot_solid_earth_tides_point(
36+
dt_out, tide_e, tide_n, tide_u,
37+
lalo=[lat, lon],
38+
out_fig=out_fig,
39+
display=False)
40+
41+
# open the saved figure
42+
if sys.platform in ['linux']:
43+
os.system(f'display {out_fig}')
44+
elif sys.platform in ['darwin']:
45+
os.system(f'open {out_fig}')
46+
elif sys.platform.startswith('win'):
47+
os.system(out_fig)
48+
else:
49+
print(f'Unknown OS system ({sys.platform}). Check results in file: {out_fig}.')

tests/test_SET_grid.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

tests/test_SET_point.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)