Irradiance and Weather Requests

The WeatherData service endpoint offers a set of capabilities that allows the client to request irradiance and weather data for both single or bulk sites. The WeatherData endpoint requires the client to pass locations within their request, then specify the desired output irradiance and weather data fields. Available irradiance and weather data fields include:

  • Global Horizontal Irradiance (GHI)
  • Direct Normal Irradiance (DNI)
  • Diffuse Horizontal Irradiance (DHI)
  • 10-Meter Height Wind Speed
  • 2-Meter Height Dry Bulb Temperature
  • Relative Humidity
  • Liquid Precipitation
  • Solid Precipitation
  • Snow Depth

For more information about available data fields, see Terms and Concepts.

Irradiance and Weather Data

Request irradiance and weather data by specifying a set of latitude and longitude pairs. This method operates asynchronously, requiring the client to POST their simulation request, then retrieve data using a GET request.

import requests
from requests.auth import HTTPBasicAuth
import xml.etree.ElementTree as ET
import time


#POST Create WeatherData Request
url = "https://service.solaranywhere.com/api/v2/WeatherData"
userName = "your_username@your_company.com"
password = "your_password"

querystring = {"key":"your_client_key"}

payload = """<CreateWeatherDataRequest xmlns="http://service.solaranywhere.com/api/v2">
<Sites>
 <Site Name="Los Angeles" Latitude="34.00" Longitude="-118.40" />
</Sites>
<Options
 WeatherDataSource="SolarAnywhere3_2"
 WeatherDataPreference = "Auto"
 PerformTimeShifting = "true"
 StartTime="2011-11-11T00:00:00-08:00"
 EndTime="2011-11-13T00:00:00-08:00"
 SpatialResolution_Degrees="0.1"
 TimeResolution_Minutes="60"
 OutputFields="StartTime,ObservationTime,EndTime,GlobalHorizontalIrradiance_WattsPerMeterSquared,
 DirectNormalIrradiance_WattsPerMeterSquared,AmbientTemperature_DegreesC,WindSpeed_MetersPerSecond"
 SummaryOutputFields="TotalGlobalHorizontalIrradiance"/>
</CreateWeatherDataRequest>"""
 
headers = {
 'content-type': "text/xml; charset=utf-8",
 'content-length': "length",
 }
 
response = requests.post(url,auth = HTTPBasicAuth(userName,password),data=payload,
           headers=headers,params=querystring)
 
root = ET.fromstring(response.content)
print(response.content)
print("-----")
 
publicId = root.attrib.get("WeatherRequestId")
print(publicId)
 
#GET WeatherDataResult
url2 = "https://service.solaranywhere.com/api/v2/WeatherDataResult/"
 
requestNumber = 0
MAX_requestNumber = 100
 
while(requestNumber < MAX_requestNumber):
 time.sleep(5)
 data = requests.get(url2 + publicId,auth = HTTPBasicAuth(userName,password))
 radicle = ET.fromstring(data.content)
 status = radicle.attrib.get("Status")
 print(radicle)
 if status == "Done":
  print(data.content)
  break
 else:
  requestNumber = requestNumber + 1
Sample Requests

The client can request different irradiance and weather data types through the WeatherData method. Each WeatherData request contains a set of individual solar sites that are defined by a latitude and longitude. The WeatherData structure allows client applications to specify the desired weather data source, time range and data resolution. Spatial resolution is tied to the solar model with options for 10-km Standard Resolution (SpatialResolution=”0.1″) and 1-km Enhanced Resolution (SpatialResolution=”0.01″). The time resolution returns the most granular time step available within the client license. For more detail on available options, see the Complete Schema.

 

Here are a few sample WeatherData request XML payloads using different options for irradiance data. For more information about available data resolutions, see SolarAnywhere Data Resolution. For more information about available datasets, see SolarAnywhere Datasets.

<CreateWeatherDataRequest xmlns="http://service.solaranywhere.com/api/v2">
 <Sites>
  <Site Name="Los Angeles" Latitude="34.00" Longitude="-118.40" />
 </Sites>
 <Options
 WeatherDataSource="SolarAnywhereTGY2016"
 WeatherDataPreference = "Auto"
 PerformTimeShifting = "true"
 SpatialResolution_Degrees="0.1"
 TimeResolution_Minutes="60"
 OutputFields="StartTime,EndTime,GlobalHorizontalIrradiance_WattsPerMeterSquared,
 DirectNormalIrradiance_WattsPerMeterSquared,DiffuseHorizontalIrradiance_WattsPerMeterSquared,
 AmbientTemperature_DegreesC,WindSpeed_MetersPerSecond"/>
</CreateWeatherDataRequest>
<CreateWeatherDataRequest xmlns="http://service.solaranywhere.com/api/v2">
 <Sites>
  <Site Name="Los Angeles" Latitude="34.00" Longitude="-118.40" />
 </Sites>
 <Options
 WeatherDataSource="SolarAnywhere3_2"
 WeatherDataPreference = "Auto"
 PerformTimeShifting = "true"
 StartTime="2011-11-11T00:00:00-08:00"
 EndTime="2011-11-11T05:00:00-08:00"
 SpatialResolution_Degrees="0.1"
 TimeResolution_Minutes="60"
 OutputFields="StartTime,ObservationTime,EndTime,GlobalHorizontalIrradiance_WattsPerMeterSquared,
 DirectNormalIrradiance_WattsPerMeterSquared,DiffuseHorizontalIrradiance_WattsPerMeterSquared,
 AmbientTemperature_DegreesC,WindSpeed_MetersPerSecond"/>
</CreateWeatherDataRequest>
<CreateWeatherDataRequest xmlns="http://service.solaranywhere.com/api/v2">
 <Sites>
  <Site Name="Los Angeles" Latitude="34.00" Longitude="-118.40" />
 </Sites>
 <Options
 WeatherDataSource="SolarAnywhere3_2"
 WeatherDataPreference = "Auto"
 PerformTimeShifting = "true"
 StartTime="2011-11-01T00:00:00-08:00"
 EndTime="2011-12-01T00:00:00-08:00"
 SpatialResolution_Degrees="0.1"
 TimeResolution_Minutes="60"
 SummaryOutputFields="TotalGlobalHorizontalIrradiance"/>
</CreateWeatherDataRequest>
Sample Responses

The sample response corresponds to the request for each solar irradiance dataset.

<?xml version="1.0" encoding="utf-8"?>
<GetWeatherDataResultResponse WeatherRequestId="11JVHUK" Status="Done" RequestId="RUEAPRLLH"
 xmlns="http://service.solaranywhere.com/api/v2">
 <WeatherdataResults>
  <WeatherDataResult SiteName="Los Angeles" Status="Success">
   <WeatherSourceInformation WeatherSiteName="SolarAnywhereTGY2016" Latitude="34" Longitude="-118.4"/>
    <WeatherDataPeriods TimeResolution_Minutes="60" FirstStartTime="2008-12-31T23:00:00-08:00">
     <WeatherDataPeriod StartTime="2016-12-31T23:00:00-08:00" EndTime="2017-01-01T00:00:00-08:00" 
     GlobalHorizontalIrradiance_WattsPerMeterSquared="0" DirectNormalIrradiance_WattsPerMeterSquared="0"
     DiffuseHorizontalIrradiance_WattsPerMeterSquared="0" AmbientTemperature_DegreesC="11" 
     WindSpeed_MetersPerSecond="1"/>
     <WeatherDataPeriod StartTime="1999-01-01T00:00:00-08:00" EndTime="1999-01-01T01:00:00-08:00"
     GlobalHorizontalIrradiance_WattsPerMeterSquared="0" DirectNormalIrradiance_WattsPerMeterSquared="0"
     DiffuseHorizontalIrradiance_WattsPerMeterSquared="0" AmbientTemperature_DegreesC="10"
     WindSpeed_MetersPerSecond="2"/>
     <WeatherDataPeriod StartTime="1999-01-01T01:00:00-08:00" EndTime="1999-01-01T02:00:00-08:00"
     GlobalHorizontalIrradiance_WattsPerMeterSquared="0" DirectNormalIrradiance_WattsPerMeterSquared="0"
     DiffuseHorizontalIrradiance_WattsPerMeterSquared="0" AmbientTemperature_DegreesC="10"
     WindSpeed_MetersPerSecond="1"/>
...[Results truncated due to length of response]

 

<?xml version="1.0" encoding="utf-8"?>
<GetWeatherDataResultResponse WeatherRequestId="H7R4X0J" Status="Done" RequestId="3CXPPQT2M" 
 xmlns="http://service.solaranywhere.com/api/v2">
 <WeatherdataResults>
  <WeatherDataResult SiteName="Los Angeles" Status="Success">
   <WeatherSourceInformation WeatherSiteName="SolarAnywhere3_2" Latitude="34" Longitude="-118.4"/>
   <WeatherDataPeriods TimeResolution_Minutes="60" FirstStartTime="2011-11-11T00:00:00-08:00">
    <WeatherDataPeriod StartTime="2011-11-11T00:00:00-08:00" ObservationTime="2011-11-11T00:30:00-08:00"
     EndTime="2011-11-11T01:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="14" WindSpeed_MetersPerSecond="0"/>
    <WeatherDataPeriod StartTime="2011-11-11T01:00:00-08:00" ObservationTime="2011-11-11T01:30:00-08:00"
     EndTime="2011-11-11T02:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="14" WindSpeed_MetersPerSecond="0"/>
    <WeatherDataPeriod StartTime="2011-11-11T02:00:00-08:00" ObservationTime="2011-11-11T02:30:00-08:00"
     EndTime="2011-11-11T03:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="13" WindSpeed_MetersPerSecond="0"/>
    <WeatherDataPeriod StartTime="2011-11-11T03:00:00-08:00" ObservationTime="2011-11-11T03:30:00-08:00"
     EndTime="2011-11-11T04:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="12" WindSpeed_MetersPerSecond="0"/>
    <WeatherDataPeriod StartTime="2011-11-11T04:00:00-08:00" ObservationTime="2011-11-11T04:30:00-08:00"
     EndTime="2011-11-11T05:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="12" WindSpeed_MetersPerSecond="0"/>
    <WeatherDataPeriod StartTime="2011-11-11T05:00:00-08:00" ObservationTime="2011-11-11T05:30:00-08:00"
     EndTime="2011-11-11T06:00:00-08:00" GlobalHorizontalIrradiance_WattsPerMeterSquared="0"
     DirectNormalIrradiance_WattsPerMeterSquared="0" DiffuseHorizontalIrradiance_WattsPerMeterSquared="0"
     AmbientTemperature_DegreesC="12" WindSpeed_MetersPerSecond="0"/>
   </WeatherDataPeriods>
  </WeatherDataResult>
 </WeatherdataResults>
</GetWeatherDataResultResponse>

 

<?xml version="1.0" encoding="utf-8"?>
<GetWeatherDataResultResponse WeatherRequestId="GTRRNL0" Status="Done" RequestId="7YE9NJRKB" 
 xmlns="http://service.solaranywhere.com/api/v2">
 <WeatherdataResults>
  <WeatherDataResult SiteName="Los Angeles" Status="Success">
   <WeatherSourceInformation WeatherSiteName="SolarAnywhere3_2" Latitude="34" Longitude="-118.4"/>
   <Summary TotalGlobalHorizontalIrradiance="95570">
    <AnnualSummary>
     <Year YearNumber="2011" PartialYear="true" TotalGlobalHorizontalIrradiance="95570">
      <Monthly MonthNumber="11" TotalGlobalHorizontalIrradiance="95570"/>
     </Year>
    </AnnualSummary>
   </Summary>
  </WeatherDataResult>
 </WeatherdataResults>
</GetWeatherDataResultResponse>

What’s Next?