Skip to content

Commit a4b7860

Browse files
committed
refactor: switch from parameter files to argparse arguments (#36)
fix: degree spacing in spatial programs
1 parent 4f64c6b commit a4b7860

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3162
-2300
lines changed

Dockerfile

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
1-
FROM python:3.7-alpine
2-
3-
LABEL "com.github.actions.name"="gravity_toolkit"
4-
LABEL "com.github.actions.description"="Run pytest commands"
5-
LABEL "com.github.actions.icon"="upload-cloud"
6-
LABEL "com.github.actions.color"="yellow"
7-
8-
RUN apk add --no-cache bash
9-
RUN pip install --upgrade pip
10-
RUN pip install pytest pytest-cov
11-
RUN pip install -r requirements.txt
12-
RUN python --version ; pip --version ; pytest --version
1+
FROM python:3.9-slim-buster
2+
3+
LABEL Tyler Sutterley "[email protected]"
4+
5+
ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
6+
7+
RUN useradd --create-home --shell /bin/bash gravity
8+
9+
RUN apt-get update -y && \
10+
apt-get install -y --no-install-recommends \
11+
ca-certificates \
12+
git \
13+
libgeos-dev \
14+
libhdf5-dev \
15+
libnetcdf-dev \
16+
libproj-dev \
17+
libxml2-dev \
18+
libxslt1-dev \
19+
openssl \
20+
proj-data \
21+
proj-bin && \
22+
apt-get clean
23+
24+
WORKDIR /home/gravity
25+
26+
RUN pip3 install --no-cache-dir --no-binary=cartopy \
27+
cartopy \
28+
future \
29+
h5py \
30+
lxml \
31+
matplotlib \
32+
netCDF4 \
33+
numpy \
34+
python-dateutil \
35+
pyyaml \
36+
scipy && \
37+
pip3 install --no-cache-dir --no-deps git+https://github.com/tsutterley/read-GRACE-geocenter.git && \
38+
pip3 install --no-cache-dir --no-deps git+https://github.com/tsutterley/geoid-toolkit.git
39+
40+
COPY . .
41+
42+
RUN --mount=source=.git,target=.git,type=bind \
43+
pip install --no-cache-dir --no-deps .
44+
45+
USER gravity
46+
47+
CMD ["bash"]

doc/source/getting_started/Spatial-Maps.rst

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -119,149 +119,6 @@ as described in [Jekeli1981]_ [Swenson2002]_.
119119
GRACE/GRACE-FO coefficients are also impacted by correlated north/south "striping" errors,
120120
which can be spectrally filtered following [Swenson2006]_.
121121

122-
Parameter Files
123-
###############
124-
125-
The ``grace_spatial_maps.py`` program works by accepting parameter file system arguments
126-
(``sys.argv``) listed after the program.
127-
These parameter files can be ran individually or in a series.
128-
129-
.. code-block:: bash
130-
131-
python grace_spatial_maps.py inp1 inp2 inp3
132-
python grace_spatial_maps.py --np 2 inp1 inp2 inp3
133-
python grace_spatial_maps.py -P 2 inp1 inp2 inp3
134-
135-
136-
The program can be run in series (default) or in parallel with the python
137-
multiprocessing package using options ``--np`` and ``-P``.
138-
The number after the ``--np`` and ``-P`` options declares the number of processes to run in parallel.
139-
140-
The parameter files are read line by line to fill a python dictionary variable
141-
mapping specific parameter names with their values.
142-
The parameter names are the first column in the file and the parameter values are the second column.
143-
For parameters consisting of lists (e.g. GRACE/GRACE-FO missing months),
144-
the parameter values are separated by commas.
145-
146-
- Column 1: parameter name (such as ``LMAX``)
147-
- Column 2: parameter value (e.g. ``60``)
148-
- Column 3: comments (which are discarded)
149-
150-
Dataset Parameters
151-
##################
152-
153-
- ``PROC``: GRACE Processing Center (CSR, GFZ, JPL, CNES)
154-
- ``DREL``: GRACE data release for given processing center
155-
- ``DSET``: GRACE data product (see `GRACE Data File Formats <./GRACE-Data-File-Formats.html>`_)
156-
- ``LMIN``: minimum spherical harmonic degree (lower bound of truncation)
157-
- ``LMAX``: maximum spherical harmonic degree (upper bound of truncation)
158-
- ``MMAX``: maximum spherical harmonic order (None if ``LMAX``)
159-
- ``START``: first month to be analyzed
160-
- ``END``: last month to be analyzed
161-
- ``MISSING``: GRACE/GRACE-FO months that are not be analyzed (see available GRACE/GRACE-FO months)
162-
- ``RAD``: Gaussian smoothing radius in km [Jekeli1981]_
163-
- ``DESTRIPE``: filter coefficients using destriping procedure [Swenson2006]_
164-
- ``SLR_C20``: replace *C*\ :sub:`20` coefficients with values from Satellite Laser Ranging (SLR)
165-
166-
* `None`: use original values
167-
* ``'CSR'``: use values from CSR (TN-07, TN-09, TN-11)
168-
* ``'GFZ'``: use values from GFZ
169-
* ``'GSFC'``: use values from GSFC (TN-14)
170-
171-
- ``SLR_21``: replace *C*\ :sub:`21` and *S*\ :sub:`21` coefficients with values from Satellite Laser Ranging (SLR)
172-
173-
* `None`: use original values
174-
* ``'CSR'``: use values from CSR
175-
* ``'GFZ'``: use values from GFZ GravIS
176-
177-
- ``SLR_22``: replace *C*\ :sub:`22` and *S*\ :sub:`22` coefficients with values from Satellite Laser Ranging (SLR)
178-
179-
* `None`: use original values
180-
* ``'CSR'``: use values from CSR
181-
182-
- ``SLR_C30``: replace *C*\ :sub:`30` coefficients with values from Satellite Laser Ranging (SLR)
183-
184-
* `None`: use original values
185-
* ``'CSR'``: use values from CSR (5x5 with 6,1)
186-
* ``'GFZ'``: use values from GFZ GravIS
187-
* ``'GSFC'``: use values from GSFC (TN-14)
188-
* ``'LARES'``: use filtered values from CSR
189-
190-
- ``SLR_C50``: replace *C*\ :sub:`50` coefficients with values from Satellite Laser Ranging (SLR)
191-
192-
* `None`: use original values
193-
* ``'CSR'``: use values from CSR (5x5 with 6,1)
194-
* ``'GSFC'``: use values from GSFC
195-
* ``'LARES'``: use filtered values from CSR
196-
197-
- ``DEG1``: account for variations in geocenter with specified values
198-
199-
* `None`
200-
* ``'Tellus'``: GRACE/GRACE-FO TN-13 coefficients from PO.DAAC
201-
* ``'SLR'``: satellite laser ranging coefficients from CSR
202-
* ``'SLF'``: Sutterley and Velicogna coefficients, Remote Sensing (2019)
203-
* ``'Swenson'``: GRACE-derived coefficients from Sean Swenson
204-
* ``'GFZ'``: GRACE/SLR derived coefficients from GFZ GravIS
205-
206-
- ``MODEL_DEG1``: use a least-squares regression model to predict geocenter values where unavailable
207-
- ``GIA``: GIA model type
208-
209-
* `None`
210-
* ``'IJ05-R2'``: `Ivins R2 GIA Models <https://doi.org/10.1002/jgrb.50208>`_
211-
* ``'W12a'``: `Whitehouse GIA Models <https://doi.org/10.1111/j.1365-246X.2012.05557.x>`_
212-
* ``'SM09'``: `Simpson/Milne GIA Models <https://doi.org/10.1029/2010JB007776>`_
213-
* ``'ICE6G'``: `ICE-6G GIA Models <https://doi.org/10.1002/2014JB011176>`_
214-
* ``'Wu10'``: `Wu (2010) GIA Correction <https://doi.org/10.1038/ngeo938>`_
215-
* ``'AW13-ICE6G'``: `Geruo A ICE-6G GIA Models <https://doi.org/10.1093/gji/ggs030>`_
216-
* ``'Caron'``: `Caron JPL GIA Assimilation <https://doi.org/10.1002/2017GL076644>`_
217-
* ``'ICE6G-D'``: `ICE-6G Version-D GIA Models <https://doi.org/10.1002/2016JB013844>`_
218-
* ``'netCDF4'``: reformatted GIA in netCDF4 format
219-
* ``'HDF5'``: reformatted GIA in HDF5 format
220-
221-
- ``GIA_FILE``: path to specific GIA file to be read
222-
- ``DATAFORM``: input data format and output data format
223-
224-
* ``'ascii'``
225-
* ``'netCDF4'``
226-
* ``'HDF5'``
227-
228-
- ``MEAN``: Remove a mean field to isolate the time-variable gravity field
229-
- ``MEAN_FILE``: use a file to remove as static field (default: mean of imported month)
230-
- ``MEANFORM``: Data format for input ``MEAN_FILE``
231-
232-
* ``'ascii'``
233-
* ``'netCDF4'``
234-
* ``'HDF5'``
235-
* ``'gfc'``
236-
237-
- ``DIRECTORY``: Directory to output data
238-
- ``REMOVE_FILE``: Remove sets of spherical harmonics (can be multiple files)
239-
- ``REMOVEFORM``: Data format for input ``REMOVE_FILE`` (can be a single value for a uniform type or values for each file)
240-
241-
* ``'ascii'``
242-
* ``'netCDF4'``
243-
* ``'HDF5'``
244-
* ``'index'``: index file containing monthly files in ``DATAFORM``
245-
246-
- ``REDISTRIBUTE_REMOVED``: Redistribute total mass of removed harmonics over the ocean
247-
- ``POLE_TIDE``: correct GSM *C*\ :sub:`21` and *S*\ :sub:`21` for pole tide [Wahr2015]_
248-
- ``ATM``: correct Atmosphere with ECMWF "jump" corrections [Fagiolini2015]_
249-
- ``UNITS``: Output units of the spatial fields
250-
251-
* ``1``: Equivalent Water Thickness (cm)
252-
* ``2``: Geoid Height (mm)
253-
* ``3``: Elastic Crustal Uplift (mm)
254-
* ``4``: Gravitational Undulation (\ |mu|\ Gal)
255-
* ``5``: Equivalent surface pressure (millibar)
256-
257-
- ``DDEG``: spatial longitude and latitude degree spacing
258-
- ``INTERVAL``: determines the spatial field degree interval
259-
260-
* ``1``: (90:-90,0:360)
261-
* ``2``: (degree interval/2)
262-
263-
- ``FILENAME``: Start of the output filename
264-
265122
References
266123
##########
267124

doc/source/getting_started/Time-Series-Analysis.rst

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -34,141 +34,6 @@ The ``calc_mascon.py`` program will output a text file of the time series for ea
3434
estimated monthly mass anomaly [Gt], estimated monthly error [Gt],
3535
mascon area [km\ :sup:`2`]).
3636

37-
Parameter Files
38-
###############
39-
40-
The ``calc_mascon.py`` program works by accepting parameter file system arguments
41-
(``sys.argv``) listed after the program.
42-
These parameter files can be ran individually or in a series.
43-
44-
.. code-block:: bash
45-
46-
python calc_mascon.py inp1 inp2 inp3
47-
python calc_mascon.py --np=2 inp1 inp2 inp3
48-
python calc_mascon.py -P 2 inp1 inp2 inp3
49-
50-
The program can be run in series (default) or in parallel with the python
51-
multiprocessing package using options ``--np`` and ``-P``.
52-
The number after the ``--np`` and ``-P`` options declares the number of processes to run in parallel.
53-
54-
The parameter files are read line by line to fill a python dictionary variable
55-
mapping specific parameter names with their values.
56-
The parameter names are the first column in the file and the parameter values are the second column.
57-
For parameters consisting of lists (e.g. GRACE/GRACE-FO missing months),
58-
the parameter values are separated by commas.
59-
60-
- Column 1: parameter name (such as ``LMAX``)
61-
- Column 2: parameter value (e.g. ``60``)
62-
- Column 3: comments (which are discarded)
63-
64-
Dataset Parameters
65-
##################
66-
67-
- ``PROC``: GRACE Processing Center (CSR, GFZ, JPL, CNES)
68-
- ``DREL``: GRACE data release for given processing center
69-
- ``DSET``: GRACE data product (see `GRACE Data File Formats <./GRACE-Data-File-Formats.html>`_)
70-
- ``LMIN``: minimum spherical harmonic degree (lower bound of truncation)
71-
- ``LMAX``: maximum spherical harmonic degree (upper bound of truncation)
72-
- ``MMAX``: maximum spherical harmonic order (None if ``LMAX``)
73-
- ``START``: first month to be analyzed
74-
- ``END``: last month to be analyzed
75-
- ``MISSING``: GRACE/GRACE-FO months that are not be analyzed (see available GRACE/GRACE-FO months)
76-
- ``RAD``: Gaussian smoothing radius in km [Jekeli1981]_
77-
- ``DESTRIPE``: filter coefficients using destriping procedure [Swenson2006]_
78-
- ``SLR_C20``: replace *C*\ :sub:`20` coefficients with values from Satellite Laser Ranging (SLR)
79-
80-
* `None`: use original values
81-
* ``'CSR'``: use values from CSR (TN-07, TN-09, TN-11)
82-
* ``'GFZ'``: use values from GFZ
83-
* ``'GSFC'``: use values from GSFC (TN-14)
84-
85-
- ``SLR_21``: replace *C*\ :sub:`21` and *S*\ :sub:`21` coefficients with values from Satellite Laser Ranging (SLR)
86-
87-
* `None`: use original values
88-
* ``'CSR'``: use values from CSR
89-
* ``'GFZ'``: use values from GFZ GravIS
90-
91-
- ``SLR_22``: replace *C*\ :sub:`22` and *S*\ :sub:`22` coefficients with values from Satellite Laser Ranging (SLR)
92-
93-
* `None`: use original values
94-
* ``'CSR'``: use values from CSR
95-
96-
- ``SLR_C30``: replace *C*\ :sub:`30` coefficients with values from Satellite Laser Ranging (SLR)
97-
98-
* `None`: use original values
99-
* ``'CSR'``: use values from CSR (5x5 with 6,1)
100-
* ``'GFZ'``: use values from GFZ GravIS
101-
* ``'GSFC'``: use values from GSFC (TN-14)
102-
* ``'LARES'``: use filtered values from CSR
103-
104-
- ``SLR_C50``: replace *C*\ :sub:`50` coefficients with values from Satellite Laser Ranging (SLR)
105-
106-
* `None`: use original values
107-
* ``'CSR'``: use values from CSR (5x5 with 6,1)
108-
* ``'GSFC'``: use values from GSFC
109-
* ``'LARES'``: use filtered values from CSR
110-
111-
- ``DEG1``: account for variations in geocenter with specified values
112-
113-
* `None`
114-
* ``'Tellus'``: GRACE/GRACE-FO TN-13 coefficients from PO.DAAC
115-
* ``'SLR'``: satellite laser ranging coefficients from CSR
116-
* ``'SLF'``: Sutterley and Velicogna coefficients, Remote Sensing (2019)
117-
* ``'Swenson'``: GRACE-derived coefficients from Sean Swenson
118-
* ``'GFZ'``: GRACE/SLR derived coefficients from GFZ GravIS
119-
120-
- ``GIA``: GIA model type
121-
122-
* `None`
123-
* ``'IJ05-R2'``: `Ivins R2 GIA Models <https://doi.org/10.1002/jgrb.50208>`_
124-
* ``'W12a'``: `Whitehouse GIA Models <https://doi.org/10.1111/j.1365-246X.2012.05557.x>`_
125-
* ``'SM09'``: `Simpson/Milne GIA Models <https://doi.org/10.1029/2010JB007776>`_
126-
* ``'ICE6G'``: `ICE-6G GIA Models <https://doi.org/10.1002/2014JB011176>`_
127-
* ``'Wu10'``: `Wu (2010) GIA Correction <https://doi.org/10.1038/ngeo938>`_
128-
* ``'AW13-ICE6G'``: `Geruo A ICE-6G GIA Models <https://doi.org/10.1093/gji/ggs030>`_
129-
* ``'Caron'``: `Caron JPL GIA Assimilation <https://doi.org/10.1002/2017GL076644>`_
130-
* ``'ICE6G-D'``: `ICE-6G Version-D GIA Models <https://doi.org/10.1002/2016JB013844>`_
131-
* ``'netCDF4'``: reformatted GIA in netCDF4 format
132-
* ``'HDF5'``: reformatted GIA in HDF5 format
133-
134-
- ``GIA_FILE``: path to specific GIA file to be read
135-
136-
- ``DATAFORM``: input data format for mascon files and files to be removed from the GRACE/GRACE-FO data
137-
138-
* ``'ascii'``
139-
* ``'netCDF4'``
140-
* ``'HDF5'``
141-
142-
- ``DIRECTORY``: Directory to output data (will create directory if non-existent)
143-
- ``MASCON_INDEX``: file index listing the full path to each mascon file to fit to the GRACE data
144-
- ``FIT_METHOD``: method of fitting mascons coefficients
145-
146-
* ``1``: convert coefficients to mass
147-
* ``2``: keep coefficients as normalized geoid
148-
149-
- ``MEAN``: Remove a mean field to isolate the time-variable gravity field
150-
- ``MEAN_FILE``: use a file to remove as static field (default: mean of imported month)
151-
- ``MEANFORM``: Data format for input ``MEAN_FILE``
152-
153-
* ``'ascii'``
154-
* ``'netCDF4'``
155-
* ``'HDF5'``
156-
* ``'gfc'``
157-
158-
- ``REMOVE_FILE``: Remove sets of spherical harmonics (can be multiple files)
159-
- ``REMOVEFORM``: Data format for input ``REMOVE_FILE`` (can be a single value for a uniform type or values for each file)
160-
161-
* ``'ascii'``
162-
* ``'netCDF4'``
163-
* ``'HDF5'``
164-
* ``'index'``: index file containing monthly files in ``DATAFORM``
165-
166-
- ``REDISTRIBUTE_REMOVED``: Redistribute total mass of removed harmonics over the ocean
167-
- ``MASCON_OCEAN``: remove uniformly distributed mascon mass over ocean
168-
- ``RECONSTRUCT``: remove the reconstructed time series for a region to get the statistical leakage
169-
- ``POLE_TIDE``: correct GSM *C*\ :sub:`21` and *S*\ :sub:`21` for pole tide [Wahr2015]_
170-
- ``ATM``: correct Atmosphere with ECMWF "jump" corrections [Fagiolini2015]_
171-
17237
References
17338
##########
17439

doc/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ missions
102102
user_guide/calc_sensitivity_kernel.rst
103103
user_guide/combine_harmonics.rst
104104
user_guide/convert_harmonics.rst
105-
user_guide/grace_mean_harmonics.md
105+
user_guide/grace_mean_harmonics.rst
106106
user_guide/grace_spatial_error.rst
107107
user_guide/grace_spatial_maps.rst
108-
user_guide/mascon_reconstruct.md
109-
user_guide/regress_grace_maps.md
108+
user_guide/mascon_reconstruct.rst
109+
user_guide/regress_grace_maps.rst
110110
user_guide/run_grace_date.md
111111
user_guide/scale_grace_maps.rst

0 commit comments

Comments
 (0)