예제 #1
0
파일: msg_hdf.py 프로젝트: 3Geo/mpop
# mpop.  If not, see <http://www.gnu.org/licenses/>.

"""Plugin for reading PPS's cloud products hdf files.
"""

import ConfigParser
import os.path
from mpop import CONFIG_PATH
import mpop.channel
import numpy as np

import glob
from mpop.utils import get_logger
from mpop.projector import get_area_def

LOG = get_logger('satin/msg_hdf')
COMPRESS_LVL = 6

def pcs_def_from_region(region):
    items = region.proj_dict.items()
    return ' '.join([ t[0] + '=' + t[1] for t in items])   

class PpsCloudType(mpop.channel.GenericChannel):
    def __init__(self):
        mpop.channel.GenericChannel.__init__(self, "CloudType")
        self.region = None
        self.des = ""
        self.cloudtype_des = ""
        self.qualityflag_des = ""
        self.phaseflag_des = ""
        self.sec_1970 = 0
예제 #2
0
in PPS v2014.
"""
import ConfigParser
from ConfigParser import NoOptionError

from datetime import datetime, timedelta
import os.path

import mpop.channel
from mpop import CONFIG_PATH
from mpop.utils import get_logger
import numpy as np

import h5py

LOG = get_logger('satin/nwcsaf_pps')

class InfoObject(object):
    """Simple data and info container.
    """
    def __init__(self):
        self.info = {}
        self.data = None

def pack_signed(data, data_type):
    bits = np.iinfo(data_type).bits
    scale_factor = (data.max() - data.min()) / (2**bits - 2)
    add_offset = (data.max() - data.min()) / 2
    no_data = - 2**(bits - 1)
    pack = ((data - add_offset) / scale_factor).astype(data_type)
    return pack, scale_factor, add_offset, no_data
예제 #3
0
# - complete projection list and attribute list
# - handle other units than "m" for coordinates
# - handle units for data
# - pluginize
import warnings
from ConfigParser import NoSectionError

import numpy as np
from netCDF4 import Dataset, num2date

from mpop.instruments.visir import VisirCompositer
from mpop.satellites import GenericFactory
from mpop.satout.cfscene import TIME_UNITS
from mpop.utils import get_logger

LOG = get_logger("netcdf4/cf reader")

# To be complete, get from appendix F of cf conventions
MAPPING_ATTRIBUTES = {
    'grid_mapping_name': "proj",
    'standard_parallel': ["lat_1", "lat_2"],
    'latitude_of_projection_origin': "lat_0",
    'longitude_of_projection_origin': "lon_0",
    'longitude_of_central_meridian': "lon_0",
    'perspective_point_height': "h",
    'false_easting': "x_0",
    'false_northing': "y_0",
    'semi_major_axis': "a",
    'semi_minor_axis': "b",
    'inverse_flattening': "rf",
    'ellipsoid': "ellps",  # not in CF conventions...
예제 #4
0
in PPS v2012, and before.
"""
import ConfigParser
from ConfigParser import NoOptionError

from datetime import datetime, timedelta
import os.path

import mpop.channel
from mpop import CONFIG_PATH
from mpop.utils import get_logger
import numpy as np

import h5py

LOG = get_logger('satin/nwcsaf_pps')


class InfoObject(object):

    """Simple data and info container.
    """

    def __init__(self):
        self.info = {}
        self.data = None


def pack_signed(data, data_type):
    bits = np.iinfo(data_type).bits
    scale_factor = (data.max() - data.min()) / (2**bits - 2)
예제 #5
0
# mpop.  If not, see <http://www.gnu.org/licenses/>.

"""Plugin for reading PPS's cloud products hdf files.
"""
import ConfigParser
import os.path
from mpop import CONFIG_PATH
import mpop.channel
import numpy as np
import pyresample.utils

import glob
from mpop.utils import get_logger
from mpop.projector import get_area_def

LOG = get_logger("satin/msg_hdf")
COMPRESS_LVL = 6


def pcs_def_from_region(region):
    items = region.proj_dict.items()
    return " ".join([t[0] + "=" + t[1] for t in items])


def _get_area_extent(cfac, lfac, coff, loff, numcols, numlines):
    """Get the area extent from msg parameters.
    """

    xur = (numcols - coff) * 2 ** 16 / (cfac * 1.0)
    xur = np.deg2rad(xur) * 35785831.0
    xll = (-1 - coff) * 2 ** 16 / (cfac * 1.0)
예제 #6
0
파일: nc_reader.py 프로젝트: 3Geo/mpop
# - complete projection list and attribute list
# - handle other units than "m" for coordinates
# - handle units for data
# - pluginize

from ConfigParser import NoSectionError

import numpy as np
from netCDF4 import Dataset, num2date

from mpop.instruments.visir import VisirCompositer
from mpop.satellites import GenericFactory
from mpop.utils import get_logger
from mpop.satout.cfscene import TIME_UNITS

LOG = get_logger("netcdf4/cf reader")

# To be complete, get from appendix F of cf conventions
MAPPING_ATTRIBUTES = {'grid_mapping_name': "proj",
                      'standard_parallel': ["lat_1", "lat_2"],
                      'latitude_of_projection_origin': "lat_0",
                      'longitude_of_projection_origin': "lon_0",
                      'longitude_of_central_meridian': "lon_0",
                      'perspective_point_height': "h",
                      'false_easting': "x_0",
                      'false_northing': "y_0",
                      'semi_major_axis': "a",
                      'semi_minor_axis': "b",
                      'inverse_flattening': "rf",
                      'ellipsoid': "ellps", # not in CF conventions...
                      }
예제 #7
0
# You should have received a copy of the GNU General Public License along with
# mpop.  If not, see <http://www.gnu.org/licenses/>.

"""Plugin for reading PPS's cloud products hdf files.
"""
import ConfigParser
import datetime
import os.path
from glob import glob

import mpop.channel
from mpop import CONFIG_PATH
from mpop.utils import get_logger


LOG = get_logger('satin/pps_hdf')

class PpsCloudType(mpop.channel.GenericChannel):
    def __init__(self):
        mpop.channel.GenericChannel.__init__(self, "CloudType")
        self.region = None
        self.des = ""
        self.cloudtype_des = ""
        self.qualityflag_des = ""
        self.phaseflag_des = ""
        self.sec_1970 = 0
        self.satellite_id = ""
        self.cloudtype_lut = []
        self.qualityflag_lut = []
        self.phaseflag_lut = []
        self.cloudtype = None