A context is an object that stores data (called resources) and metadata used by one or more models. It also allows PVRADAR to automatically retrieve required data from external sources such as satellite databases or meteorological station networks.
In a simple context—like a PvradarSite
(or just site
)—this mainly includes the location and modeling interval.
In a more advanced context—like a PvradarProject
(or project
)—it can also include detailed design parameters and connections to additional (private) data sources.
A location is a tuple of two floats: latitude and longitude.
from pvradar import PvradarSite
site = PvradarSite(location=(48.124109, 11.603763)) # Office of PVRADAR Labs in Munich, Germany
PVRADAR automatically infers the local time zone based on the location.
You can access the location from the context:
print(site.location)
Location: name: None latitude: 39.138 longitude: -121.941 altitude: 26.0 tz: Etc/GMT+8
The modelling interval defines the start and end of your analysis.
You can specify it as a string of two dates (YYYY-MM-DD HH:MM
) in local time, separated by ..
:
site.interval = '2015..2016'
site.interval = '2015-01-01..2016-12-31'
# Format: YYYY-MM-DD
Note that the interval completely includes both the start and end you specify. In both above examples that would be from the first hour of 2015 to the last hour of 2016 - both examples are equivalent.
Internally the simulation interval is treated as a pandas.Interval
From the interval, you can easily create a DateTimeIndex
or a new pandas.Series
:
from pvradar.sdk import interval_to_index
import pandas as pd
index = interval_to_index(site.interval, '1h') # creates a DateTimeIndex with hourly frequency
my_series = pd.Series(0, index=index) # creates a simple pandas Series with all 0 values
Some resources—or rather, the models that generate them—require design information about the site or project. For example, before computing the tracker rotation angle, you need to define a tracker.
You can quickly assign a simple design to your site using PvradarSite.as_tracker_array()
:
PvradarSite.as_tracker_array(
location = location,
interval = interval,
axis_height = 1.5, # in m
axis_azimuth = 0, # in deg
axis_tilt = 0, # in deg
max_tracking_angle = 60, # in deg
night_stow_angle = 0, # in deg
backtracking = True,
module_rated_power = 400, # in W
dc_capacity = 100 * 1e6, # in W (factor 1e6 for MW)
module_placement = '2v'
)
For fixed-tilt designs, use PvradarSite.as_fixed_array()
:
PvradarSite.as_fixed_array(
location = location,
interval = interval,
tilt = 20, # in deg
azimuth = None, # in deg (None = 0)
clearance = 1, # in m
module_rated_power = 400, # in W
dc_capacity = 100 * 1e6, # in W (factor 1e6 for MW)
module_placement = '2v'
)
<aside> 💡
All inputs to as_fixed_array
and as_tracker_array
are optional! You can rely on default values for quick analyses.
</aside>
For more complex modeling—including soiling and snow loss assessment, cleaning optimization, or albedo improvement—you can link your context to a project from the PVRADAR Web Platform. For more info visit https://pvradar.com/product.
from pvradar import PvradarProject
project = PvradarProject(project_id='my-project-id')
PVRADAR lets you connect your models and workflows to your favorite tools and data — both internal and third-party — with full flexibility and without compromising data privacy.
<aside> 🤔
Imagine having access to all your internal data in a single line of code!
</aside>
Whether you're using SCADA data, custom measurements, or your own API integrations, the PVRADAR Python Package gives you the building blocks to bring it all together. Every model runs locally, so your data stays private and under your control.
For more information, contact us!