Access meteorological data from MERRA2 and ERA5 in one line¶
This notebook demonstrates how to use the PVRADAR Python SDK to access historical weather data from multiple sources — including MERRA2 and ERA5 — with minimal code. We'll retrieve and visualize key environmental variables such as temperature, rainfall, and irradiance.
from pvradar.sdk import PvradarSite, R, resource_plot, describe
Define location and time period¶
# Define site and time period for the simulation
location = (35.0545, -106.5390) # SANDIA Labs, Albuquerque, NM, USA
site = PvradarSite(location=location, interval='2020-01-01..2020-12-31')
Retrieve air temperature data¶
We'll retrieve hourly air temperature data from three different sources: merra2
, era5-global
, and era5-land
. Use R-Notation, PVRADAR's declarative way of requesting time-series inputs to define the datasource.
For more on R-Notation and available attributes, see the Resource DB and R-Notation Guide.
# Retrieve air temperature from MERRA2
air_temp_merra2 = site.resource(R.air_temperature(datasource='merra2'))
# Retrieve air temperature from two different ERA5 datasets
air_temp_era5global = site.resource(R.air_temperature(datasource='era5', dataset='era5-global'))
air_temp_era5land = site.resource(R.air_temperature(datasource='era5', dataset='era5-land'))
Resources are just ordinary pandas Series that carry additional meta data. Use our describe
function to investigate.
describe(air_temp_merra2)
air_temperature: mean hourly air temperature in degC from merra2 8784 data points (2020-01-01 00:00:00-07:00 to 2020-12-31 23:00:00-07:00)
Visualize air temperature from different sources¶
# Plot temperature series from different sources
resource_plot(air_temp_era5global, air_temp_era5land, air_temp_merra2)
Compare rainfall data¶
Rainfall is typically a cumulative variable. We'll compare daily rainfall data from ERA5 and MERRA2, and request the data in centimeters (cm
).
# Daily rainfall from ERA5 (default is 'era5-land' dataset)
rainfall_era5 = site.resource(R.rainfall(datasource='era5', to_unit='cm', to_freq='D'))
# Daily rainfall from MERRA2
rainfall_merra2 = site.resource(R.rainfall(datasource='merra2', to_unit='cm', to_freq='D'))
Visualize rainfall comparison¶
# Plot daily rainfall comparison between sources
resource_plot(rainfall_era5, rainfall_merra2)
Retrieve and visualize irradiance¶
We'll now retrieve and visualize global horizontal irradiance (GHI), a key metric for solar energy applications.
# Retrieve global horizontal irradiance
ghi = site.resource(R.global_horizontal_irradiance)
# Plot GHI
resource_plot(ghi)
Overlay all key environmental variables¶
resource_plot(
air_temp_era5global,
air_temp_era5land,
air_temp_merra2,
rainfall_era5,
rainfall_merra2,
ghi,
)
Summary¶
In just a few lines of code, we accessed and compared meteorological data from multiple satellite sources — including ERA5 and MERRA2. PVRADAR automatically handles unit conversions, frequency resampling, and data alignment, enabling quick and consistent analysis.
¶
Why PVRADAR?¶
Model and optimize the real-world behavior of your PV plants¶
PVRADAR allows you to model the effect of any technical or environmental factor on plant performance:
- Combine snow, soiling, albedo, clipping, battery storage, and more in a single modeling workflow.
- Quantify impacts in terms of energy yield, PR, LCOE, and financial KPIs.
- Explore what-if scenarios and optimize plant design and O&M strategies.
Build internal tools and advanced applications¶
With PVRADAR, you can turn your models into robust, organization-wide tools:
- Build internal web apps that allow colleagues to apply validated models without writing code.
- Standardize modeling across teams and projects.
- Automate reporting and performance analysis to save time and ensure consistency.
One Python line away from your data¶
The PVRADAR SDK simplifies data access:
- Seamlessly connect to satellite data, meteo stations, and internal performance databases.
- Standardize and pre-process data for modeling — ready to use in one line of Python.
- Keep full control over your data, whether in the cloud or on-premises.
Supported by deep expertise¶
PVRADAR is more than software — it is backed by industry-leading expertise:
- Model validation and tuning with high-quality reference data.
- Consulting and support on snow losses, soiling, O&M optimization, and yield forecasting.
- Proven track record with leading IPPs, developers, and consultants.
👉 Ready to go further? Contact us to learn how we can help solve your modeling challenge!