Skip to content

Commit

Permalink
cast to float64
Browse files Browse the repository at this point in the history
  • Loading branch information
dmey authored and juntyr committed Jul 22, 2024
1 parent bfb5e51 commit 598baf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cfgrib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ class OnDiskArray:
)
missing_value: float
geo_ndim: int = attr.attrib(default=1, repr=False)
dtype = np.dtype("float32")
dtype = np.dtype("float64")

def build_array(self) -> np.ndarray:
"""Helper method used to test __getitem__"""
array = np.full(self.shape, fill_value=np.nan, dtype="float32")
array = np.full(self.shape, fill_value=np.nan, dtype="float64")
for header_indexes, message_ids in self.field_id_index.items():
# NOTE: fill a single field as found in the message
message = self.index.get_field(message_ids[0]) # type: ignore
Expand All @@ -363,7 +363,7 @@ def __getitem__(self, item):
header_item_list = expand_item(item[: -self.geo_ndim], self.shape)
header_item = [{ix: i for i, ix in enumerate(it)} for it in header_item_list]
array_field_shape = tuple(len(i) for i in header_item_list) + self.shape[-self.geo_ndim :]
array_field = np.full(array_field_shape, fill_value=np.nan, dtype="float32")
array_field = np.full(array_field_shape, fill_value=np.nan, dtype="float64")
for header_indexes, message_ids in self.field_id_index.items():
try:
array_field_indexes = [it[ix] for it, ix in zip(header_item, header_indexes)]
Expand Down

0 comments on commit 598baf3

Please sign in to comment.