How to use the pooch.Decompress function in pooch

To help you get started, we’ve selected a few pooch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fatiando / rockhound / rockhound / sample_data.py View on Github external
grid spacing to save space and download times. The downsampled grid was
    generated from a spherical harmonic model using the `ICGEM Calculation
    Service `__. See the ``attrs`` attribute of
    the returned :class:`xarray.Dataset` for information regarding the grid
    generation.

    ETOPO1 heights are referenced to "sea level".

    Returns
    -------
    grid : :class:`xarray.Dataset`
        The topography grid (in meters) relative to sea level. Coordinates are
        geodetic latitude and longitude.

    """
    fname = REGISTRY.fetch("etopo1-0.5deg.nc.xz", processor=Decompress())
    # The data are stored as int16 to save disk space. Cast them to floats to
    # avoid integer division problems when processing.
    data = xr.open_dataset(fname, engine="scipy").astype("float64")
    return data
github icepack / icepack / icepack / datasets.py View on Github external
def fetch_mosaic_of_antarctica():
    return moa.fetch(
        'moa750_2009_hp1_v01.1.tif.gz',
        downloader=_earthdata_downloader,
        processor=pooch.Decompress()
    )
github fatiando / rockhound / rockhound / etopo1.py View on Github external
function that loads the grid into memory.

    Returns
    -------
    grid : :class:`xarray.Dataset` or str
        The loaded grid or the file path to the downloaded data.

    """
    version = version.lower()
    available = {
        "ice": "ETOPO1_Ice_g_gmt4.grd.gz",
        "bedrock": "ETOPO1_Bed_g_gmt4.grd.gz",
    }
    if version not in available:
        raise ValueError("Invalid ETOPO1 version '{}'.".format(version))
    fname = REGISTRY.fetch(available[version], processor=Decompress())
    if not load:
        return fname
    grid = xr.open_dataset(fname, **kwargs)
    # Add more metadata and fix some names
    names = {"ice": "Ice Surface", "bedrock": "Bedrock"}
    grid = grid.rename(z=version, x="longitude", y="latitude")
    grid[version].attrs["long_name"] = "{} relief".format(names[version])
    grid[version].attrs["units"] = "meters"
    grid[version].attrs["vertical_datum"] = "sea level"
    grid[version].attrs["datum"] = "WGS84"
    grid.attrs["title"] = "ETOPO1 {} Relief".format(names[version])
    grid.attrs["doi"] = "10.7289/V5C8276M"
    return grid
github fatiando / rockhound / rockhound / sample_data.py View on Github external
The geoid height is the height of the geoid above (positive) or below
    (negative) the ellipsoid (WGS84). The data are on a regular grid with 0.5
    degree spacing, which was generated from the spherical harmonic model
    EIGEN-6C4 [Forste_etal2014]_ using the `ICGEM Calculation Service
    `__. See the ``attrs`` attribute of the
    :class:`xarray.Dataset` for information regarding the grid generation.

    Returns
    -------
    grid : :class:`xarray.Dataset`
        The geoid grid (in meters). Coordinates are geodetic latitude and
        longitude.

    """
    fname = REGISTRY.fetch("geoid-earth-0.5deg.nc.xz", processor=Decompress())
    data = xr.open_dataset(fname, engine="scipy").astype("float64")
    return data
github fatiando / rockhound / rockhound / seafloor.py View on Github external
grid : :class:`xarray.Dataset` or str
        The loaded grid or the file path to the downloaded data.

    """
    resolutions = ["6min", "2min"]
    if resolution not in resolutions:
        raise ValueError(
            "Invalid seafloor age grid resolution '{}'. Must be one of {}.".format(
                resolution, resolutions
            )
        )
    fname_age = REGISTRY.fetch(
        "age.3.{}.nc.bz2".format(resolution[0]), processor=Decompress()
    )
    fname_error = REGISTRY.fetch(
        "ageerror.3.{}.nc.bz2".format(resolution[0]), processor=Decompress()
    )
    if not load:
        return [fname_age, fname_error]
    grid = xr.merge(
        [
            xr.open_dataset(fname_age, **kwargs).rename(z="age") / 100,
            xr.open_dataset(fname_error, **kwargs).rename(z="uncertainty") / 100,
        ]
    )
    # Add more metadata and fix some names
    grid = grid.rename(x="longitude", y="latitude")
    grid.attrs["title"] = "Age of oceanic lithosphere"
    grid.attrs["doi"] = "10.1029/2007GC001743"
    grid.age.attrs["long_name"] = "Age of oceanic lithosphere"
    grid.age.attrs["units"] = "million_years"
    grid.uncertainty.attrs["long_name"] = "Age uncertainty"
github fatiando / harmonica / harmonica / datasets / sample_data.py View on Github external
the returned :class:`xarray.Dataset` for information regarding the grid
    generation.

    ETOPO1 heights are referenced to "sea level".

    If the file isn't already in your data directory, it will be downloaded
    automatically.

    Returns
    -------
    grid : :class:`xarray.Dataset`
        The topography grid (in meters) relative to sea level. Coordinates are
        geodetic latitude and longitude.

    """
    fname = REGISTRY.fetch("etopo1-0.5deg.nc.xz", processor=pooch.Decompress())
    # The data are stored as int16 to save disk space. Cast them to floats to
    # avoid integer division problems when processing.
    data = xr.open_dataset(fname, engine="scipy").astype("float64")
    return data
github fatiando / harmonica / harmonica / datasets / sample_data.py View on Github external
degree spacing, which was generated from the spherical harmonic model
    EIGEN-6C4 [Forste_etal2014]_ using the `ICGEM Calculation Service
    `__. See the ``attrs`` attribute of the
    :class:`xarray.Dataset` for information regarding the grid generation.

    If the file isn't already in your data directory, it will be downloaded
    automatically.

    Returns
    -------
    grid : :class:`xarray.Dataset`
        The geoid grid (in meters). Coordinates are geodetic latitude and
        longitude.

    """
    fname = REGISTRY.fetch("geoid-earth-0.5deg.nc.xz", processor=pooch.Decompress())
    data = xr.open_dataset(fname, engine="scipy").astype("float64")
    return data
github fatiando / rockhound / rockhound / sample_data.py View on Github external
Calculation Service `__. See the ``attrs``
    attribute of the :class:`xarray.Dataset` for information regarding the grid
    generation.

    If the file isn't already in your data directory, it will be downloaded
    automatically.

    Returns
    -------
    grid : :class:`xarray.Dataset`
        The gravity grid (in mGal). Includes a computation (geometric) height
        grid (``height_over_ell``). Coordinates are geodetic latitude and
        longitude.

    """
    fname = REGISTRY.fetch("gravity-earth-0.5deg.nc.xz", processor=Decompress())
    # The heights are stored as ints and data as float32 to save space on the
    # data file. Cast them to float64 to avoid integer division errors.
    data = xr.open_dataset(fname, engine="scipy").astype("float64")
    return data