MemoryError: Unable to allocate 29.7 GiB for an array with shape (86399, 4, 4, 2880, 2) and data type float32 #13153
Unanswered
nunu346
asked this question in
Help: Coding & Implementations
Replies: 1 comment
-
It looks like you might have reported this in the wrong repo? How does this relate to spacy? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
import xarray as xr
netcdf_file_in =r'C:\Users\Mg\Desktop\ops_exis-l1b-sfxr_g16_d20210601_v0-0-0.nc'
csv_file_out = r'C:\Users\Mg\Desktop\ops_exis-l1b-sfxr_g16_d20210601_v0-0-0.csv'
ds = xr.open_dataset(netcdf_file_in)
df = ds.to_dataframe()
df.to_csv(csv_file_out)
ds.close()
print(f"Conversion from NetCDF to CSV complete. CSV file saved at: {csv_file_out}")
error
MemoryError Traceback (most recent call last)
Cell In[6], line 13
10 ds = xr.open_dataset(netcdf_file_in)
12 # Convert the dataset to a pandas DataFrame
---> 13 df = ds.to_dataframe()
15 # Save the DataFrame to a CSV file
16 df.to_csv(csv_file_out)
File ~\anaconda3\Lib\site-packages\xarray\core\dataset.py:6289, in Dataset.to_dataframe(self, dim_order)
6261 """Convert this dataset into a pandas.DataFrame.
6262
6263 Non-index variables in this dataset form the columns of the
(...)
6284
6285 """
6287 ordered_dims = self._normalize_dim_order(dim_order=dim_order)
-> 6289 return self._to_dataframe(ordered_dims=ordered_dims)
File ~\anaconda3\Lib\site-packages\xarray\core\dataset.py:6253, in Dataset._to_dataframe(self, ordered_dims)
6251 def _to_dataframe(self, ordered_dims: Mapping[Any, int]):
6252 columns = [k for k in self.variables if k not in self.dims]
-> 6253 data = [
6254 self._variables[k].set_dims(ordered_dims).values.reshape(-1)
6255 for k in columns
6256 ]
6257 index = self.coords.to_index([*ordered_dims])
6258 return pd.DataFrame(dict(zip(columns, data)), index=index)
File ~\anaconda3\Lib\site-packages\xarray\core\dataset.py:6254, in (.0)
6251 def _to_dataframe(self, ordered_dims: Mapping[Any, int]):
6252 columns = [k for k in self.variables if k not in self.dims]
6253 data = [
-> 6254 self._variables[k].set_dims(ordered_dims).values.reshape(-1)
6255 for k in columns
6256 ]
6257 index = self.coords.to_index([*ordered_dims])
6258 return pd.DataFrame(dict(zip(columns, data)), index=index)
MemoryError: Unable to allocate 29.7 GiB for an array with shape (86399, 4, 4, 2880, 2) and data type float32
Beta Was this translation helpful? Give feedback.
All reactions