MIPP
MPOP's (level-1b) reader of XRIT and SAR data
(and saving support expenses for a commercial MSG system)
26/11 2012 Pytroll Workshop at SMHI
Modules
mipp/xrit/MSG.py # meteosat-9, 10
mipp/xrit/MTP.py # meteosat-7
mipp/xrit/SGS.py # goes, mtsat
mipp/xrit/GOMS.py # electro-l N1
mipp/xsar/CSK.py # cosmo-sky-med
mipp/xsar/RS2.py # radarsat-2 (in work)
mipp/xsar/TSX.py # terrasar-x (in work)
Interfacing MPOP
mpop/satin/mipp_xrit.py
mpop/satin/mipp_xsar.py
# MPOP wants
def load(satname, timestamp, channel, ...):
...
...
return metadata, data
Or used direct (browsing)
msg_files = [
datadir + '/H-000-MSG2__-MSG2________-_________-PRO______-201010111400-__',
...
datadir + '/H-000-MSG2__-MSG2________-IR_108___-000004___-201010111400-__',
datadir + '/H-000-MSG2__-MSG2________-IR_108___-000005___-201010111400-__',
...
datadir + '/H-000-MSG2__-MSG2________-_________-EPI______-201010111400-__']
# Initialize
loader = xrit.sat.load_files(msg_files[0], msg_files[1:-1], epilogue=msg_files[-1],
calibrate=True)
# Only load what is needed
mda, img = loader[1656:1956,1756:2656]
...
# Print meta-data
print mda
calibration_unit: counts
channel: IR_108
data_type: 10
image_size: [3712, 3712]
no_data_value: 0
product_name: MSG2_IR_108_20101011_1400
product_type: full disc
production_time: 2010-10-11 14:15:10.623000
region_name: full disc
satname: msg2
sublon: 0.0
time_stamp: 2010-10-11 14:00:00
# Or
> python ./MSG.py <pro-file> <image-files> <epi-file>
...
# Browsing segments
>python ./_xrit.py H-000-MSG2__-MSG2________-IR_108___-000004___-201010111400-__
hdr_type:0, rec_len:16, file_type:0, total_hdr_len:6198, data_field_len:17223680
hdr_type:1, rec_len:9, nb:10, nc:3712, nl:464, compress_flag:0
hdr_type:2, rec_len:51, proj_name:'GEOS(+000.0)', cfac:-13642337, lfac:-13642337. coff:1856, loff:464
hdr_type:4, rec_len:64, text:H-000-MSG2__-MSG2________-IR_108___-000004___-201010111400-__
hdr_type:5, rec_len:10, time_stamp:2010-10-11 14:15:10.623000
hdr_type:128, rec_len:13 gp_sc_id:322, spectral_channel_id:9, seg_no:4, planned_start_seg_no:1, planned_end_seg_no:8, data_field_repr:0
hdr_type:129, rec_len:6035
CosmoSkyMed example
import sys
import numpy as np
from scipy import stats
import logging
import mpop
from mpop.satellites import PolarFactory
from datetime import datetime
from mpop.imageo import geo_image
from mpop.projector import get_area_def
LOG = mpop.utils.get_logger('sar-avg')
LOG.setLevel(logging.DEBUG)
# Using $PPP_CONFIG_DIR/csks4.cfg
...
# Using $PPP_CONFIG_DIR/csks4.cfg
scene = PolarFactory.create_scene('csks', '4', 'sarx', datetime(2012, 8, 30, 8, 15, 54))
scene.load([9.65,], calibrate=False)
LOG.info('Area scene: %s'%scene[9.65].area)
image = scene.image.average(2, 3, clip_percentage=(0.1, 3.0))
LOG.info('Image size: %d x %d', image.shape[1], image.shape[0])
data = image.channels[0]
LOG.info('Data range: %.2f, %.2f, %.2f', data.min(), data.mean(), data.max())
image.save('CSKS4_20120830-081554.tif')
...
Todo and comments
Just thinking loud.