def nc(self): """Get the xarray dataset for this file.""" f_obj = open_file_or_filename(self.filename) try: nc = xr.open_dataset( f_obj, decode_cf=True, mask_and_scale=False, chunks={ 'x': CHUNK_SIZE, 'y': CHUNK_SIZE }, ) except ValueError: nc = xr.open_dataset( f_obj, decode_cf=True, mask_and_scale=False, chunks={ 'lon': CHUNK_SIZE, 'lat': CHUNK_SIZE }, ) nc = self._rename_dims(nc) return nc
def nc(self): """Get the nc xr dataset.""" f_obj = open_file_or_filename(self.filename) dataset = xr.open_dataset(f_obj, decode_cf=True, mask_and_scale=True, engine=self._engine, chunks={ 'columns': CHUNK_SIZE, 'rows': CHUNK_SIZE }) return dataset.rename({'columns': 'x', 'rows': 'y'})
def open_dataset(filename, *args, **kwargs): """Open a file with xarray. Args: filename (Union[str, FSFile]): The path to the file to open. Can be a `string` or :class:`~satpy.readers.FSFile` object which allows using `fsspec` or `s3fs` like files. Returns: xarray.Dataset: Notes: This can be used to enable readers to open remote files. """ f_obj = open_file_or_filename(filename) return xr.open_dataset(f_obj, *args, **kwargs)