-
Notifications
You must be signed in to change notification settings - Fork 2
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
an error while running batch_i_metric.py #4
Comments
Hi, thanks for getting in touch! It looks like that function may have been updated since I wrote this script. I will try and fix this this weekend.
…________________________________
From: ZhengYinuo0414 ***@***.***>
Sent: Wednesday, August 14, 2024 2:50:27 PM
To: so-wise/so-fronts ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [so-wise/so-fronts] an error while running batch_i_metric.py (Issue #4)
I’m sorry to bother you, but I’d like to ask you some questions.
I encountered an error while running batch_i_metric.py
error:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "src/models/batch_i_metric.py", line 129, in
run_through()
File "src/models/batch_i_metric.py", line 124, in run_through
run_through_sep(k_clusters=k_clusters)
File "src/models/batch_i_metric.py", line 89, in run_through_sep
pcm_object, _ = tim.train_on_interpolated_year(
File "/public/home/cyli/so-fronts-main/src/time_wrapper.py", line 24, in timed
result = method(*args, **kw)
File "/public/home/cyli/so-fronts-main/src/models/train_pyxpcm.py", line 86, in train_on_interpolated_year
pcm_object.fit(ds, features=features, dim=cst.Z_COORD)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 1104, in fit
X, sampling_dims = self.preprocessing(ds, features=features,
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 1008, in preprocessing
X, sampling_dims = self.preprocessing_that(ds, dim=dim, features=features_dict, action=action)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 816, in preprocessing_that
X = self._interpoler[feature_name].transform(X, z)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/utils.py", line 208, in transform
C = C.interp(coords={vertical_dim: self.axis})
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/dataarray.py", line 1360, in interp
ds = self._to_temp_dataset().interp(
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/dataset.py", line 2610, in interp
variables[name] = missing.interp(var, var_indexers, method, **kwargs)
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/missing.py", line 611, in interp
var, indexes_coords = _localize(var, indexes_coords)
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/missing.py", line 552, in _localize
imin = index.get_loc(np.min(new_x.values))
File "/public/home/cyli/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3655, in get_loc
raise KeyError(key) from err
KeyError: -1990.0
At the final error point, I modified the get_loc function from index.get_loc(np.min(new_x.values), method='nearest') to index.get_loc(np.min(new_x.values)). The direct execution shows an error, and after checking the documentation, it seems that get_loc does not have a method parameter. I removed it on my own and am not sure if this is causing the error.
—
Reply to this email directly, view it on GitHub<#4>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHH7U7WAXKUMKEI7MNJS6ZTZRNOCHAVCNFSM6AAAAABMQMXRR2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3DKOJQGAZDQMY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I’m sorry to bother you, but I’d like to ask you some questions.
I encountered an error while running batch_i_metric.py
error:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "src/models/batch_i_metric.py", line 129, in
run_through()
File "src/models/batch_i_metric.py", line 124, in run_through
run_through_sep(k_clusters=k_clusters)
File "src/models/batch_i_metric.py", line 89, in run_through_sep
pcm_object, _ = tim.train_on_interpolated_year(
File "/public/home/cyli/so-fronts-main/src/time_wrapper.py", line 24, in timed
result = method(*args, **kw)
File "/public/home/cyli/so-fronts-main/src/models/train_pyxpcm.py", line 86, in train_on_interpolated_year
pcm_object.fit(ds, features=features, dim=cst.Z_COORD)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 1104, in fit
X, sampling_dims = self.preprocessing(ds, features=features,
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 1008, in preprocessing
X, sampling_dims = self.preprocessing_that(ds, dim=dim, features=features_dict, action=action)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/models.py", line 816, in preprocessing_that
X = self._interpoler[feature_name].transform(X, z)
File "/public/home/cyli/.local/lib/python3.8/site-packages/pyxpcm/utils.py", line 208, in transform
C = C.interp(coords={vertical_dim: self.axis})
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/dataarray.py", line 1360, in interp
ds = self._to_temp_dataset().interp(
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/dataset.py", line 2610, in interp
variables[name] = missing.interp(var, var_indexers, method, **kwargs)
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/missing.py", line 611, in interp
var, indexes_coords = _localize(var, indexes_coords)
File "/public/home/cyli/.local/lib/python3.8/site-packages/xarray/core/missing.py", line 552, in _localize
imin = index.get_loc(np.min(new_x.values))
File "/public/home/cyli/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3655, in get_loc
raise KeyError(key) from err
KeyError: -1990.0
At the final error point, I modified the get_loc function from index.get_loc(np.min(new_x.values), method='nearest') to index.get_loc(np.min(new_x.values)). The direct execution shows an error, and after checking the documentation, it seems that get_loc does not have a method parameter. I removed it on my own and am not sure if this is causing the error.
The text was updated successfully, but these errors were encountered: