Ejemplo n.º 1
0
def test_convert_to_xarray():
    """
    Converts test file to xarray dataset.
    """
    from pansat.formats.hdf4 import HDF4File
    description = ProductDescription(TEST_DATA)
    file_handle = HDF4File(TEST_FILE_HDF)
    dataset = description.to_xarray_dataset(file_handle)
Ejemplo n.º 2
0
    def open(self, filename):
        """
        Open file as xarray dataset.

        Args:
            filename(``pathlib.Path`` or ``str``): The CloudSat file to open.
        """
        from pansat.formats.hdf4 import HDF4File
        file_handle = HDF4File(filename)
        return self.description.to_xarray_dataset(file_handle, globals())
Ejemplo n.º 3
0
def test_vdata():
    """
    Reads the test file and ensures that both the vdata (VS API)
    is loaded correctly.
    """
    file = HDF4File(TEST_FILE)

    print(file.datasets)
    vdata = file.vdata_1
    assert vdata.name == "vdata_1"
    assert vdata.n_fields == 1
Ejemplo n.º 4
0
def test_dataset():
    """
    Reads the test file and ensures that  the dataset (DS API)
    is loaded correctly.
    """
    file = HDF4File(TEST_FILE)

    print(file.datasets)
    dataset = file.dataset_1
    assert dataset.name == "dataset_1"
    assert dataset.shape == (1, 10)