Skip to content

Commit

Permalink
Change printing of projectables and cleanup.
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
mraspaud committed Jun 23, 2015
1 parent 858aed7 commit 0dd8098
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions mpop/plugin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, name, config_file, **kwargs):
- `scene`: the scene to fill.
"""
#TODO make config_file optional
#TODO put times, area and description in .info (it's metadata)
Plugin.__init__(self)
self.name = name
self.config_file = config_file
Expand All @@ -53,6 +54,7 @@ def __init__(self, name, config_file, **kwargs):
self.start_time = kwargs.pop("start_time", None)
self.end_time = kwargs.pop("end_time", None)
self.area = kwargs.pop("area", None)

self.channels = {}

self.load_config()
Expand Down
25 changes: 19 additions & 6 deletions mpop/projectable.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,32 @@ def __str__(self):
if "sensor" in self.info:
res[0] = self.info["sensor"] + "/" + res[0]

if "wavelength_range" in self.info:
res.append("{0} μm".format(self.info["wavelength_range"]))
if "resolution" in self.info:
res.append("{0} m".format(self.info["resolution"]))

for key in sorted(self.info.keys()):
if key == "wavelength_range":
res.append("{0}: {1} μm".format(key, self.info[key]))
elif key == "resolution":
res.append("{0}: {1} m".format(key, self.info[key]))
elif key == "area":
res.append("{0}: {1}".format(key, self.info[key].name))
elif key in ["name", "sensor"]:
continue
else:
res.append("{0}: {1}".format(key, self.info[key]))

# if "wavelength_range" in self.info:
# res.append("{0} μm".format(self.info["wavelength_range"]))
# if "resolution" in self.info:
# res.append("{0} m".format(self.info["resolution"]))
# for key in self.info:
# if key not in ["sensor", "wavelength_range", "resolution", "name"]:
# res.append(str(self.info[key]))
if self.data is not None:
try:
res.append("{0}".format(self.data.shape))
res.append("shape: {0}".format(self.data.shape))
except AttributeError:
pass
else:
res.append("not loaded")

return res[0] + ", ".join(res[1:])
return "\n\t".join(res)
8 changes: 2 additions & 6 deletions mpop/readers/mipp_xrit.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, 2013, 2014.

# SMHI,
# Folkborgsvägen 1,
# Norrköping,
# Sweden
# Copyright (c) 2010, 2011, 2013, 2014, 2015.

# Author(s):

Expand Down Expand Up @@ -146,6 +141,7 @@ def load(self, channels_to_load, calibrate=True, areas=None, **kwargs):
name=chn,
units=metadata.calibration_unit,
wavelength_range=self.channels[chn]["wavelength_range"],
sensor=self.channels[chn]["sensor"],
start_time=self.start_time)

# satscene[chn] = data
Expand Down

0 comments on commit 0dd8098

Please sign in to comment.