Ejemplo n.º 1
0
    def plotPressureMin(self):
        """
        Plot a map of observed and synthetic minimum central pressure values.

        """

        datarange = (900, 1000)
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range[:-1].min(),
                          llcrnrlat=self.lat_range[:-1].min(),
                          urcrnrlon=self.lon_range[:-1].max(),
                          urcrnrlat=self.lat_range[:-1].max(),
                          projection='merc',
                          resolution='i')

        cbarlab = "Minimum central pressure (hPa)"
        xgrid, ygrid = np.meshgrid(self.lon_range[:-1], self.lat_range[:-1])
        figure.add(np.transpose(self.histMin), xgrid, ygrid, "Historic", datarange, 
                   cbarlab, map_kwargs)
        figure.add(np.transpose(self.synMin), xgrid, ygrid, "Synthetic", datarange, 
                   cbarlab, map_kwargs)

        figure.plot()
        outputFile = pjoin(self.plotPath, 'minPressure.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 2
0
    def plotPressureMeanDiff(self):
        """
        Plot a map of the difference between observed and synthetic mean
        pressure values.

        """

        datarange = (-25, 25)
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range[:-1].min(),
                          llcrnrlat=self.lat_range[:-1].min(),
                          urcrnrlon=self.lon_range[:-1].max(),
                          urcrnrlat=self.lat_range[:-1].max(),
                          projection='merc',
                          resolution='i')

        cbarlab = "Mean central pressure difference (hPa)"
        data = self.histMean - self.synMean
        xgrid, ygrid = np.meshgrid(self.lon_range[:-1], self.lat_range[:-1])
        data = self.histMin - self.synMin
        figure.add(np.transpose(data), xgrid, ygrid, "", datarange, 
                   cbarlab, map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'meanPressureDiff.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 3
0
    def plotPressureMeanDiff(self):
        """
        Plot a map of the difference between observed and synthetic mean
        pressure values.

        """

        datarange = (-25, 25)
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range.min(),
                          llcrnrlat=self.lat_range.min(),
                          urcrnrlon=self.lon_range.max(),
                          urcrnrlat=self.lat_range.max(),
                          projection='merc',
                          resolution='i')

        cbarlab = "Mean central pressure difference (hPa)"
        data = self.histMean - self.synMean
        xgrid, ygrid = np.meshgrid(self.lon_range, self.lat_range)
        figure.add(np.transpose(data), xgrid, ygrid, "Historical - Synthetic",
                   datarange, cbarlab, map_kwargs)
        figure.cmap = sns.blend_palette(sns.color_palette("coolwarm", 9),
                                        as_cmap=True)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'meanPressureDiff.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 4
0
    def plotTrackDensityPercentiles(self):
        """
        Plot upper and lower percentiles of track density derived from
        synthetic event sets

        """

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range[:-1].min(),
                          llcrnrlat=self.lat_range[:-1].min(),
                          urcrnrlon=self.lon_range[:-1].max(),
                          urcrnrlat=self.lat_range[:-1].max(),
                          projection='merc',
                          resolution='i')
        cbarlab = "TC observations/yr"
        xgrid, ygrid = np.meshgrid(self.lon_range[:-1], self.lat_range[:-1])
        figure.add(self.synHistUpper.T, xgrid, ygrid, "Upper percentile", datarange, 
                   cbarlab, map_kwargs)
        figure.add(self.synHistLower.T, xgrid, ygrid, "Lower percentile",
                    datarange, cbarlab, map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'track_density_percentiles.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 5
0
    def plotPressureMin(self):
        """
        Plot a map of observed and synthetic minimum central pressure values.

        """

        datarange = (900, 1000)
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range.min(),
                          llcrnrlat=self.lat_range.min(),
                          urcrnrlon=self.lon_range.max(),
                          urcrnrlat=self.lat_range.max(),
                          projection='merc',
                          resolution='i')

        cbarlab = "Minimum central pressure (hPa)"
        xgrid, ygrid = np.meshgrid(self.lon_range, self.lat_range)
        figure.add(np.transpose(self.histMin), xgrid, ygrid, "Historic",
                   datarange, cbarlab, map_kwargs)
        figure.add(np.transpose(self.synMin), xgrid, ygrid, "Synthetic",
                   datarange, cbarlab, map_kwargs)

        figure.plot()
        outputFile = pjoin(self.plotPath, 'minPressure.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 6
0
    def plotGenesisDensityPercentiles(self):
        """
        Plot upper and lower percentiles of genesis density derived from
        synthetic event sets

        """

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        map_kwargs = dict(
            llcrnrlon=self.lon_range.min(),
            llcrnrlat=self.lat_range.min(),
            urcrnrlon=self.lon_range.max(),
            urcrnrlat=self.lat_range.max(),
            projection="merc",
            resolution="i",
        )
        cbarlab = "TCs/yr"
        xgrid, ygrid = np.meshgrid(self.lon_range, self.lat_range)
        figure.add(self.synHistUpper.T, xgrid, ygrid, "Upper percentile", datarange, cbarlab, map_kwargs)
        figure.add(self.synHistLower.T, xgrid, ygrid, "Lower percentile", datarange, cbarlab, map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, "genesis_density_percentiles.png")
        saveFigure(figure, outputFile)
Ejemplo n.º 7
0
    def plotGenesisDensity(self):
        """Plot genesis density information"""

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        map_kwargs = dict(
            llcrnrlon=self.lon_range.min(),
            llcrnrlat=self.lat_range.min(),
            urcrnrlon=self.lon_range.max(),
            urcrnrlat=self.lat_range.max(),
            projection="merc",
            resolution="i",
        )
        cbarlab = "TCs/yr"
        xgrid, ygrid = np.meshgrid(self.lon_range, self.lat_range)
        figure.add(self.hist.T, self.X, self.Y, "Historic", datarange, cbarlab, map_kwargs)
        figure.add(self.synHistMean.T, xgrid, ygrid, "Synthetic", datarange, cbarlab, map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, "genesis_density.png")
        saveFigure(figure, outputFile)

        figure2 = ArrayMapFigure()
        figure2.add(self.hist.T, xgrid, ygrid, "Historic", datarange, cbarlab, map_kwargs)
        figure2.add(self.synHist[0, :, :].T, xgrid, ygrid, "Synthetic", datarange, cbarlab, map_kwargs)
        figure2.add(self.synHist[1, :, :].T, xgrid, ygrid, "Synthetic", datarange, cbarlab, map_kwargs)
        figure2.add(self.synHist[2, :, :].T, xgrid, ygrid, "Synthetic", datarange, cbarlab, map_kwargs)

        figure2.plot()
        outputFile = pjoin(self.plotPath, "genesis_density_samples.png")
        saveFigure(figure2, outputFile)
Ejemplo n.º 8
0
    def plotTrackDensityPercentiles(self):
        """
        Plot upper and lower percentiles of track density derived from
        synthetic event sets

        """

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        cbarlab = "TC observations/yr"

        figure.add(self.synHistUpper.T, self.X, self.Y, "Upper percentile",
                   datarange, cbarlab, self.map_kwargs)
        figure.add(self.synHistLower.T, self.X, self.Y, "Lower percentile",
                    datarange, cbarlab, self.map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'track_density_percentiles.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 9
0
    def plotTrackDensity(self):
        """Plot track density information"""

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        map_kwargs = dict(llcrnrlon=self.lon_range[:-1].min(),
                          llcrnrlat=self.lat_range[:-1].min(),
                          urcrnrlon=self.lon_range[:-1].max(),
                          urcrnrlat=self.lat_range[:-1].max(),
                          projection='merc',
                          resolution='i')
        cbarlab = "TC observations/yr"
        xgrid, ygrid = np.meshgrid(self.lon_range[:-1], self.lat_range[:-1])
        figure.add(self.hist.T, xgrid, ygrid, "Historic", datarange, 
                   cbarlab, map_kwargs)
        figure.add(self.synHistMean.T, xgrid, ygrid, "Synthetic",
                    datarange, cbarlab, map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'track_density.png')
        saveFigure(figure, outputFile)
Ejemplo n.º 10
0
                  llcrnrlat=-30,
                  urcrnrlon=180.,
                  urcrnrlat=-5.,
                  resolution='h',
                  projection='merc')

ncobj = ncLoadFile(pjoin(processPath, "pressure_stats.nc"))
lon = ncGetDims(ncobj, 'lon')
lat = ncGetDims(ncobj, 'lat')
ardata = getData(ncobj, 'alpha', ij)
mudata = getData(ncobj, 'mu', ij)
mindata = getData(ncobj, 'min', ij)
sigdata = getData(ncobj, 'sig', ij)
ncobj.close()
fig = ArrayMapFigure()
fig.add(mudata, xgrid, ygrid, 'Mean pressure ', [950, 1000], 'Pressure (hPa)',
        map_kwargs)
fig.add(mindata, xgrid, ygrid, 'Minimum pressure', [900, 1000],
        'Pressure (hPa)', map_kwargs)
fig.add(sigdata, xgrid, ygrid, 'Pressure standard deviation', [0, 50],
        'Std dev.', map_kwargs)
fig.add(ardata, xgrid, ygrid, 'Pressure AR(1)', [-1, 1], 'AR(1)', map_kwargs)
fig.plot()
saveFigure(fig, pjoin(plotsPath, "pressure_stats.png"))

ncobj = ncLoadFile(pjoin(processPath, "pressure_stats.nc"))
lon = ncGetDims(ncobj, 'lon')
lat = ncGetDims(ncobj, 'lat')
ardata = getData(ncobj, 'alpha', ij)
mudata = getData(ncobj, 'mu', ij)
mindata = getData(ncobj, 'min', ij)
sigdata = getData(ncobj, 'sig', ij)
Ejemplo n.º 11
0
    def plotTrackDensity(self):
        """Plot track density information"""

        datarange = (0, self.hist.max())
        figure = ArrayMapFigure()

        cbarlab = "TC observations/yr"
        figure.add(self.hist.T, self.X, self.Y, "Historic", datarange,
                   cbarlab, self.map_kwargs)
        figure.add(self.synHistMean.T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure.plot()
        outputFile = pjoin(self.plotPath, 'track_density.png')
        saveFigure(figure, outputFile)

        figure2 = ArrayMapFigure()
        figure2.add(self.hist.T, self.X, self.Y, "Historic", datarange,
                    cbarlab, self.map_kwargs)
        figure2.add(self.synHist[0, :, :].T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure2.add(self.synHist[10, :, :].T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure2.add(self.synHist[20, :, :].T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure2.add(self.synHist[30, :, :].T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure2.add(self.synHist[40, :, :].T, self.X, self.Y, "Synthetic",
                    datarange, cbarlab, self.map_kwargs)
        figure2.plot()
        outputFile = pjoin(self.plotPath, 'track_density_samples.png')
        saveFigure(figure2, outputFile)