How to use the atlite.datasets.era5._rename_and_clean_coords function in atlite

To help you get started, we’ve selected a few atlite 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 PyPSA / atlite / atlite / datasets / efas.py View on Github external
# Geopotential is aka Orography in the CDS:
    # https://confluence.ecmwf.int/pages/viewpage.action?pageId=78296105
    #
    # (shortName) | (name)                        | (paramId)
    # z           | Geopotential (CDS: Orography) | 129

    # TODO function is used to return a preview of the coordinates, that is
    # going to be stored in the meta.nc file. The code below did query the
    # variable orography and then made up a date_range, today i'd prefer
    # something similar to the function on the v0.2 branch:
    # https://github.com/FRESNA/atlite/blob/8c9faa8fa7ad8ff73e3424f86b3d8ada33b7dbbf/atlite/datasets/era5.py#L128

    with _get_data(variable='orography',
                   year=year, month=month, day=1,
                   area=_area(xs, ys)) as ds:
        ds = _rename_and_clean_coords(ds)
        ds = _add_height(ds)

        t = pd.Timestamp(year=year, month=month, day=1)
        ds['time'] = pd.date_range(t, t + pd.DateOffset(months=1),
                                   freq='1h', closed='left')

        return ds.load()
github PyPSA / atlite / atlite / datasets / efas.py View on Github external
def prepare_month_efas(year, month, xs, ys):
    area = _area(xs, ys)

    # Reference of the quantities
    # https://confluence.ecmwf.int/display/CKB/ERA5+data+documentation
    # TODO needs an update

    with _get_data(product="TODO-efas-product-name",
                   area=area, year=year, month=month,
                   variable=[

                   ]) as ds:

        ds = _rename_and_clean_coords(ds)

        # TODO
        # - which variables should be extracted and saved in which atlite fields
        # - do we need to get additional data from era5, maybe using a similar
        #   function as prepare_for_sarah in era5.py?

        yield (year, month), ds