|
88 | 88 | F_JPEG = 'jpeg'
|
89 | 89 | F_MVT = 'mvt'
|
90 | 90 | F_NETCDF = 'NetCDF'
|
| 91 | +F_ZARR = 'zarr' |
91 | 92 |
|
92 | 93 | #: Formats allowed for ?f= requests (order matters for complex MIME types)
|
93 | 94 | FORMAT_TYPES = OrderedDict((
|
|
98 | 99 | (F_JPEG, 'image/jpeg'),
|
99 | 100 | (F_MVT, 'application/vnd.mapbox-vector-tile'),
|
100 | 101 | (F_NETCDF, 'application/x-netcdf'),
|
| 102 | + (F_ZARR, 'application/zip+zarr'), |
101 | 103 | ))
|
102 | 104 |
|
103 | 105 | #: Locale used for system responses (e.g. exceptions)
|
@@ -1113,27 +1115,28 @@ def describe_collections(self, request: Union[APIRequest, Any],
|
1113 | 1115 | 'title': l10n.translate('Coverage data', request.locale),
|
1114 | 1116 | 'href': f'{self.get_collections_url()}/{k}/coverage?f={F_JSON}' # noqa
|
1115 | 1117 | })
|
1116 |
| - if collection_data_format is not None: |
1117 |
| - title_ = l10n.translate('Coverage data as', request.locale) # noqa |
1118 |
| - title_ = f"{title_} {collection_data_format['name']}" |
1119 |
| - collection['links'].append({ |
1120 |
| - 'type': collection_data_format['mimetype'], |
1121 |
| - 'rel': f'{OGC_RELTYPES_BASE}/coverage', |
1122 |
| - 'title': title_, |
1123 |
| - 'href': f"{self.get_collections_url()}/{k}/coverage?f={collection_data_format['name']}" # noqa |
1124 |
| - }) |
1125 |
| - |
1126 | 1118 | # Hardcode netcdf format for xarray provider
|
1127 |
| - if (collection_data['name'] == 'xarray' and |
1128 |
| - collection_data_format['name'] == 'zarr'): |
1129 |
| - title_ = l10n.translate('Coverage data as', request.locale) |
1130 |
| - title_ = f"{title_} {F_NETCDF}" |
1131 |
| - collection['links'].append({ |
1132 |
| - 'type': FORMAT_TYPES[F_NETCDF], |
1133 |
| - 'rel': f'{OGC_RELTYPES_BASE}/coverage', |
1134 |
| - 'title': title_, |
1135 |
| - 'href': f"{self.get_collections_url()}/{k}/coverage?f={F_NETCDF}" # noqa |
1136 |
| - }) |
| 1119 | + if collection_data['name'] == 'xarray': |
| 1120 | + data_formats = [ |
| 1121 | + {'name': F_NETCDF, 'mimetype': FORMAT_TYPES[F_NETCDF]}, |
| 1122 | + {'name': F_ZARR, 'mimetype': FORMAT_TYPES[F_ZARR]} |
| 1123 | + ] |
| 1124 | + elif collection_data_format is not None: |
| 1125 | + data_formats = [collection_data_format] |
| 1126 | + else: |
| 1127 | + data_formats = [] |
| 1128 | + |
| 1129 | + for data_format in data_formats: |
| 1130 | + title_ = l10n.translate('Coverage data as', request.locale) # noqa |
| 1131 | + title_ = f"{title_} {data_format['name']}" |
| 1132 | + collection['links'].append( |
| 1133 | + { |
| 1134 | + 'type': data_format['mimetype'], |
| 1135 | + 'rel': f'{OGC_RELTYPES_BASE}/coverage', |
| 1136 | + 'title': title_, |
| 1137 | + 'href': f"{self.get_collections_url()}/{k}/coverage?f={data_format['name']}", # noqa |
| 1138 | + } |
| 1139 | + ) |
1137 | 1140 |
|
1138 | 1141 | if dataset is not None:
|
1139 | 1142 | LOGGER.debug('Creating extended coverage metadata')
|
|
0 commit comments