Exemple #1
0
# 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
# satpy.  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 satpy.channel
from satpy.config import CONFIG_PATH
from satpy.utils import get_logger

LOG = get_logger('satin/pps_hdf')


class PpsCloudType(satpy.channel.GenericChannel):
    def __init__(self):
        satpy.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 = []
Exemple #2
0
#
# satpy is distributed in the hope that it will be useful, 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
# satpy.  If not, see <http://www.gnu.org/licenses/>.
"""Satpy Package initializer."""

import os
from pkg_resources import get_distribution, DistributionNotFound
try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    # package is not installed
    pass

CHUNK_SIZE = int(os.getenv('PYTROLL_CHUNK_SIZE', 4096))

from satpy.utils import get_logger  # noqa
from satpy.dataset import DataID, DataQuery  # noqa
from satpy.dataset.data_dict import DatasetDict  # noqa
from satpy.readers import (
    find_files_and_readers,  # noqa
    available_readers)  # noqa
from satpy.writers import available_writers  # noqa
from satpy.scene import Scene  # noqa
from satpy.multiscene import MultiScene  # noqa

log = get_logger('satpy')
Exemple #3
0
# satpy is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# satpy is distributed in the hope that it will be useful, 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
# satpy.  If not, see <http://www.gnu.org/licenses/>.
"""Nodes to build trees."""

from satpy.utils import get_logger

LOG = get_logger(__name__)
# Empty leaf used for marking composites with no prerequisites
EMPTY_LEAF_NAME = "__EMPTY_LEAF_SENTINEL__"


class MissingDependencies(RuntimeError):
    """Exception when dependencies are missing."""

    def __init__(self, missing_dependencies, *args, **kwargs):
        """Set up the exception."""
        super().__init__(*args, **kwargs)
        self.missing_dependencies = missing_dependencies

    def __str__(self):
        """Return the string representation of the exception."""
        prefix = super().__str__()
Exemple #4
0
"""

import os

CHUNK_SIZE = int(os.getenv('PYTROLL_CHUNK_SIZE', 4096))

# Order of "highest" calibration from highest to lowest
DEFAULT_CALIBRATION_ORDER = [
    'brightness_temperature',
    'reflectance',
    'radiance',
    'counts',
]
CALIBRATION_ORDER = os.getenv('PYTROLL_CALIBRATION_ORDER', None)
if CALIBRATION_ORDER is None:
    CALIBRATION_ORDER = DEFAULT_CALIBRATION_ORDER
else:
    CALIBRATION_ORDER = [x.strip() for x in CALIBRATION_ORDER.split(' ')]
# convert to a dictionary of priority for faster access (0 higher priority)
CALIBRATION_ORDER = {cal: idx for idx, cal in enumerate(CALIBRATION_ORDER)}

from satpy.version import __version__  # noqa
from satpy.utils import get_logger  # noqa
from satpy.dataset import Dataset, DatasetID, DATASET_KEYS  # noqa
from satpy.readers import (DatasetDict, find_files_and_readers,  # noqa
                           available_readers)  # noqa
from satpy.writers import available_writers  # noqa
from satpy.scene import Scene  # noqa

log = get_logger('satpy')
Exemple #5
0
in PPS v2012, and before.
"""
import ConfigParser
from ConfigParser import NoOptionError

from datetime import datetime, timedelta
import os.path

import satpy.channel
from satpy.config import CONFIG_PATH
from satpy.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)
Exemple #6
0
# - 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 satpy.instruments.visir import VisirCompositer
from satpy.satellites import GenericFactory
from satpy.satout.cfscene import TIME_UNITS
from satpy.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...
                      }