Skip to content

AlertaDengue/satellite-weather-downloader

Repository files navigation

Satellite Weather Downloader

Xarray Copernicus
Xarray Copernicus

SWD is a system for downloading, transforming and analysing Copernicus weather data using Xarray. The lib is split in two functionalities, request and the @cope Xarray extension. request is responsible for extracting NetCDF4 files from Copernicus API, and the cope implements Xarray extensions for transforming and visualizing the files.

Installation

The app is available on PYPI, you can use the package without deploying the containers with the command in your shell:

$ pip install satellite-weather-downloader

Requirements

For downloading data from Copernicus API, it is required an account. The credentials for your account can be found in Copernicus' User Page, in the API key section. User API Key will be needed in order to request data, pass them to the in request's api_key parameter.

Create requests via Interactive shell

from satellite import request

dataset = request.reanalysis_era5_land(
    output='my_dataset_file'
    # Any ERA5 Land Reanalysis option can be passed in the method
)
NOTE: see notebooks/ to more examples

Extract Brazil NetCDF4 file from a date range

dataset = request.reanalysis_era5_land(
  "bra_dataset"
  locale='BRA',
  date='2023-01-01/2023-01-07'
)

Load the dataset

from satellite import DataSet
dataset = DataSet.from_netcdf("bra_dataset.zip")

Usage of cope extension

from satellite import ADM2
rio_adm = ADM2.get(code=3304557, adm0="BRA") # Rio de Janeiro's geocode (IBGE)
dataset.cope.to_dataframe(rio_adm)

It is also possible to create a dataframe directly from the National-wide dataset:

rio_ds = dataset.cope.adm_ds(rio_adm)

All Xarray methods are extended when using the copebr extension:

rio_ds.precip_tot.to_array()
rio_ds.temp_med.plot()