def main(): import sys from mpop.utils import debug_on debug_on() scene = AAPP1b(sys.argv[1]) scene.read() for name, val in zip(scene._header[0].dtype.names, scene._header[0][0]): print(name + " " + str(val)) starttime = datetime.datetime(scene._header[0][0]["startdatayr"], 1, 1, 0, 0) starttime += \ datetime.timedelta(days=int(scene._header[0][0]["startdatady"]) - 1, seconds=scene._header[0][0]["startdatatime"] / 1000.0) print("starttime: " + str(starttime)) endtime = datetime.datetime(scene._header[-1][0]["enddatayr"], 1, 1, 0, 0) endtime += \ datetime.timedelta(days=int(scene._header[-1][0]["enddatady"]) - 1, seconds=scene._header[-1][0]["enddatatime"] / 1000.0) print("endtime: " + str(endtime)) # print scene._data['hrpt'].shape # show(scene._data['hrpt'][:, :, 4].astype(np.float)) # raw_input() scene.calibrate() scene.navigate() for i__ in AVHRR_CHANNEL_NAMES: data_ = scene.channels[i__] print >> sys.stderr, "%-3s" % i__, \ "%6.2f%%" % (100. * (float(np.ma.count(data_)) / data_.size)), \ "%6.2f, %6.2f, %6.2f" % (data_.min(), data_.mean(), data_.max()) show(scene.channels['2'], negate=False)
def cached_lonlats(scene): from mpop.utils import debug_on debug_on() flon = "/tmp/lons" + str(scene.time_slot) + ".npy" flat = "/tmp/lats" + str(scene.time_slot) + ".npy" try: raise IOError #lons, lats = np.load(flon), np.load(flat) except IOError: scene.load() #lons = scene.area.lons[:, 24:2048:40] #lats = scene.area.lats[:, 24:2048:40] lons = scene.area.lons lats = scene.area.lats np.save(flon, lons) np.save(flat, lats) return lons, lats
from mpop.imageo import palettes from mpop.imageo import geo_image from pyresample import image, geometry from PIL import Image from pycoast import ContourWriterAGG from mpop.projector import get_area_def from PIL import Image from PIL import ImageFont from PIL import ImageDraw import datetime import aggdraw from mpop.utils import debug_on debug_on() from trollimage.colormap import rdbu, greys, rainbow, spectral from trollimage.image import Image as trollimage import datetime #SAFNWC_MSG2_CT___201412021350_alps________.h5 debug_on() time_slot = datetime.datetime(2015, 7, 9, 13, 00) #area = get_area_def("alps") global_data = GeostationaryFactory.create_scene("meteosat", "09", "seviri",
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from posttroll.publisher import Publisher, get_own_ip from posttroll.subscriber import Subscriber from posttroll.message import Message from multiprocessing import Pool from multiprocessing import Pipe from collections import deque from mpop.utils import debug_on debug_on() #from multiprocessing import Process from threading import Thread as Process import time OWN_PORT = 9000 OWN_ADDRESS = str(get_own_ip()) #OWN_ADDRESS = str("127.0.0.1") JOONAS_PORT = 9000 JOONAS_ADDRESS = "10.240.23.37" class Listener(object):