Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetCDF writer doesn't work #123

Closed
pnuu opened this issue Dec 12, 2017 · 1 comment · Fixed by #307
Closed

NetCDF writer doesn't work #123

pnuu opened this issue Dec 12, 2017 · 1 comment · Fixed by #307
Assignees
Labels
Milestone

Comments

@pnuu
Copy link
Member

pnuu commented Dec 12, 2017

Code Sample, a minimal, complete, and verifiable piece of code

from satpy import Scene
from satpy.utils import debug_on
import glob

debug_on()
fnames = glob.glob("/home/lahtinep/data/satellite/viirs/*b30342*")
glbl = Scene(reader="viirs_sdr", filenames=fnames)
glbl.load(['I05'])
lcl = glbl.resample('euro4')

# This works
lcl.save_datasets(writer='geotiff', filename='/tmp/foo.tif')

# This doesn't
lcl.save_datasets(writer='cf', filename='/tmp/foo.nc')

Problem description

As seen from the trace below, the NetCDF writer uses cf.Domain which seems to be removed from the cf-python package, and therefore fails to save the data.

Actual Result, Traceback if applicable

[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-24-58ece08c15f3> in <module>()
----> 1 lcl.save_datasets(writer='cf', filename='/tmp/foo.nc')

/home/lahtinep/Software/pytroll/packages/satpy/satpy/scene.pyc in save_datasets(self, writer, datasets, **kwargs)
    632             datasets = self.datasets.values()
    633         writer = self.get_writer(writer, **kwargs)
--> 634         writer.save_datasets(datasets, **kwargs)
    635 
    636     def get_writer(self, writer="geotiff", **kwargs):

/home/lahtinep/Software/pytroll/packages/satpy/satpy/writers/cf_writer.pyc in save_datasets(self, datasets, filename, **kwargs)
    176                     coords = [line_coord, pixel_coord]
    177 
--> 178                 domain = cf.Domain(dim=coords,
    179                                    aux=aux,
    180                                    ref=grid_mapping)

AttributeError: 'module' object has no attribute 'Domain'

Versions of Python, package at hand and relevant dependencies

SatPy 0.7.5, cf-python 2.1.2, Python 2.7.12

@mraspaud
Copy link
Member

cf-python is broken, so this version of the cf-writer is broken too. A fix is implemented in PR #83 .

@mraspaud mraspaud self-assigned this Dec 14, 2017
@mraspaud mraspaud added this to the v0.9 milestone Dec 15, 2017
@mraspaud mraspaud added the bug label Dec 15, 2017
adybbroe added a commit to adybbroe/satpy that referenced this issue Dec 2, 2021
Add a utility function to decode HDF5 strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants