Skip to content

Download ERA5 and plot wind rose for surface wind

Notifications You must be signed in to change notification settings

HatYaz/SurfaceWindERA5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

This code is a Python script that utilizes various libraries and APIs to download ERA5 wind data, plot wind roses, and provide a graphical user interface (GUI) for user interaction. Let's break down the key components and functionalities:

  1. Libraries:

    • PySimpleGUI: A Python GUI framework for creating simple and custom GUIs.
    • cdsapi: A Python library for accessing the Copernicus Climate Data Store (CDS) API.
    • numpy, matplotlib, xarray, io: Libraries for numerical computing, data visualization, and input/output operations in Python.
    • windrose: A library for plotting wind roses.
  2. Global Variables:

    • api_key: An API key used to access ERA5 data through the CDS API.
    • output_nc_file: The name of the NetCDF file where downloaded ERA5 data will be stored.
  3. Functions:

    • download_era5_data: Downloads ERA5 wind data for a specified location, time range, and time of day using the CDS API.
    • save_to_csv: Converts downloaded NetCDF data to a pandas DataFrame and saves it to a CSV file.
    • plot_wind_rose: Plots a wind rose based on the downloaded ERA5 wind data using the windrose library.
  4. GUI Layout:

    • Defines the layout of the GUI window using PySimpleGUI, including input fields for latitude, longitude, time range, and time of day, along with buttons for plotting, saving to CSV, and exiting the application.
  5. Event Loop:

    • Handles user interactions with the GUI window, such as clicking buttons or closing the window.
    • When the "Plot" button is clicked, it retrieves user inputs, downloads ERA5 data, plots a wind rose, and displays the plot in a separate window.
    • When the "Save to CSV" button is clicked, it saves the downloaded data to a CSV file.

Overall, this script provides a user-friendly interface for accessing ERA5 wind data, visualizing wind patterns using wind roses, and saving the data for further analysis.

About

Download ERA5 and plot wind rose for surface wind

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published