Skip to content

Commit

Permalink
Merge pull request #163 from pytroll/bugfix-float-geotiff
Browse files Browse the repository at this point in the history
Bugfix float geotiff
  • Loading branch information
djhoese authored Jan 26, 2018
2 parents 374741e + b0c15ec commit 58d2ec8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
17 changes: 8 additions & 9 deletions satpy/writers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,16 @@ def get_enhanced_image(dataset,
if enhancer is None:
enhancer = Enhancer(ppp_config_dir, enhancement_config_file)

if enhancer.enhancement_tree is None:
raise RuntimeError(
"No enhancement configuration files found or specified, cannot"
" automatically enhance dataset")

if dataset.attrs.get("sensor", None):
enhancer.add_sensor_enhancements(dataset.attrs["sensor"])

# Create an image for enhancement
img = to_image(dataset, mode=mode, fill_value=fill_value)
enhancer.apply(img, **dataset.attrs)

if enhancer.enhancement_tree is None:
LOG.debug("No enhancement being applied to dataset")
else:
if dataset.attrs.get("sensor", None):
enhancer.add_sensor_enhancements(dataset.attrs["sensor"])

enhancer.apply(img, **dataset.attrs)

img.info.update(dataset.attrs)

Expand Down
14 changes: 14 additions & 0 deletions satpy/writers/geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@


class GeoTIFFWriter(ImageWriter):

"""Writer to save GeoTIFF images.
Basic example from Scene:
scn.save_datasets(writer='geotiff')
Un-enhanced float geotiff with NaN for fill values:
scn.save_datasets(writer='geotiff', floating_point=True,
enhancement_config=False, fill_value=np.nan)
"""

GDAL_OPTIONS = ("tfw",
"rpb",
"rpctxt",
Expand Down

0 comments on commit 58d2ec8

Please sign in to comment.