Package: google-weather-tools
weather-toolsApache Beam pipelines to make weather data accessible and useful.IntroductionThis project contributes a series of command-line tools to make common data engineering tasks easier for researchers in
climate and weather. These solutions were born out of the need to improve repeated work performed by research teams
across Alphabet.The first tool created was the weather downloader (weather-dl). This makes it easier to ingest data from the European
Center for Medium Range Forecasts (ECMWF).weather-dlenables users to describe very specifically what data they'd
like to ingest from ECMWF's catalogs. It also offers them control over how to parallelize requests, empowering users toretrieve data efficiently. Downloads are driven from aconfiguration file, which can be reviewed (and version-controlled) independently of pipeline or
analysis code.We also provide two additional tools to aid climate and weather researchers: the weather mover (weather-mv) and the
weather splitter (weather-sp). These CLIs are still in their alpha stages of development. Yet, they have been used for
production workflows for several partner teams.We created the weather mover (weather-mv) to load geospatial data from cloud buckets
intoGoogle BigQuery. This enables rapid exploratory analysis and visualization of
weather data: From BigQuery, scientists can load arbitrary climate data fields into a Pandas or XArray dataframe via a
simple SQL query.The weather splitter (weather-sp) helps normalize how archival weather data is stored in cloud buckets:
Whether you're trying to merge two datasets with overlapping variables — or, you simply need
toopen Grib data from XArray, it's really useful to split datasets into
their component variables.InstallingIt's recommended that you create a local python environment (withAnaconda). Otherwise, these tools can be installed with pip:pipinstallgoogle-weather-toolsFrom here, you can use theweather-*tools from your python environment. Currently, the following tools are available:⛈weather-dl(beta) – Download weather data (namely, from ECMWF's API).⛅️weather-mv(alpha) – Load weather data into BigQuery.🌪weather-sp(alpha) – Split weather data by variable.QuickstartTogether, let's
downloadEra 5 pressure level dataand ingest it into Google BigQuery.Pre-requisites:Acquire and install a license from
ECMWF'sCopernicus (CDS) API.Create an empty BigQuery Dataset. This can be done in
theconsoleor via thebqCLI. For example:bqmk--project_id=$PROJECT$DATASET_IDSteps:Useweather-dlto acquire the Era 5 pressure level data.For simplicity, let's run everything on your local machine. For the downloader, this means we'll use
the--local-runoption:weather-dlconfigs/era5_example_config_local_run.cfg--local-runRecommendation: Pass the-d, --dry-runflag to any of these commands to preview effects.Generally,weather-dlis designed to ingest weather data to cloud storage. To learn how to configure downloads,
please seethis documentation. Seedetailed usage ofweather-dlhere.(optional) Split your downloaded dataset up by variable withweather-sp:weather-sp--input-pattern"./local_run/era5-*.nc"--output-dir"split_data"Consult theweather-spdocsfor more.Useweather-mvto upload this data to Google BigQuery.weather-mv--uris"./local_run/**.nc"\# or  --uris "./split_data/**.nc" \--output_table"$PROJECT.$DATASET_ID.$TABLE_ID"\--temp_location"gs://$BUCKET/tmp"\# Needed for batch writes to BigQuery--direct_num_workers2Seethese docsfor more about this tool.That's it! Soon, you'll have your weather data ready for analysis in BigQuery.Note: The exact interfaces for these CLIs are subject to change. For example, we plan to make the CLIs have more
uniform arguments (#21).ContributingThe weather tools are under active development, and contributions are welcome! Please check out
ourguideto get started.LicenseThis is not an official Google product.Copyright 2021 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.