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

Bug in config_clm #98

Open
aktriplett opened this issue Sep 5, 2024 · 0 comments
Open

Bug in config_clm #98

aktriplett opened this issue Sep 5, 2024 · 0 comments

Comments

@aktriplett
Copy link
Contributor

I am attaching the traceback for a bug I've started getting. So far I get this error when attempting to subset for HUC02 and HUC0205, I do not get it when I subset for HUC020502 or HUC02050202. It occurs in the function st.config_clm(), and more specifically in _write_land_cover().


ValueError Traceback (most recent call last)
Cell In[17], line 1
----> 1 clm_paths = st.config_clm(ij_bounds, start=start, end=end, dataset=var_ds, write_dir=static_write_dir)

File /home/SHARED/virtual-environments/conda/lib/python3.11/site-packages/subsettools/clm.py:98, in config_clm(ij_bounds, start, end, dataset, write_dir, time_zone)
96 subset_data = get_hf_gridded_data(options)
97 land_cover_data = _reshape_ndarray_to_vegm_format(subset_data)
---> 98 file_path = _write_land_cover(land_cover_data, write_dir)
99 file_paths[file_type] = file_path
100 print("subset vegm")

File /home/SHARED/virtual-environments/conda/lib/python3.11/site-packages/subsettools/clm.py:187, in _write_land_cover(land_cover_data, write_dir)
185 header = "\n".join([heading, " ".join(vegm_col_names)])
186 file_path = os.path.join(write_dir, "drv_vegm.dat")
--> 187 np.savetxt(
188 fname=file_path,
189 X=land_cover_data,
190 delimiter=" ",
191 comments="",
192 header=header,
193 fmt=["%d"] * 2 + ["%.6f"] * 2 + ["%.2f"] * 2 + ["%d"] * 19,
194 )
195 return file_path

File <array_function internals>:200, in savetxt(*args, **kwargs)

File /home/SHARED/virtual-environments/conda/lib/python3.11/site-packages/numpy/lib/npyio.py:1608, in savetxt(fname, X, fmt, delimiter, newline, header, footer, comments, encoding)
1606 for row in X:
1607 try:
-> 1608 v = format % tuple(row) + newline
1609 except TypeError as e:
1610 raise TypeError("Mismatch between array dtype ('%s') and "
1611 "format specifier ('%s')"
1612 % (str(X.dtype), format)) from e

ValueError: cannot convert float NaN to integer

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