Skip to content

Commit

Permalink
Merge branch '348-fix-get-metadata-for-plugin-libsgm' into 'master'
Browse files Browse the repository at this point in the history
add classif and segm in get_metadata dataset

Closes #348

See merge request 3d/PandoraBox/pandora!277
  • Loading branch information
adebardo committed Aug 29, 2023
2 parents 2e40bcf + 025d49e commit 966e35d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pandora/check_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,25 @@ def get_metadata(
}
attrs = {"disp_min": disp_min, "disp_max": disp_max}
dataset = xr.Dataset(data_vars={}, coords=coords, attrs=attrs)
default_dataarray = xr.DataArray(
data=np.zeros([coords["row"], coords["col"]]),
coords={
"row": np.arange(coords["row"]),
"col": np.arange(coords["col"]),
},
dims=["row", "col"],
)

if classif is not None:
classif_ds = rasterio_open(classif)
band_classif = list(classif_ds.descriptions)
dataset.coords["band_classif"] = band_classif
dataset.attrs["classif"] = True
dataset["classif"] = default_dataarray

if segm is not None:
dataset.attrs["segm"] = True
dataset["segm"] = default_dataarray

return dataset

Expand Down

0 comments on commit 966e35d

Please sign in to comment.