def __init__(self, **keywords):

        # Calls the regular constructor
        super(ConfIOMB, self).__init__(**keywords)

        # Setup a html layout for generating web views of the results
        pages = []

        # Mean State page
        pages.append(post.HtmlPage("MeanState", "Mean State"))
        pages[-1].setHeader("CNAME / RNAME / MNAME")
        pages[-1].setSections(
            ["Period mean at surface", "Mean regional depth profiles"])
        pages.append(post.HtmlAllModelsPage("AllModels", "All Models"))
        pages[-1].setHeader("CNAME / RNAME")
        pages[-1].setSections([])
        pages[-1].setRegions(self.regions)
        pages.append(post.HtmlPage("DataInformation", "Data Information"))
        pages[-1].setSections([])
        pages[-1].text = "\n"
        with Dataset(self.source) as dset:
            for attr in dset.ncattrs():
                pages[-1].text += "<p><b>&nbsp;&nbsp;%s:&nbsp;</b>%s</p>\n" % (
                    attr, dset.getncattr(attr).encode('ascii', 'ignore'))
        self.layout = post.HtmlLayout(pages, self.longname)
示例#2
0
    def __init__(self, **keywords):

        # Ugly, but this is how we call the Confrontation constructor
        super(ConfCO2, self).__init__(**keywords)
        self.regions = ['global']

        self.lat_bands = np.asarray(self.keywords.get(
            "lat_bands", "-90,-60,-23,0,+23,+60,+90").split(","),
                                    dtype=float)
        sec = []
        for i in range(len(self.lat_bands) - 1):
            sec.append("Latitude Band %d to %d [ppm]" %
                       (self.lat_bands[i], self.lat_bands[i + 1]))
        sec = sec[::-1]

        # Setup a html layout for generating web views of the results
        pages = []

        # Mean State page
        pages.append(post.HtmlPage("MeanState", "Mean State"))
        pages[-1].setHeader("CNAME / RNAME / MNAME")
        pages[-1].setSections([
            "Summary",
        ] + sec)
        pages.append(post.HtmlAllModelsPage("AllModels", "All Models"))
        pages[-1].setHeader("CNAME / RNAME")
        pages[-1].setSections([])
        pages[-1].setRegions(self.regions)
        pages.append(post.HtmlPage("DataInformation", "Data Information"))
        pages[-1].setSections([])
        pages[-1].text = "\n"
        with Dataset(self.source) as dset:
            for attr in dset.ncattrs():
                pages[-1].text += "<p><b>&nbsp;&nbsp;%s:&nbsp;</b>%s</p>\n" % (
                    attr, dset.getncattr(attr).encode('ascii', 'ignore'))
        self.layout = post.HtmlLayout(pages, self.longname)

        # Adding a member variable called basins, add them as regions
        r = Regions()
        self.pulse_dir = "/".join(
            self.source.split("/")[:-2] + ["PulseEmulation"])
        self.pulse_regions = r.addRegionNetCDF4(
            os.path.join(self.pulse_dir, "AtmosphericPulseRegions.nc"))

        # Emulation specific initialization
        self.sites = [
            site.strip()
            for site in self.keywords.get("sites", None).upper().split(",")
        ]
        self.map = None
        if self.sites:
            self.map = [
                self.lbls.index(site) for site in self.sites
                if site in self.lbls
            ]
            self.lbls = [self.lbls[i] for i in self.map]
示例#3
0
    def __init__(self, **kwargs):

        self.name = kwargs.get("name", None)
        self.output_path = kwargs.get("output_path", "./")
        self.master = True
        self.rate = 0.01
        self.CO2_0 = 284.7  # [ppm]
        self.regions = ['global']
        self.keywords = kwargs

        pages = []
        pages.append(post.HtmlPage("Feedback", "By Model"))
        pages[-1].setHeader("CNAME / RNAME / MNAME")
        pages[-1].setSections(
            ["Global states and fluxes", "Sensitivity parameters"])
        pages[-1].setRegions(self.regions)
        pages.append(post.HtmlAllModelsPage("AllModels", "All Models"))
        pages[-1].setHeader("CNAME / RNAME / MNAME")
        pages[-1].setSections([])
        pages[-1].setRegions(self.regions)

        self.layout = post.HtmlLayout(pages, self.name)
示例#4
0
    def __init__(self, **keywords):

        # Calls the regular constructor
        super(ConfPEcAn, self).__init__(**keywords)

        obs = Variable(filename=self.source,
                       variable_name=self.variable,
                       alternate_vars=self.alternate_vars,
                       convert_calendar=False)
        self.years = np.asarray(
            [t.year for t in cftime.num2date(obs.time, "days since 1850-1-1")],
            dtype=int)
        self.years = np.unique(self.years)

        # Setup a html layout for generating web views of the results
        pages = []

        # Mean State page
        pages.append(post.HtmlPage("MeanState", "Mean State"))
        pages[-1].setHeader("CNAME / RNAME / MNAME")
        pages[-1].setSections([
            "Seasonal Diurnal Cycle",
        ] + ["%d" % y for y in self.years])
        pages.append(post.HtmlAllModelsPage("AllModels", "All Models"))
        pages[-1].setHeader("CNAME / RNAME")
        pages[-1].setSections([])
        pages[-1].setRegions(self.regions)
        pages.append(post.HtmlPage("DataInformation", "Data Information"))
        pages[-1].setSections([])
        pages[-1].text = "\n"
        with Dataset(self.source) as dset:
            for attr in dset.ncattrs():
                a = dset.getncattr(attr)
                if 'astype' in dir(a): a = a.astype('str')
                if 'encode' in dir(a): a = a.encode('ascii', 'ignore')
                pages[-1].text += "<p><b>&nbsp;&nbsp;%s:&nbsp;</b>%s</p>\n" % (
                    attr, a)
        self.layout = post.HtmlLayout(pages, self.longname)