Example #1
0
    def __init__(self, configFile, progressbar=None):

        #CalcTD = CalcTrackDomain(configFile)
        #self.domain = CalcTD.calc()
        self.configFile = configFile
        self.progressbar = progressbar
        self.logger = logging.getLogger(__name__)
        self.logger.info("Initialising DataProcess")

        config = ConfigParser()
        config.read(configFile)

        self.outputPath = config.get('Output', 'Path')
        self.processPath = pjoin(self.outputPath, 'process')

        # Determine TCRM input directory
        tcrm_dir = pathLocator.getRootDirectory()
        self.tcrm_input_dir = pjoin(tcrm_dir, 'input')

        landmask = config.get('Input', 'LandMask')

        self.landmask = SampleGrid(landmask)

        fmt = config.get('Output', 'Format')

        self.ncflag = False
        if fmt.startswith("nc"):
            self.logger.debug("Output format is netcdf")
            self.ncflag = True
            self.data = {}
            #dimensions = {records}
            # variables = {init_index(records),
            #             genesis_index(records),
            #             non_init_index(records),
            #             lon(records), lat(records),
            #             year(records), month(records),
            #             day(records), hour(records),
            #             minute(records), julianday(records),
            #             bearing(records), speed(records),
            #             pressure(records), lsflag(records), }
            # global_attributes = dict(description=
            #                         source_file=,
            #                         source_file_moddate,
            #                         landmask_file=,
            #                         version=,)
        elif fmt.startswith("txt"):
            self.logger.debug("Output format is text")
            self.origin_year = pjoin(self.processPath, 'origin_year')
Example #2
0
    def __init__(self, configFile, dt):
        """
        Initialise required fields

        """

        self.configFile = configFile

        config = ConfigParser()
        config.read(configFile)

        landMaskFile = config.get('Input', 'LandMask')

        self.landMask = SampleGrid(landMaskFile)
        self.tol = 0  # Time over land
        self.dt = dt
Example #3
0
[LTMSLP]
; MSLP climatology file settings
URL = ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.derived/surface/slp.day.1981-2010.ltm.nc
path = C:/WorkSpace/data/MSLP
filename = slp.day.ltm.nc
"""

config = ConfigParser()
config.readfp(io.StringIO(configstr))

# We load a landmask dataset to allow us to determine
# when TCs are over water or over land

landmask_file = config.get('Input', 'Landmask')
landmask = SampleGrid(landmask_file)

# One thing that we realise in the statistics is that TC behaviour
# changes when a TC makes landfall. And because the number of
# observations in any given cell may not be sufficient to calculate
# reliable statistics, TCRM automatically increases the region that
# is sampled.

# This causes problems in regions close to land. If the model is
# determining statistics for one of these cells close to the coast
# (but offshore), and the expanded region starts capturing observations
# from over land, then the statistics are not truly representative of
# behaviour of offshore TCs. This is important for parameters related
# to intensity - TCs can often continue intensifying right up to landfall.
# But if we are sampling statistics of TCs overland, then we dilute the
# intensity statistics with observations from overland which (nearly without