Open zhangyuyayaya opened 5 days ago
hi @zhangyuyayaya,
I usually use the shm
(spherical harmonic model) formatted files provided by PO.DAAC or the GFZ ISDC. I'm putting in an update that should fix your case using gfc
(gravity-field coefficient) files.
GRACE-Harmonic-Plots.ipynb already works perfectly! Try the other notebook runs next. When running GRACE-Spatial-Maps.ipynb, the following error occurs. What should I do to solve it? Problems with running this section.
ORDER = orderText.value PHASES = {'Annual':1.0,'Semi-Annual':0.5} CYCLES = [v for k,v in PHASES.items() if cyclicCheckbox[k].value] TERMS = [] if termsCheckbox.value: TERMS.extend(gravtk.time_series.aliasing_terms(grid.time))
ncomp = (ORDER + 1) + 2*len(CYCLES) + len(TERMS)
out = gravtk.spatial(spacing=grid.spacing, nlon=nlon, nlat=nlat, extent=grid.extent, fill_value=grid.fill_value) out.data = np.zeros((nlat, nlon, ncomp))
out.update_mask()
for i in range(nlat): for j in range(nlon):
tsbeta = gravtk.time_series.regress(grid.time, grid.data[i,j,:],
ORDER=ORDER, CYCLES=CYCLES, TERMS=TERMS)
# save regression components
for k in range(0, ncomp):
out.data[i,j,k] = tsbeta['beta'][k]
The following error occurs:
Traceback (most recent call last):
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\1125test.py", line 384, in
When running GRACE-Harmonic-Plots.ipynb, the following error occurs. What should I do to solve it? Problems with running this section.
Traceback (most recent call last): File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\1125test.py", line 83, in
Ylms = gravtk.grace_input_months(widgets.base_directory, PROC, DREL, DSET,
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\gravity_toolkit\grace_input_months.py", line 421, in grace_input_months
Ylms = read_GRACE_harmonics(infile, LMAX, MMAX=MMAX,
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\gravity_toolkit\read_GRACE_harmonics.py", line 213, in read_GRACE_harmonics
grace_L2_input.update(yaml.load('\n'.join(head),Loader=yaml.BaseLoader))
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml__init__.py", line 81, in load
return loader.get_single_data()
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\composer.py", line 35, in get_single_node
if not self.check_event(StreamEndEvent):
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\parser.py", line 98, in check_event
self.current_event = self.state()
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\parser.py", line 142, in parse_implicit_document_start
if not self.check_token(DirectiveToken, DocumentStartToken,
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\scanner.py", line 227, in fetch_more_tokens
return self.fetch_alias()
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\scanner.py", line 610, in fetch_alias
self.tokens.append(self.scan_anchor(AliasToken))
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\pyyaml-6.0.2-py3.10-win-amd64.egg\yaml\scanner.py", line 922, in scan_anchor
raise ScannerError("while scanning an %s" % name, start_mark,
yaml.scanner.ScannerError: while scanning an alias
in "", line 1, column 1:
**** ...
^
expected alphabetic or numeric character, but found '*'
in "", line 1, column 2:
***** ...
^
I believe this would be a problem with the header file of the data file. But when I remove the GSM-2_2002095-2002120_GRAC_UTCSR_BA01_0600.gfc header file into keep the following. Then the following error occurs. Traceback (most recent call last): File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\1125test.py", line 83, in
Ylms = gravtk.grace_input_months(widgets.base_directory, PROC, DREL, DSET,
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\gravity_toolkit\grace_input_months.py", line 421, in grace_input_months
Ylms = read_GRACE_harmonics(infile, LMAX, MMAX=MMAX,
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\gravity_toolkit\read_GRACE_harmonics.py", line 213, in read_GRACE_harmonics
grace_L2_input.update(yaml.load('\n'.join(head),Loader=yaml.BaseLoader))
ValueError: dictionary update sequence element #0 has length 1; 2 is required
I don't know what it is and how I should go about fixing it. Or what should be the correct data file format?