Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep: drop matplotlib #69

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
command: |
export PYTHONUNBUFFERED=1
# install dependencies and source code
mamba install --verbose --yes fortran-compiler --file ${PYSOLID_HOME}/requirements.txt
mamba install --verbose --yes fortran-compiler --file ${PYSOLID_HOME}/requirements.txt --file ${PYSOLID_HOME}/tests/requirements.txt
python -m pip install ${PYSOLID_HOME}

- run:
Expand Down
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# extra dependencies required for running notebooks
cartopy
matplotlib
mintpy
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ classifiers=[
dependencies = [
"numpy",
"scipy",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something we might try after this PR: you can specify the dependencies dynamically with newer setuptool. I didn't include it since I wasn't sure how it would interact with PySold's current setuptools version pinning

https://github.com/opera-adt/dolphin/blob/main/pyproject.toml#L23-L34

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this dynamic dependencies setup a lot, it makes a lot of sense.

"matplotlib",
]
dynamic = ["version"]

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# for running
numpy
scipy
matplotlib
# for packaging and installation
#fortran-compiler # Fortran compiler across platforms through conda-forge channel
pip
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def readme():
install_requires=[
"numpy",
"scipy",
"matplotlib",
],

# package discovery
Expand Down
17 changes: 10 additions & 7 deletions src/pysolid/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import os

import numpy as np
from matplotlib import pyplot as plt, ticker, dates as mdates
from scipy import signal


## Tidal constituents
Expand Down Expand Up @@ -94,10 +92,10 @@ def calc_solid_earth_tides_point(lat, lon, dt0, dt1, step_sec=60, display=False,
"""

print('PYSOLID: calculate solid Earth tides in east/north/up direction')
print('PYSOLID: lot/lon: {}/{} degree'.format(lat, lon))
print('PYSOLID: start UTC: {}'.format(dt0.isoformat()))
print('PYSOLID: end UTC: {}'.format(dt1.isoformat()))
print('PYSOLID: time step: {} seconds'.format(step_sec))
print(f'PYSOLID: lot/lon: {lat}/{lon} degree')
print(f'PYSOLID: start UTC: {dt0.isoformat()}')
print(f'PYSOLID: end UTC: {dt1.isoformat()}')
print(f'PYSOLID: time step: {step_sec} seconds')

dt_out = []
tide_e = []
Expand All @@ -108,7 +106,7 @@ def calc_solid_earth_tides_point(lat, lon, dt0, dt1, step_sec=60, display=False,
for i in range(ndays):
di = dt0.date() + dt.timedelta(days=i)
if verbose:
print('SOLID : {} {}/{} ...'.format(di.isoformat(), i+1, ndays))
print(f'SOLID : {di.isoformat()} {i+1}/{ndays} ...')

# calc tide_u/n/u for the whole day
(dt_outi,
Expand Down Expand Up @@ -185,6 +183,8 @@ def calc_solid_earth_tides_point_per_day(lat, lon, date_str, step_sec=60):
def plot_solid_earth_tides_point(dt_out, tide_e, tide_n, tide_u, lalo=None,
out_fig=None, save=False, display=True):
"""Plot the solid Earth tides at one point."""
from matplotlib import pyplot as plt, dates as mdates

# plot
fig, axs = plt.subplots(nrows=3, ncols=1, figsize=[6, 4], sharex=True)
for ax, data, label in zip(axs.flatten(),
Expand Down Expand Up @@ -227,6 +227,9 @@ def plot_power_spectral_density4tides(tide_ts, sample_spacing, out_fig=None, fig
"""Plot the power spectral density (PSD) of tides time-series.
Note: for accurate PSD analysis, a long time-series, e.g. one year, is recommended.
"""
from matplotlib import pyplot as plt, ticker
from scipy import signal

## calc PSD
freq, psd = signal.periodogram(tide_ts, fs=1/sample_spacing, scaling='density')
# get rid of zero in the first element
Expand Down
2 changes: 2 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# extra dependency required for testing
matplotlib