Skip to content

Commit

Permalink
Merge pull request #34 from c-hydro:dev
Browse files Browse the repository at this point in the history
fix(data): fix nan with integer data
  • Loading branch information
ltrotter authored Dec 11, 2024
2 parents 6d7571c + ef2d58c commit d9899e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion data/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def write_to_file(data, path, format: Optional[str] = None, append = False) -> N
if format is None:
format = get_format_from_path(path)

os.makedirs(os.path.dirname(path), exist_ok = True)
dir = os.path.dirname(path)
if len(dir) > 0:
os.makedirs(os.path.dirname(path), exist_ok = True)
if not os.path.exists(path):
append = False

Expand Down
8 changes: 6 additions & 2 deletions data/memory_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ def _read_data(self, input_key):
else:
return self.data_dict.pop(input_key)

def _write_data(self, output: xr.DataArray|pd.DataFrame, output_key: str):
def _write_data(self, output: xr.DataArray|pd.DataFrame, output_key: str, **kwargs):
self.data_dict[output_key] = output

def _rm_data(self, key):
self.data_dict.pop(key)

## METHODS TO CHECK DATA AVAILABILITY
def _check_data(self, data_path) -> bool:
return data_path in self.data_dict
for key in self.data_dict.keys():
if key.startswith(data_path):
return True
else:
return False

def _walk(self, prefix):
for key in self.data_dict.keys():
Expand Down

0 comments on commit d9899e6

Please sign in to comment.