Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 10, 2021
1 parent 927d2cf commit c4f8e09
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions echopype/echodata/echodata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import uuid
import warnings
from collections import OrderedDict
import datetime
from html import escape
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Optional
Expand Down Expand Up @@ -73,6 +73,7 @@ def _encode_dataarray(da, dtype):
encoded_data, _, _ = coding.times.encode_cf_datetime(da, **read_encoding)
return coding.times.decode_cf_datetime(encoded_data, **read_encoding)


def set_encodings(ds: xr.Dataset) -> xr.Dataset:
"""
Set the default encoding for variables.
Expand All @@ -89,8 +90,11 @@ def set_encodings(ds: xr.Dataset) -> xr.Dataset:
new_ds[var].encoding = encoding

return new_ds


# ------------ End of duplicated block ----------------------------------------


class EchoData:
"""Echo data model class for handling raw converted data,
including multiple files associated with the same data set.
Expand Down Expand Up @@ -379,10 +383,10 @@ def squeeze_non_scalar(n):
)

def update_platform(
self,
extra_platform_data: xr.Dataset,
time_dim="time",
extra_platform_data_file_name=None
self,
extra_platform_data: xr.Dataset,
time_dim="time",
extra_platform_data_file_name=None,
):
"""
Updates the `EchoData.platform` group with additional external platform data.
Expand Down Expand Up @@ -460,7 +464,9 @@ def update_platform(
location_time=extra_platform_data[time_dim].values
)
platform["location_time"].assign_attrs(**DEFAULT_PLATFORM_COORD_ATTRS)
history_attr = f"{datetime.datetime.utcnow()} +00:00. Added from external platform data"
history_attr = (
f"{datetime.datetime.utcnow()} +00:00. Added from external platform data"
)
if extra_platform_data_file_name:
history_attr += ", from file " + extra_platform_data_file_name
platform["location_time"].assign_attrs(history=history_attr)
Expand Down

0 comments on commit c4f8e09

Please sign in to comment.