Skip to content

Commit

Permalink
Add appropriate time bounds to canopy height data set
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchilperoort committed Jul 10, 2024
1 parent d396e48 commit 33c5cd9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/zampy/datasets/eth_canopy_height.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,17 @@ def parse_tiff_file(file: Path, sd_file: bool = False) -> xr.Dataset:
da = da.isel(band=0) # get rid of band dim
da = da.drop_vars(["band", "spatial_ref"]) # drop unnecessary coords
ds = da.to_dataset()
ds = ds.assign_coords( # halfway in the year
{"time": np.datetime64("2020-07-01").astype("datetime64[ns]")}
ds = xr.concat( # Cover entirety of 2020
(
ds.assign_coords(
{"time": np.datetime64("2020-01-01").astype("datetime64[ns]")}
),
ds.assign_coords(
{"time": np.datetime64("2021-01-01").astype("datetime64[ns]")}
),
),
dim="time",
)
ds = ds.expand_dims("time")
ds = ds.rename(
{
"band_data": "height_of_vegetation_standard_deviation"
Expand Down

0 comments on commit 33c5cd9

Please sign in to comment.