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

A problem #152

Open
zhangyuyayaya opened this issue Nov 27, 2024 · 2 comments
Open

A problem #152

zhangyuyayaya opened this issue Nov 27, 2024 · 2 comments

Comments

@zhangyuyayaya
Copy link

When running GRACE-Harmonic-Plots.ipynb, the following error occurs. What should I do to solve it?
Problems with running this section.
QQ20241127-215506

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.
QQ20241127-220220
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?

@tsutterley
Copy link
Owner

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.

@zhangyuyayaya
Copy link
Author

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.

build list of regression fit components

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))

total number of fit terms

ncomp = (ORDER + 1) + 2*len(CYCLES) + len(TERMS)

Allocating memory for output variables

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))

update mask and dimensions

out.update_mask()

calculate the regression coefficients

for i in range(nlat):
for j in range(nlon):
# Calculating the regression coefficients
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
tsbeta = gravtk.time_series.regress(grid.time, grid.data[i,j,:],
File "E:\Ph.D\Code\GRACE\gravity-toolkit-1.2.1\gravity-toolkit-1.2.1\gravity_toolkit\time_series\regress.py", line 344, in regress
Hinv = np.linalg.inv(np.dot(np.transpose(DMAT),DMAT))
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\numpy\linalg_linalg.py", line 615, in inv
ainv = _umath_linalg.inv(a, signature=signature)
File "D:\Professional\Anaconda3\envs\gravity_toolkit\lib\site-packages\numpy\linalg_linalg.py", line 104, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants