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

feat: add widget for setting endpoint for accessing PODAAC data #145

Merged
merged 1 commit into from
Apr 15, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/auto-update-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest'
environment-file: environment.yml
environment-file: .binder/environment.yml
init-shell: bash
environment-name: timescale
environment-name: gravity_toolkit
cache-environment: true
post-cleanup: 'all'
create-args: >-
Expand Down
19 changes: 19 additions & 0 deletions doc/source/api_reference/plot_GrIS_grid_5maps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
=======================
plot_GrIS_grid_5maps.py
=======================

- Creates 5 GMT-like plots for the Greenland Ice Sheet on a NSIDC polar stereographic north (3413) projection

`Source code`__

.. __: https://github.com/tsutterley/gravity-toolkit/blob/main/scripts/plot_GrIS_grid_5maps.py

Calling Sequence
################

.. argparse::
:filename: plot_GrIS_grid_5maps.py
:func: arguments
:prog: plot_GrIS_grid_5maps.py
:nodescription:
:nodefault:
6 changes: 6 additions & 0 deletions doc/source/api_reference/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ General Methods

.. autofunction:: gravity_toolkit.utilities.from_ftp

.. autofunction:: gravity_toolkit.utilities._create_default_ssl_context

.. autofunction:: gravity_toolkit.utilities._create_ssl_context_no_verify

.. autofunction:: gravity_toolkit.utilities._set_ssl_context_options

.. autofunction:: gravity_toolkit.utilities.check_connection

.. autofunction:: gravity_toolkit.utilities.http_list
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@ missions
api_reference/plot_global_grid_movie.rst
api_reference/plot_GrIS_grid_maps.rst
api_reference/plot_GrIS_grid_3maps.rst
api_reference/plot_GrIS_grid_5maps.rst
api_reference/plot_GrIS_grid_movie.rst
api_reference/quick_mascon_plot.rst
2 changes: 1 addition & 1 deletion gravity_toolkit/SLR/C20.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

# PURPOSE: read oblateness data from Satellite Laser Ranging (SLR)
def C20(SLR_file, AOD=True, HEADER=True):
"""
r"""
Reads *C*\ :sub:`20` spherical harmonic coefficients from SLR measurements

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/SLR/C30.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

# PURPOSE: read Degree 3 zonal data from Satellite Laser Ranging (SLR)
def C30(SLR_file, C30_MEAN=9.5717395773300e-07, HEADER=True):
"""
r"""
Reads *C*\ :sub:`30` spherical harmonic coefficients from SLR measurements

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/SLR/C40.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

# PURPOSE: read Degree 4 zonal data from Satellite Laser Ranging (SLR)
def C40(SLR_file, C40_MEAN=0.0, DATE=None, **kwargs):
"""
r"""
Reads *C*\ :sub:`40` spherical harmonic coefficients from SLR measurements

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/SLR/C50.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

# PURPOSE: read Degree 5 zonal data from Satellite Laser Ranging (SLR)
def C50(SLR_file, C50_MEAN=0.0, DATE=None, HEADER=True):
"""
r"""
Reads *C*\ :sub:`50` spherical harmonic coefficients from SLR measurements

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/SLR/CS2.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

# PURPOSE: read Degree 2,m data from Satellite Laser Ranging (SLR)
def CS2(SLR_file, ORDER=1, DATE=None, HEADER=True):
"""
r"""
Reads *C*\ :sub:`2m` and *S*\ :sub:`2m` spherical harmonic coefficients
from SLR measurements

Expand Down
4 changes: 2 additions & 2 deletions gravity_toolkit/clenshaw_summation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def clenshaw_summation(clm, slm, lon, lat,
ASTYPE=np.longdouble,
SCALE=1e-280
):
"""
r"""
Calculates the spatial field for a series of spherical harmonics for a
sequence of ungridded points

Expand Down Expand Up @@ -143,7 +143,7 @@ def clenshaw_summation(clm, slm, lon, lat,

# check if lat and lon are the same size
if (len(lat) != len(lon)):
raise ValueError('Incompatable vector dimensions (lon, lat)')
raise ValueError('Incompatible vector dimensions (lon, lat)')

# calculate colatitude and longitude in radians
th = (90.0 - lat)*np.pi/180.0
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/gen_averaging_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

def gen_averaging_kernel(gclm, gslm, eclm, eslm, sigma, hw,
LMAX=60, MMAX=None, CUTOFF=1e-15, UNITS=0, LOVE=None):
"""
r"""
Generates averaging kernel coefficients which minimize the
total error following [Swenson2002]_

Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/gen_disc_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

def gen_disc_load(data, lon, lat, area, LMAX=60, MMAX=None, UNITS=2,
PLM=None, LOVE=None):
"""
r"""
Calculates spherical harmonic coefficients for a uniform disc load

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/gen_spherical_cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

def gen_spherical_cap(data, lon, lat, LMAX=60, MMAX=None,
AREA=0, RAD_CAP=0, RAD_KM=0, UNITS=1, PLM=None, LOVE=None):
"""
r"""
Calculates spherical harmonic coefficients for a spherical cap

Parameters
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/gen_stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

def gen_stokes(data, lon, lat, LMIN=0, LMAX=60, MMAX=None, UNITS=1,
PLM=None, LOVE=None):
"""
r"""
Converts data from the spatial domain to spherical harmonic coefficients

Parameters
Expand Down
4 changes: 2 additions & 2 deletions gravity_toolkit/geocenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def from_UCI(self, geocenter_file, **kwargs):
# find numerical instances in line including integers, exponents,
# decimal points and negatives
line_contents = rx.findall(line)
# extacting mid-date time and GRACE/GRACE-FO "month"
# extracting mid-date time and GRACE/GRACE-FO "month"
DEG1['time'][t] = np.float64(line_contents[0])
DEG1['month'][t] = np.int64(line_contents[-1])
# calculate mid-date as Julian dates
Expand Down Expand Up @@ -608,7 +608,7 @@ def from_swenson(self, geocenter_file, **kwargs):
# decimal points and negatives
line_contents = rx.findall(line)

# extacting time
# extracting time
self.time[t]=np.float64(line_contents[0])
# extracting spherical harmonics and convert to cmwe
self.C10[t]=0.1*np.float64(line_contents[1])
Expand Down
6 changes: 3 additions & 3 deletions gravity_toolkit/grace_input_months.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
grace_input_months.py
Written by Tyler Sutterley (05/2023)
Written by Tyler Sutterley (10/2023)
Contributions by Hugo Lecomte and Yara Mohajerani

Reads GRACE/GRACE-FO files for a specified spherical harmonic degree and order
Expand Down Expand Up @@ -109,6 +109,7 @@
read_gfc_harmonics.py: reads spherical harmonic data from gfc files

UPDATE HISTORY:
Updated 10/2023: standardize ocean model for UCI degree 1 coefficients
Updated 05/2023: use pathlib to define and operate on paths
Updated 04/2023: use release-03 GFZ GravIS SLR and geocenter files
Updated 03/2023: added attributes for input files and corrections
Expand Down Expand Up @@ -661,8 +662,7 @@ def grace_input_months(base_dir, PROC, DREL, DSET, LMAX, start_mon, end_mon,
elif DEG1 in ('SLF','UCI'):
# degree one files from Sutterley and Velicogna (2019)
# default: iterated and with self-attraction and loading effects
MODEL = dict(RL04='OMCT', RL05='OMCT', RL06='MPIOM')
args = (PROC,DREL,MODEL[DREL],'SLF_iter')
args = (PROC, DREL, 'MPIOM', 'SLF_iter')
default_geocenter = base_dir.joinpath('geocenter',
'{0}_{1}_{2}_{3}.txt'.format(*args))
# read degree one files from Sutterley and Velicogna (2019)
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/harmonic_gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def harmonic_gradients(clm1, slm1, lon, lat,
def geostrophic_currents(clm1, slm1, lon, lat,
LMIN=0, LMAX=60, MMAX=None, RAD=0,
DENSITY=1.035, LOVE=None, PLM=None):
"""
r"""
Converts data from spherical harmonic coefficients to a
spatial fields of ocean geostrophic currents following
[Wahr2002]_
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/harmonic_summation.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def harmonic_transform(clm1, slm1, lon, lat,

def stokes_summation(clm1, slm1, lon, lat,
LMIN=0, LMAX=60, MMAX=None, RAD=0, UNITS=0, LOVE=None, PLM=None):
"""
r"""
Converts data from spherical harmonic coefficients to a spatial field

Parameters
Expand Down
11 changes: 8 additions & 3 deletions gravity_toolkit/harmonics.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
harmonics.py
Written by Tyler Sutterley (09/2023)
Written by Tyler Sutterley (10/2023)
Contributions by Hugo Lecomte

Spherical harmonic data class for processing GRACE/GRACE-FO Level-2 data
Expand All @@ -25,6 +25,7 @@
destripe_harmonics.py: filters spherical harmonics for correlated errors

UPDATE HISTORY:
Updated 10/2023: place time and month variables in try/except block
Updated 09/2023: prevent double printing of filenames when using debug
Updated 08/2023: add string representation of the harmonics object
Updated 06/2023: fix GRACE/GRACE-FO months in drift function
Expand Down Expand Up @@ -1910,12 +1911,16 @@ def __next__(self):
"""
temp = harmonics(lmax=np.copy(self.lmax), mmax=np.copy(self.mmax))
try:
temp.time = self.time[self.__index__].copy()
temp.month = self.month[self.__index__].copy()
temp.clm = self.clm[:,:,self.__index__].copy()
temp.slm = self.slm[:,:,self.__index__].copy()
except IndexError as exc:
raise StopIteration from exc
# subset output spatial time and month
try:
temp.time = self.time[self.__index__].copy()
temp.month = self.month[self.__index__].copy()
except AttributeError as exc:
pass
# subset filename if applicable
if getattr(self, 'filename'):
if isinstance(self.filename, (list, tuple, np.ndarray)):
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/read_GIA_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
convert shape and ndim to harmonic class properties
improve typing for variables in docstrings
Updated 02/2023: use monospaced text for harmonics objects in gia docstring
Updated 12/2022: made interited GIA model harmonics class
Updated 12/2022: made inherited GIA model harmonics class
set default parameters, title, reference and url as None
Updated 11/2022: use f-strings for formatting verbose or ascii output
Updated 09/2022: use logging for debugging level verbose output
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/read_SLR_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def read_CSR_monthly_6x1(SLR_file, SCALE=1e-10, HEADER=True):

# PURPOSE: read weekly degree harmonic data from Satellite Laser Ranging (SLR)
def read_GSFC_weekly_6x1(SLR_file, SCALE=1.0, HEADER=True):
"""
r"""
Reads weekly 5x5 spherical harmonic coefficients with 1 coefficient from
degree 6 calculated from satellite laser ranging measurements

Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/read_gfc_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
Updated 05/2021: Add GRAZ/Swarm/COST-G ICGEM file
Updated 03/2021: made degree of truncation LMAX a keyword argument
Updated 07/2020: added function docstrings
Updated 07/2019: split read and wrapper funciton into separate files
Updated 07/2019: split read and wrapper function into separate files
Updated 07/2017: include parameters to change the tide system
Written 12/2015
"""
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/read_love_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def read_love_numbers(love_numbers_file, LMAX=None, HEADER=2,
def love_number_formatter(love, FORMAT='tuple'):
"""
Converts a dictionary of Load Love/Shida Numbers
to a particular output fomrat
to a particular output format

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/sea_level_equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
CALLING SEQUENCE:
sea_level = sea_level_equation(loadClm, loadSlm, glon, glat, landmask,
LMAX=LMAX, LOVE=(hl,kl,ll), BODY_TIDE_LOVE=0, FLUID_LOVE=0, POLAR=True,
INTERATIONS=6, FILL_VALUE=0)
ITERATIONS=6, FILL_VALUE=0)

INPUTS:
loadClm: input set of cosine spherical harmonics
Expand Down
11 changes: 8 additions & 3 deletions gravity_toolkit/spatial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
u"""
spatial.py
Written by Tyler Sutterley (09/2023)
Written by Tyler Sutterley (10/2023)

Data class for reading, writing and processing spatial data

Expand All @@ -20,6 +20,7 @@
time.py: utilities for calculating time operations

UPDATE HISTORY:
Updated 10/2023: place time and month variables in try/except block
Updated 09/2023: prevent double printing of filenames when using debug
Updated 08/2023: add string representation of the spatial object
Updated 05/2023: use pathlib to define and operate on paths
Expand Down Expand Up @@ -1731,10 +1732,14 @@ def __next__(self):
try:
temp.data = self.data[:,:,self.__index__].copy()
temp.mask = self.mask[:,:,self.__index__].copy()
temp.time = self.time[self.__index__].copy()
temp.month = self.month[self.__index__].copy()
except IndexError as exc:
raise StopIteration from exc
# subset output spatial time and month
try:
temp.time = self.time[self.__index__].copy()
temp.month = self.month[self.__index__].copy()
except AttributeError as exc:
pass
# subset output spatial error
try:
temp.error = self.error[:,:,self.__index__].copy()
Expand Down
9 changes: 8 additions & 1 deletion gravity_toolkit/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,13 @@ def ut1(self):
"""
return self.MJD + 2400000.5

@gravity_toolkit.utilities.reify
def year(self):
"""Universal Time (UT) as calendar year
"""
Y, M, D, h, m, s = convert_julian(self.ut1, format='tuple')
return convert_calendar_decimal(Y, M, D, hour=h, minute=m, second=s)

@property
def dtype(self):
"""Main data type of ``timescale`` object"""
Expand Down Expand Up @@ -1099,7 +1106,7 @@ def get_leap_seconds(truncate=True):
# convert from time of 2nd leap second to time of 1st leap second
leap_GPS = convert_delta_time(leap_UTC + TAI_UTC - TAI_GPS - 1,
epoch1=_ntp_epoch, epoch2=_gps_epoch)
# return the GPS times of leap second occurance
# return the GPS times of leap second occurrence
if truncate:
return leap_GPS[leap_GPS >= 0].astype(np.float64)
else:
Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/time_series/piecewise.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
def piecewise(t_in, d_in, BREAK_TIME=None, BREAKPOINT=None,
CYCLES=[0.5,1.0], TERMS=[], DATA_ERR=0, WEIGHT=False,
STDEV=0, CONF=0, AICc=False):
"""
r"""
Fits a synthetic signal to data over a time period by ordinary or
weighted least-squares for breakpoint analysis [Toms2003]_

Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/time_series/regress.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
def regress(t_in, d_in, ORDER=1, CYCLES=[0.5,1.0], TERMS=[],
DATA_ERR=0, WEIGHT=False, RELATIVE=Ellipsis, STDEV=0, CONF=0,
AICc=True):
"""
r"""
Fits a synthetic signal to data over a time period by
ordinary or weighted least-squares

Expand Down
2 changes: 1 addition & 1 deletion gravity_toolkit/time_series/savitzky_golay.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def savitzky_golay(t_in, y_in, WINDOW=None, ORDER=2, DERIV=0,
Length of the window

Must be an odd integer
ORDER: int, defualt 2
ORDER: int, default 2
Order of the polynomial used in the filtering

Must be less than (window_size - 1)
Expand Down
Loading
Loading