Skip to content

Commit eab91e8

Browse files
authored
feat: Add 3-hour AOD interval for RL06 #37 (#41)
feat: release monthly dealiasing (for CSR GAA etc) fix: inputs to AOD-corrected SLR geocenter coefficients
1 parent 054d8cb commit eab91e8

File tree

9 files changed

+806
-41
lines changed

9 files changed

+806
-41
lines changed

doc/source/getting_started/GRACE-Data-File-Formats.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Data File Formats
55
Product Identifier
66
##################
77

8-
GRACE Level-2 products consist of spherical harmonic coefficients of the Earth's gravitational field.
9-
The data files are typically gzipped ascii files with names formatted as the following:
8+
GRACE and GRACE-FO Level-2 products consist of spherical harmonic coefficients of the Earth's gravitational field.
9+
The Spherical Harmonic Model (SHM) data files are typically gzipped ascii files with names formatted as the following:
1010
``PID-2_YYYYDOY-yyyydoy_ndays_center_flag_rrrr`` or ``PID-2_YYYYDOY-yyyydoy_mssn_center_flag_rrrr``
1111

1212
- ``PID`` is a product identification string (for standard products: GSM, GAD, GAC, GAA, GAB)

doc/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ missions
105105
user_guide/grace_mean_harmonics.rst
106106
user_guide/grace_spatial_error.rst
107107
user_guide/grace_spatial_maps.rst
108+
user_guide/make_monthly_dealiasing.md
108109
user_guide/mascon_reconstruct.rst
109110
user_guide/regress_grace_maps.rst
110111
user_guide/run_grace_date.md

doc/source/user_guide/aod1b_geocenter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ aod1b_geocenter.py
66
* `'ocn'`: oceanic loading from OMCT/MPIOM
77
* `'glo'`: global atmospheric and oceanic loading
88
* `'oba'`: ocean bottom pressure from OMCT/MPIOM
9-
- Creates monthly files of geocenter variations at 6-hour intervals
9+
- Creates monthly files of geocenter variations at 3 or 6-hour intervals
1010

1111
#### Calling Sequence
1212
```bash

doc/source/user_guide/aod1b_oblateness.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ aod1b_oblateness.py
66
* `'ocn'`: oceanic loading from OMCT/MPIOM
77
* `'glo'`: global atmospheric and oceanic loading
88
* `'oba'`: ocean bottom pressure from OMCT/MPIOM
9-
- Creates monthly files of oblateness variations at 6-hour intervals
9+
- Creates monthly files of oblateness variations at 3 or 6-hour intervals
1010

1111
#### Calling Sequence
1212
```bash
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
make_monthly_dealiasing.py
2+
==========================
3+
4+
- Reads GRACE/GRACE-FO level-1b dealiasing data files for a specific product and outputs monthly the mean for a specific GRACE/GRACE-FO processing center and data release
5+
* `'GAA'`: atmospheric loading from ECMWF
6+
* `'GAB'`: oceanic loading from OMCT/MPIOM
7+
* `'GAC'`: global atmospheric and oceanic loading
8+
* `'GAD'`: ocean bottom pressure from OMCT/MPIOM
9+
- Creates monthly files of oblateness variations at 3 or 6-hour intervals
10+
11+
#### Calling Sequence
12+
```bash
13+
python make_monthly_dealiasing.py --release RL06 --product GAD
14+
```
15+
[Source code](https://github.com/tsutterley/read-GRACE-harmonics/blob/main/scripts/make_monthly_dealiasing.py)
16+
17+
#### Command Line Options
18+
- `-D X`, `--directory X`: Working Data Directory
19+
- `-c X`, `--center X`: GRACE/GRACE-FO Processing Center for dates
20+
- `-r X`, `--release X`: GRACE/GRACE-FO Data Release (RL05 or RL06)
21+
- `-p X`, `--product X`: GRACE/GRACE-FO dealiasing product (GAA, GAB, GAC, GAD)
22+
- `-L X`, `--lmax X`: Maximum spherical harmonic degree and order for output
23+
- `-F X`, `--format X`: Output data format
24+
* `'ascii'`
25+
* `'netCDF4'`
26+
* `'HDF5'`
27+
* `'SHM'`
28+
- `-C`, `--clobber`: Overwrite existing data
29+
- `-M X`, `--mode X`: Permission mode of directories and files
30+
- `-V`, `--verbose`: Output information for each output file

gravity_toolkit/grace_input_months.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python
22
u"""
33
grace_input_months.py
4-
Written by Tyler Sutterley (06/2021)
4+
Written by Tyler Sutterley (07/2021)
5+
Contributions by Hugo Lecomte and Yara Mohajerani
56
67
Reads GRACE/GRACE-FO files for a specified spherical harmonic degree and order
78
and for a specified date range
@@ -92,6 +93,7 @@
9293
read_GRACE_harmonics.py: reads an input GRACE data file and calculates date
9394
9495
UPDATE HISTORY:
96+
Updated 07/2021: fix inputs to AOD-corrected SLR geocenter coefficients
9597
Updated 06/2021: can use SLR figure axis harmonics produced by GSFC
9698
read GRACE/GRACE-FO fields before reading replacement values
9799
Updated 05/2021: can use SLR low-degree harmonic values produced by GFZ
@@ -373,7 +375,7 @@ def grace_input_months(base_dir, PROC, DREL, DSET, LMAX, start_mon, end_mon,
373375
#-- new file of degree-1 mass variations from Minkang Cheng
374376
#-- http://download.csr.utexas.edu/outgoing/cheng/gct2est.220_5s
375377
DEG1_file = os.path.join(base_dir,'geocenter','gct2est.220_5s')
376-
DEG1_input = aod_corrected_SLR_geocenter(DEG1_file,HEADER=15,
378+
DEG1_input = aod_corrected_SLR_geocenter(DEG1_file,DREL,HEADER=15,
377379
RADIUS=6.378136e9,COLUMNS=['MJD','time','X','Y','Z','XM','YM','ZM',
378380
'X_sigma','Y_sigma','Z_sigma','XM_sigma','YM_sigma','ZM_sigma'])
379381
FLAGS.append('_w{0}_DEG1'.format(DEG1))

scripts/aod1b_geocenter.py

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/usr/bin/env python
22
u"""
33
aod1b_geocenter.py
4-
Written by Tyler Sutterley (05/2021)
4+
Written by Tyler Sutterley (07/2021)
5+
Contributions by Hugo Lecomte (03/2021)
56
67
Reads GRACE/GRACE-FO level-1b dealiasing data files for a specific product
78
atm: atmospheric loading from ECMWF
89
ocn: oceanic loading from OMCT/MPIOM
910
glo: global atmospheric and oceanic loading
1011
oba: ocean bottom pressure from OMCT/MPIOM
1112
12-
Creates monthly files of geocenter variations at 6-hour intervals
13+
Creates monthly files of geocenter variations at 3 or 6 hour intervals
1314
1415
NOTE: this reads the GFZ AOD1B files downloaded from PO.DAAC
1516
https://podaac-uat.jpl.nasa.gov/drive/files/allData/grace/L1B/GFZ/AOD1B/RL06/
@@ -30,9 +31,12 @@
3031
3132
PROGRAM DEPENDENCIES:
3233
geocenter.py: converts degree 1 spherical harmonics to geocenter variations
34+
utilities.py: download and management utilities for files
3335
3436
UPDATED HISTORY:
37+
Updated 07/2021: can use default argument files to define options
3538
Updated 05/2021: define int/float precision to prevent deprecation warning
39+
Updated 03/2021: Add 3-hour interval depending on Release
3640
Updated 10/2020: use argparse to set command line parameters
3741
Updated 07/2020: added function docstrings
3842
Updated 06/2019: using python3 compatible regular expression patterns
@@ -58,19 +62,13 @@
5862
import argparse
5963
import numpy as np
6064
from gravity_toolkit.geocenter import geocenter
61-
62-
#-- aod1b data products
63-
product = {}
64-
product['atm'] = 'Atmospheric loading from ECMWF'
65-
product['ocn'] = 'Oceanic loading from OMCT'
66-
product['glo'] = 'Global atmospheric and oceanic loading'
67-
product['oba'] = 'Ocean bottom pressure from OMCT'
65+
import gravity_toolkit.utilities as utilities
6866

6967
#-- program module to read the degree 1 coefficients of the AOD1b data
7068
def aod1b_geocenter(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
7169
VERBOSE=False):
7270
"""
73-
Creates monthly files of geocenter variations at 6-hour intervals from
71+
Creates monthly files of geocenter variations at 6-hour or 3-hour intervals from
7472
GRACE/GRACE-FO level-1b dealiasing data files
7573
7674
Arguments
@@ -105,11 +103,32 @@ def aod1b_geocenter(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
105103
#-- output formatting string
106104
fstr = '{0:4d}-{1:02d}-{2:02d}T{3:02d}:00:00 {4:12.8f} {5:12.8f} {6:12.8f}'
107105

108-
#-- Maximum spherical harmonic degree (LMAX)
109-
LMAX = 100
106+
#-- set number of hours in a file
107+
#-- set the ocean model for a given release
108+
if DREL in ('RL01','RL02','RL03','RL04','RL05'):
109+
#-- for 00, 06, 12 and 18
110+
n_time = 4
111+
ATMOSPHERE = 'ECMWF'
112+
OCEAN_MODEL = 'OMCT'
113+
LMAX = 100
114+
elif DREL in ('RL06',):
115+
#-- for 00, 03, 06, 09, 12, 15, 18 and 21
116+
n_time = 8
117+
ATMOSPHERE = 'ECMWF'
118+
OCEAN_MODEL = 'MPIOM'
119+
LMAX = 180
120+
else:
121+
raise ValueError('Invalid data release')
110122
#-- Calculating the number of cos and sin harmonics up to LMAX
111123
n_harm = (LMAX**2 + 3*LMAX)//2 + 1
112124

125+
#-- AOD1B data products
126+
product = {}
127+
product['atm'] = 'Atmospheric loading from {0}'.format(ATMOSPHERE)
128+
product['ocn'] = 'Oceanic loading from {0}'.format(OCEAN_MODEL)
129+
product['glo'] = 'Global atmospheric and oceanic loading'
130+
product['oba'] = 'Ocean bottom pressure from {0}'.format(OCEAN_MODEL)
131+
113132
#-- AOD1B directory and output geocenter directory
114133
grace_dir = os.path.join(base_dir,'AOD1B',DREL)
115134
output_dir = os.path.join(grace_dir,'geocenter')
@@ -169,15 +188,15 @@ def aod1b_geocenter(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
169188
else:
170189
fid = tar.extractfile(member)
171190
#-- degree 1 spherical harmonics for day and hours
172-
C10 = np.zeros((4))
173-
C11 = np.zeros((4))
174-
S11 = np.zeros((4))
175-
hours = np.zeros((4),dtype=np.int64)
191+
C10 = np.zeros((n_time))
192+
C11 = np.zeros((n_time))
193+
S11 = np.zeros((n_time))
194+
hours = np.zeros((n_time),dtype=np.int64)
176195

177196
#-- create counter for hour in dataset
178197
c = 0
179198
#-- while loop ends when dataset is read
180-
while (c < 4):
199+
while (c < n_time):
181200
#-- read line
182201
file_contents = fid.readline().decode('ISO-8859-1')
183202
#-- find file header for data product
@@ -220,9 +239,11 @@ def main():
220239
#-- Read the system arguments listed after the program
221240
parser = argparse.ArgumentParser(
222241
description="""Creates monthly files of geocenter variations
223-
at 6-hour intervals
224-
"""
242+
at 3 or 6-hour intervals
243+
""",
244+
fromfile_prefix_chars="@"
225245
)
246+
parser.convert_arg_line_to_args = utilities.convert_arg_line_to_args
226247
#-- command line parameters
227248
#-- working data directory
228249
parser.add_argument('--directory','-D',

scripts/aod1b_oblateness.py

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/usr/bin/env python
22
u"""
33
aod1b_oblateness.py
4-
Written by Tyler Sutterley (05/2021)
4+
Written by Tyler Sutterley (07/2021)
5+
Contributions by Hugo Lecomte (03/2021)
56
67
Reads GRACE/GRACE-FO level-1b dealiasing data files for a specific product
78
atm: atmospheric loading from ECMWF
89
ocn: oceanic loading from OMCT
910
glo: global atmospheric and oceanic loading
1011
oba: ocean bottom pressure from OMCT
1112
12-
Creates monthly files of oblateness (C20) variations at 6-hour intervals
13+
Creates monthly files of oblateness (C20) variations at 3 or 6 hour intervals
1314
1415
NOTE: this reads the GFZ AOD1B files downloaded from PO.DAAC
1516
https://podaac-uat.jpl.nasa.gov/drive/files/allData/grace/L1B/GFZ/AOD1B/RL05/
@@ -31,7 +32,12 @@
3132
PYTHON DEPENDENCIES:
3233
numpy: Scientific Computing Tools For Python (https://numpy.org)
3334
35+
PROGRAM DEPENDENCIES:
36+
utilities.py: download and management utilities for files
37+
3438
UPDATED HISTORY:
39+
Updated 07/2021: can use default argument files to define options
40+
Add 3-hour interval depending on Release
3541
Updated 05/2021: define int/float precision to prevent deprecation warning
3642
Updated 10/2020: use argparse to set command line parameters
3743
Updated 07/2020: added function docstrings
@@ -56,13 +62,7 @@
5662
import tarfile
5763
import argparse
5864
import numpy as np
59-
60-
#-- aod1b data products
61-
product = {}
62-
product['atm'] = 'Atmospheric loading from ECMWF'
63-
product['ocn'] = 'Oceanic loading from OMCT'
64-
product['glo'] = 'Global atmospheric and oceanic loading'
65-
product['oba'] = 'Ocean bottom pressure from OMCT'
65+
import gravity_toolkit.utilities as utilities
6666

6767
#-- program module to read the C20 coefficients of the AOD1b data
6868
def aod1b_oblateness(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
@@ -103,11 +103,32 @@ def aod1b_oblateness(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
103103
#-- output formatting string
104104
fstr = '{0:4d}-{1:02d}-{2:02d}T{3:02d}:00:00 {4:+16.8E}'
105105

106-
#-- Maximum spherical harmonic degree (LMAX)
107-
LMAX = 100
106+
#-- set number of hours in a file
107+
#-- set the ocean model for a given release
108+
if DREL in ('RL01','RL02','RL03','RL04','RL05'):
109+
#-- for 00, 06, 12 and 18
110+
n_time = 4
111+
ATMOSPHERE = 'ECMWF'
112+
OCEAN_MODEL = 'OMCT'
113+
LMAX = 100
114+
elif DREL in ('RL06',):
115+
#-- for 00, 03, 06, 09, 12, 15, 18 and 21
116+
n_time = 8
117+
ATMOSPHERE = 'ECMWF'
118+
OCEAN_MODEL = 'MPIOM'
119+
LMAX = 180
120+
else:
121+
raise ValueError('Invalid data release')
108122
#-- Calculating the number of cos and sin harmonics up to LMAX
109123
n_harm = (LMAX**2 + 3*LMAX)//2 + 1
110124

125+
#-- AOD1B data products
126+
product = {}
127+
product['atm'] = 'Atmospheric loading from {0}'.format(ATMOSPHERE)
128+
product['ocn'] = 'Oceanic loading from {0}'.format(OCEAN_MODEL)
129+
product['glo'] = 'Global atmospheric and oceanic loading'
130+
product['oba'] = 'Ocean bottom pressure from {0}'.format(OCEAN_MODEL)
131+
111132
#-- AOD1B directory and output oblateness directory
112133
grace_dir = os.path.join(base_dir,'AOD1B',DREL)
113134
output_dir = os.path.join(grace_dir,'oblateness')
@@ -166,13 +187,13 @@ def aod1b_oblateness(base_dir, DREL='', DSET='', CLOBBER=False, MODE=0o775,
166187
else:
167188
fid = tar.extractfile(member)
168189
#-- C20 spherical harmonics for day and hours
169-
C20 = np.zeros((4))
170-
hours = np.zeros((4),dtype=np.int64)
190+
C20 = np.zeros((n_time))
191+
hours = np.zeros((n_time),dtype=np.int64)
171192

172193
#-- create counter for hour in dataset
173194
c = 0
174195
#-- while loop ends when dataset is read
175-
while (c < 4):
196+
while (c < n_time):
176197
#-- read line
177198
file_contents = fid.readline().decode('ISO-8859-1')
178199
#-- find file header for data product
@@ -210,9 +231,11 @@ def main():
210231
#-- Read the system arguments listed after the program
211232
parser = argparse.ArgumentParser(
212233
description="""Creates monthly files of oblateness (C20)
213-
variations at 6-hour intervals
214-
"""
234+
variations at 3 or 6-hour intervals
235+
""",
236+
fromfile_prefix_chars="@"
215237
)
238+
parser.convert_arg_line_to_args = utilities.convert_arg_line_to_args
216239
#-- command line parameters
217240
#-- working data directory
218241
parser.add_argument('--directory','-D',

0 commit comments

Comments
 (0)