예제 #1
0
    def createTemplateEasy(sensorType,
                           height,
                           srf_size=None,
                           corr_dx=None,
                           corr_dy=None,
                           lut_size=None):
        """
        Create a template dataset in EASY FCDR format for the sensor given as argument.
        :param sensorType: the sensor type to create the template for
        :param height: the height in pixels of the data product
        :param srf_size: if set, the length of the spectral response function in frequency steps
        :param corr_dx: correlation length across track
        :param corr_dy: correlation length along track
        :param lut_size: size of a BT/radiance conversion lookup table
        :return the template dataset
         """
        dataset = xr.Dataset()
        WriterUtils.add_standard_global_attributes(dataset)

        template_factory = TemplateFactory()

        sensor_template = template_factory.get_sensor_template(sensorType)
        sensor_template.add_original_variables(dataset, height, srf_size)
        sensor_template.add_easy_fcdr_variables(dataset, height, corr_dx,
                                                corr_dy, lut_size)
        sensor_template.add_template_key(dataset)

        return dataset
예제 #2
0
    def createTemplateFull(sensorType, height):
        """
        Create a template dataset in FULL FCDR format for the sensor given as argument.
        :param sensorType: the sensor type to create the template for
        :param height the hheight in pixels of the data product
        :return the template dataset
         """
        dataset = xr.Dataset()

        WriterUtils.add_standard_global_attributes(dataset)

        template_factory = TemplateFactory()

        sensor_template = template_factory.get_sensor_template(sensorType)
        sensor_template.add_original_variables(dataset, height)
        sensor_template.add_full_fcdr_variables(dataset, height)
        sensor_template.add_template_key(dataset)

        return dataset
예제 #3
0
    def createTemplate(data_type, width, height, num_samples=None):
        """
        Create a template dataset in CDR format for the data type given as argument.
        :param data_type: the data type to create the template for
        :param width: the width in pixels of the data product
        :param height: the height in pixels of the data product
        :return the template dataset
         """
        dataset = xr.Dataset()
        WriterUtils.add_standard_global_attributes(dataset)
        WriterUtils.add_cdr_global_attributes(dataset)

        template_factory = CDR_TemplateFactory()

        sensor_template = template_factory.get_cdr_template(data_type)

        if num_samples is None:
            sensor_template.add_variables(dataset, width, height)
        else:
            sensor_template.add_variables(dataset, width, height, num_samples)

        return dataset
예제 #4
0
파일: uth.py 프로젝트: gerritholl/FCDRTools
    def add_variables(dataset, width, height):
        WriterUtils.add_gridded_global_attributes(dataset)

        tu.add_gridded_geolocation_variables(dataset, width, height)
        tu.add_quality_flags(dataset, width, height)

        dataset["time_ranges_ascend"] = UTH._create_time_ranges_variable(
            height, width,
            "Minimum and maximum seconds of day pixel contribution time, ascending nodes"
        )
        dataset["time_ranges_descend"] = UTH._create_time_ranges_variable(
            height, width,
            "Minimum and maximum seconds of day pixel contribution time, descending nodes"
        )

        dataset[
            "observation_count_ascend"] = UTH._create_observation_counts_variable(
                height, width,
                "Number of UTH/brightness temperature observations in a grid box for ascending passes"
            )
        dataset[
            "observation_count_descend"] = UTH._create_observation_counts_variable(
                height, width,
                "Number of UTH/brightness temperature observations in a grid box for descending passes"
            )

        dataset["overpass_count_ascend"] = UTH._create_overpass_counts_variable(
            height, width,
            "Number of satellite overpasses in a grid box for ascending passes"
        )
        dataset["overpass_count_descend"] = UTH._create_overpass_counts_variable(
            height, width,
            "Number of satellite overpasses in a grid box for descending passes"
        )

        dataset["uth_ascend"] = UTH._create_uth_variable(
            width,
            height,
            description=
            "Monthly average of all UTH retrievals in a grid box for ascending passes (calculated from daily averages)",
        )
        dataset["uth_descend"] = UTH._create_uth_variable(
            width,
            height,
            description=
            "Monthly average of all UTH retrievals in a grid box for descending passes (calculated from daily averages)"
        )

        dataset["u_independent_uth_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to independent effects for ascending passes",
            coordinates="lon lat")
        dataset["u_independent_uth_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to independent effects for descending passes",
            coordinates="lon lat")
        dataset["u_structured_uth_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to structured effects for ascending passes",
            coordinates="lon lat")
        dataset["u_structured_uth_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to structured effects for descending passes",
            coordinates="lon lat")
        dataset["u_common_uth_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to common effects for ascending passes",
            coordinates="lon lat")
        dataset["u_common_uth_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of UTH due to common effects for descending passes",
            coordinates="lon lat")

        dataset["uth_inhomogeneity_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Standard deviation of all daily UTH averages which were used to calculate the monthly UTH average in a grid box for ascending passes",
            coordinates="lon lat")
        dataset["uth_inhomogeneity_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Standard deviation of all daily UTH averages which were used to calculate the monthly UTH average in a grid box for descending passes",
            coordinates="lon lat")

        dataset["BT_ascend"] = UTH._create_bt_variable(
            width,
            height,
            description=
            "Monthly average of all brightness temperatures which were used to retrieve UTH in a grid box for ascending passes (calculated from daily averages)"
        )
        dataset["BT_descend"] = UTH._create_bt_variable(
            width,
            height,
            description=
            "Monthly average of all brightness temperatures which were used to retrieve UTH in a grid box for descending passes (calculated from daily averages)"
        )

        dataset["u_independent_BT_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to independent effects for ascending passes",
            coordinates="lon lat",
            units="K")
        dataset["u_independent_BT_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to independent effects for descending passes",
            coordinates="lon lat",
            units="K")

        dataset["u_structured_BT_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to structured effects for ascending passes",
            coordinates="lon lat",
            units="K")
        dataset["u_structured_BT_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to structured effects for descending passes",
            coordinates="lon lat",
            units="K")

        dataset["u_common_BT_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to common effects for ascending passes",
            coordinates="lon lat",
            units="K")
        dataset["u_common_BT_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Uncertainty of brightness temperature due to common effects for descending passes",
            coordinates="lon lat",
            units="K")

        dataset["BT_inhomogeneity_ascend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Standard deviation of all daily brightness temperature averages which were used to calculate the monthly brightness temperature average for ascending passes",
            coordinates="lon lat",
            units="K")
        dataset["BT_inhomogeneity_descend"] = tu.create_CDR_uncertainty(
            width,
            height,
            "Standard deviation of all daily brightness temperature averages which were used to calculate the monthly brightness temperature average for descending passes",
            coordinates="lon lat",
            units="K")

        dataset[
            "observation_count_all_ascend"] = UTH._create_observation_counts_variable(
                height, width,
                "Number of all observations in a grid box for ascending passes - no filtering done"
            )
        dataset[
            "observation_count_all_descend"] = UTH._create_observation_counts_variable(
                height, width,
                "Number of all observations in a grid box for descending passes - no filtering done"
            )
예제 #5
0
    def test_add_gridded_global_attributes(self):
        dataset = xr.Dataset()

        WriterUtils.add_gridded_global_attributes(dataset)
        Assertions.assert_gridded_global_attributes(self, dataset.attrs)