(
product_path: esa_safe.PathType,
output_store: str,
groups: Dict[str, str] | None = None,
**kwargs: Any,
)
| 30 | # Apparently there is no way to save SLC images because "netcdf4" doesn't support complex data |
| 31 | # and "h5netcdf" crashes on an issue related to dimension names |
| 32 | def to_group_netcdf( |
| 33 | product_path: esa_safe.PathType, |
| 34 | output_store: str, |
| 35 | groups: Dict[str, str] | None = None, |
| 36 | **kwargs: Any, |
| 37 | ) -> None: |
| 38 | root = xr.open_dataset(product_path, engine="sentinel-1") |
| 39 | root.to_netcdf(output_store, mode="w", **kwargs) |
| 40 | |
| 41 | if groups is None: |
| 42 | groups = {g: g for g in root.attrs["subgroups"]} |
| 43 | |
| 44 | for group_out, group_in in groups.items(): |
| 45 | try: |
| 46 | group_ds = xr.open_dataset( |
| 47 | product_path, engine="sentinel-1", group=group_in |
| 48 | ) |
| 49 | group_ds.to_netcdf(output_store, mode="a", group=group_out, **kwargs) |
| 50 | except FileNotFoundError: |
| 51 | pass |
nothing calls this directly
no test coverage detected