Skip to content

Commit

Permalink
Merge pull request #623 from British-Oceanographic-Data-Centre/featur…
Browse files Browse the repository at this point in the history
…e/reformat_read_bodc

update read_bodc dimension to include id_dim
  • Loading branch information
jpolton authored Oct 13, 2023
2 parents 80d994e + 00bd87a commit 3d7bc2c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions coast/data/tidegauge.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,18 @@ def read_bodc(self, fn_bodc, date_start=None, date_end=None):
except:
raise Exception("Problem reading BODC file: " + fn_bodc)
# Attributes
dataset["longitude"] = header_dict["longitude"]
dataset["latitude"] = header_dict["latitude"]
dataset["longitude"] = ("id_dim", [header_dict["longitude"]])
dataset["latitude"] = ("id_dim", [header_dict["latitude"]])
dataset["id_name"] = ("id_dim", [header_dict["site_name"]])
dataset = dataset.set_coords(["longitude", "latitude", "id_name"])

del header_dict["longitude"]
del header_dict["latitude"]
del header_dict["site_name"]

dataset.attrs = header_dict
self.dataset = dataset
self.apply_config_mappings()

@staticmethod
def _read_bodc_header(fn_bodc):
Expand Down

0 comments on commit 3d7bc2c

Please # to comment.