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

timestep_min None instead of np.nan #156

Closed
veenstrajelmer opened this issue Nov 8, 2023 · 1 comment
Closed

timestep_min None instead of np.nan #156

veenstrajelmer opened this issue Nov 8, 2023 · 1 comment

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Nov 8, 2023

Replace np.nan with None when reading timeseries in timeseries.py:

hatyan/hatyan/timeseries.py

Lines 1410 to 1412 in 42c9e23

if len(data_meta_mincontent)==5: #nonequidistant timeseries
timestep_value = np.nan #TODO: None is supported by pandas 2.1.2 and maybe earlier versions, but not 2.0.3 (py39 only)
timestep_unit = np.nan

Altough, None in dataframes seems not supported by older pandas versions (ends up being nan anyway). So wait until support for Python 3.8 is dropped (#87)

Also update equidistant check in timeseries.py:

hatyan/hatyan/timeseries.py

Lines 1582 to 1583 in 42c9e23

if np.isnan(diablocks_pd.loc[block_id,'timestep_min']):
data_pd_oneblock = readts_dia_nonequidistant(filename_one, diablocks_pd, block_id)

Would avoid the need to overwrite nan with None in metadata.py:

if np.isnan(metadata['timestep_min']): #non-equidistant, nan in py38 and none in py39 (pandas 2.1.2)
metadata['timestep_min'] = None
metadata['timestep_unit'] = None

@veenstrajelmer
Copy link
Collaborator Author

Since timestep_min is not added as metadata anymore since #313, this issue is not relevant anymore.

@veenstrajelmer veenstrajelmer closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
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

1 participant