Skip to content

Commit

Permalink
replace np.empty with np full nan (#328)
Browse files Browse the repository at this point in the history
* replace np.empty with np full nan

* fix lint
  • Loading branch information
danangmassandy authored Dec 24, 2024
1 parent ff1e39a commit f073ca0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion django_project/gap/ingestor/cbam_bias_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ def _append_new_date(
}
}
for var in self.variables:
empty_data = da.empty(empty_shape, chunks=chunks)
empty_data = da.full(
empty_shape, np.nan, dtype='f8', chunks=chunks
)
data_vars[var] = (
['date', 'lat', 'lon'],
empty_data
Expand Down
6 changes: 4 additions & 2 deletions django_project/gap/ingestor/tio_shortterm.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ def _append_new_forecast_date(
}
}
for var in self.variables:
empty_data = da.empty(empty_shape, chunks=chunks)
empty_data = da.full(
empty_shape, np.nan, dtype='f8', chunks=chunks
)
data_vars[var] = (
['forecast_date', 'forecast_day_idx', 'lat', 'lon'],
empty_data
Expand Down Expand Up @@ -532,7 +534,7 @@ def _process_tio_shortterm_data(
# initialize empty new data for each variable
new_data = {}
for variable in self.variables:
new_data[variable] = np.empty(data_shape)
new_data[variable] = np.full(data_shape, np.nan, dtype='f8')

for idx_lat, lat in enumerate(lat_arr):
for idx_lon, lon in enumerate(lon_arr):
Expand Down

0 comments on commit f073ca0

Please sign in to comment.