diff --git a/pygeoapi/api/__init__.py b/pygeoapi/api/__init__.py index 37f8a3c7b..b47541f23 100644 --- a/pygeoapi/api/__init__.py +++ b/pygeoapi/api/__init__.py @@ -1122,19 +1122,6 @@ def describe_collections(self, request: Union[APIRequest, Any], 'title': title_, 'href': f"{self.get_collections_url()}/{k}/coverage?f={collection_data_format['name']}" # noqa }) - - # Hardcode netcdf format for xarray provider - if (collection_data['name'] == 'xarray' and - collection_data_format['name'] == 'zarr'): - title_ = l10n.translate('Coverage data as', request.locale) - title_ = f"{title_} {F_NETCDF}" - collection['links'].append({ - 'type': FORMAT_TYPES[F_NETCDF], - 'rel': f'{OGC_RELTYPES_BASE}/coverage', - 'title': title_, - 'href': f"{self.get_collections_url()}/{k}/coverage?f={F_NETCDF}" # noqa - }) - if dataset is not None: LOGGER.debug('Creating extended coverage metadata') try: diff --git a/pygeoapi/provider/xarray_.py b/pygeoapi/provider/xarray_.py index 46bcf5b92..ba835f033 100644 --- a/pygeoapi/provider/xarray_.py +++ b/pygeoapi/provider/xarray_.py @@ -257,9 +257,6 @@ def query(self, properties=[], subsets={}, bbox=[], bbox_crs=4326, elif format_ == 'zarr': LOGGER.debug('Returning data in native zarr format') return _get_zarr_data(data) - elif format_ == 'netcdf': - LOGGER.debug('Returning data in netcdf format') - return _get_netcdf_data(data) else: # return data in native format with tempfile.NamedTemporaryFile() as fp: LOGGER.debug('Returning data in native NetCDF format') @@ -674,22 +671,6 @@ def _get_zarr_data(data): return fh.read() -def _get_netcdf_data(data: xarray.Dataset): - """ - Returns bytes to read from netcdf file - :param data: Xarray dataset of coverage data - - :returns: byte array of netcdf data - """ - - with tempfile.NamedTemporaryFile() as fp: - data.to_netcdf( - fp.name - ) # we need to pass a string to be able to use the "netcdf4" engine - fp.seek(0) - return fp.read() - - def _convert_float32_to_float64(data): """ Converts DataArray values of float32 to float64