Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_features(self, service):
service = self._layers()[service]
features = util.to_geodataframe(
ned.get_raster_availability(service, (-180, -90, 180, 90))
)
if features.empty:
return features
features['parameters'] = 'elevation'
features['file_format'] = 'raster-gdal'
features['filename'] = features['download url'].apply(lambda x: x.split('/')[-1])
columns = {
'name': 'display_name',
'download url': 'download_url',
'format': 'extract_from_zip',
}
features['reserved'] = features['download url'].apply(lambda x: {'download_url': x, 'file_format': 'raster-gdal','extract_from_zip': '.DEM'})
return features.rename(columns=columns)
def search_catalog(self, **kwargs):
service = self._description
catalog_entries = util.to_geodataframe(
ned.get_raster_availability(service, (-180, -90, 180, 90))
)
if catalog_entries.empty:
return catalog_entries
catalog_entries['parameters'] = 'elevation'
catalog_entries['filename'] = catalog_entries['download url'].apply(lambda x: x.split('/')[-1])
catalog_entries['reserved'] = catalog_entries.apply(
lambda x: {'download_url': x['download url'],
'filename': x['filename'],
'file_format': 'raster-gdal',
'extract_from_zip': '.img',
}, axis=1)
catalog_entries.drop(labels=['filename', 'download url', 'format'], axis=1, inplace=True)
return catalog_entries.rename(columns={'name': 'display_name'})