Skip to content
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
17 changes: 16 additions & 1 deletion .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
tags:
- v*

# activate miniconda environment
# link: https://github.com/marketplace/actions/provision-with-micromamba#IMPORTANT
defaults:
run:
shell: bash -l {0}

jobs:
build-n-publish:
if: github.repository_owner == 'insarlab'
Expand All @@ -24,6 +30,12 @@ jobs:
with:
python-version: "3.10"

# link: https://github.com/marketplace/actions/provision-with-micromamba
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: environment.yml

- name: Install pypa/build
run: >-
python -m
Expand All @@ -36,9 +48,12 @@ jobs:
python -m
build
--sdist
--wheel
--no-isolation # not install in an isolated environment
--outdir dist/
.
# skip due to the bad request error from pypi:
# binary wheel has an unsupported platform tag 'linux_x86_64'
#--wheel

- name: Publish developed version 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# because a Fortran compiler is required but not available via pip


import os
import sys

# always prefer setuptools over distutils
import setuptools
from numpy.distutils.core import setup, Extension

# Grab from version.py file: version
# Note by Yunjun, Oct 2022: do not use sys.path.append() to import pysolid because
# pysolid.__init__ requires the pysolid.solid sub-module, which is not compiled yet.
with open("src/pysolid/version.py", "r") as f:
lines = f.readlines()
line = [line for line in lines if line.strip().startswith("Tag(")][0].strip()
version = line.replace("'",'"').split('"')[1]
# Grab from pysolid.version: version
# link: https://stackoverflow.com/questions/53648900
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
from pysolid.version import version

# Grab from README file: long_description
with open("README.md", "r") as f:
Expand Down
19 changes: 10 additions & 9 deletions src/pysolid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@
# pysolid.calc_solid_earth_tides_grid()


import datetime as dt
import os

import numpy as np
import datetime as dt
from skimage.transform import resize

try:
from pysolid.solid import solid_grid
except ImportError:
msg = "Cannot import name 'solid' from 'pysolid'!"
msg += '\n Maybe solid.for is NOT compiled yet.'
msg += '\n Check instruction at: https://github.com/insarlab/PySolid.'
raise ImportError(msg)


################################## Earth tides - grid mode ###################################
def calc_solid_earth_tides_grid(dt_obj, atr, step_size=1e3, display=False, verbose=True):
Expand All @@ -49,6 +42,14 @@ def calc_solid_earth_tides_grid(dt_obj, atr, step_size=1e3, display=False, verbo
Examples: atr = readfile.read_attribute('geo_velocity.h5')
tide_e, tide_n, tide_u = calc_solid_earth_tides_grid('20180219', atr)
"""
try:
from pysolid.solid import solid_grid
except ImportError:
msg = "Cannot import name 'solid' from 'pysolid'!"
msg += '\n Maybe solid.for is NOT compiled yet.'
msg += '\n Check instruction at: https://github.com/insarlab/PySolid.'
raise ImportError(msg)

vprint = print if verbose else lambda *args, **kwargs: None

# location
Expand Down
20 changes: 10 additions & 10 deletions src/pysolid/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@
# pysolid.calc_solid_earth_tides_point()


import os
import collections
import datetime as dt
import os

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

try:
from pysolid.solid import solid_point
except ImportError:
msg = "Cannot import name 'solid' from 'pysolid'!"
msg += '\n Maybe solid.for is NOT compiled yet.'
msg += '\n Check instruction at: https://github.com/insarlab/PySolid.'
raise ImportError(msg)
from scipy import signal


## Tidal constituents
Expand Down Expand Up @@ -168,6 +161,13 @@ def calc_solid_earth_tides_point_per_day(lat, lon, date_str, step_sec=60):
tide_n,
tide_u) = calc_solid_earth_tides_point_per_day(34.0, -118.0, '20180219')
"""
try:
from pysolid.solid import solid_point
except ImportError:
msg = "Cannot import name 'solid' from 'pysolid'!"
msg += '\n Maybe solid.for is NOT compiled yet.'
msg += '\n Check instruction at: https://github.com/insarlab/PySolid.'
raise ImportError(msg)

## calc solid Earth tides and write to text file
txt_file = os.path.abspath('solid.txt')
Expand Down
6 changes: 3 additions & 3 deletions src/pysolid/solid.for
Original file line number Diff line number Diff line change
Expand Up @@ -1549,9 +1549,9 @@
***** http://www.csgnetwork.com/julianmodifdateconv.html

implicit double precision(a-h,o-z)
!*** upper limit, leap second table, 2022dec28
!*** upper limit, leap second table, 2023jun28
!*** lower limit, leap second table, 1972jan01
parameter(MJDUPPER=59941)
parameter(MJDUPPER=60123)
parameter(MJDLOWER=41317)

!*** leap second table limit flag
Expand Down Expand Up @@ -1632,7 +1632,7 @@
***** other leap second references at:
***** http://hpiers.obspm.fr/eoppc/bul/bulc/Leap_Second_History.dat
***** http://hpiers.obspm.fr/eoppc/bul/bulc/bulletinc.dat
***** File expires on 28 December 2022
***** File expires on 28 June 2023

*** test against newest leaps first

Expand Down
1 change: 1 addition & 0 deletions src/pysolid/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# release history
Tag = collections.namedtuple('Tag', 'version date')
release_history = (
Tag('0.2.3', '2022-10-23'),
Tag('0.2.2', '2022-07-20'),
Tag('0.2.1', '2022-01-05'),
Tag('0.2.0', '2021-11-10'),
Expand Down