6
$\begingroup$

Is there somewhere in Mathematica I can find direct and diffuse solar radiation for a specific position on Earth ? If not, is there a way to import those data from a website within a Mathematica code ? The best would be a code in which I give specifics date, latitude and longitude, and I get in return GHI and BHI for this place at this specific date.

Thanks !

$\endgroup$
  • $\begingroup$ Does globalsolaratlas.info help you at all? It contains maps for GHI, DHI, and so on (check the top right of the page). You can download data here: globalsolaratlas.info/downloads/world $\endgroup$ – Carl Lange Apr 10 at 13:03
  • $\begingroup$ This is not exactly what I'm looking for... I would like to get GHI and BHI for different places, that's why I'd rather import directly those datas within a code, if it is possible. $\endgroup$ – Adrien Apr 10 at 13:23
  • $\begingroup$ If necessary, you could download that data for much of the world as GeoTIFF from that web page, and then index into it locally. $\endgroup$ – Carl Lange Apr 10 at 13:26
  • $\begingroup$ Your best bet would probably to get long term monthly irradiance values (e.g. from re.jrc.ec.europa.eu/pvgis or Meteonorm), create synthetic hourly values with dedicated software (PVSOL, PVSYST, INSEL or possibly Python PVlib) and import them into Mathematica. One algorithm to create hourly values from monthly values has been published by Gordon-Reddy : sciencedirect.com/science/article/pii/0038092X88900163 $\endgroup$ – Eric Duminil Apr 10 at 17:27
8
$\begingroup$

It appears the US NREL has made an API available for this data. However, it is monthly averages, rather than live data by date. I think for this data, that's just how it is. It's also not clear to me what exactly the spatial extent is.

Let's write a WL function to query the data. You should replace DEMO_KEY with your own key after signing up, or you will very quickly hit rate limits. Signing up is free: https://developer.nrel.gov/signup/

solarData[place_] := 
 Import[URLBuild[
    "https://developer.nrel.gov/api/solar/solar_resource/v1.json", <|
     "api_key" -> "DEMO_KEY", 
     "lat" -> QuantityMagnitude@Latitude@place, 
     "lon" -> QuantityMagnitude@Longitude@place|>], "RawJSON"][
  "outputs"]

Which we can then use with:

 solarData[Entity["AdministrativeDivision", {"Kansas", "UnitedStates"}]]
<|"avg_dni" -> <|"annual" -> 5.32, 
   "monthly" -> <|"jan" -> 4.48, "feb" -> 4.72, "mar" -> 4.87, 
     "apr" -> 5.47, "may" -> 5.86, "jun" -> 6.23, "jul" -> 6.67, 
     "aug" -> 6.14, "sep" -> 5.78, "oct" -> 4.91, "nov" -> 4.58, 
     "dec" -> 4.03|>|>, 
 "avg_ghi" -> <|"annual" -> 4.62, 
   "monthly" -> <|"jan" -> 2.47, "feb" -> 3.26, "mar" -> 4.27, 
     "apr" -> 5.49, "may" -> 6.42, "jun" -> 6.79, "jul" -> 6.86, 
     "aug" -> 6.13, "sep" -> 5.04, "oct" -> 3.67, "nov" -> 2.73, 
     "dec" -> 2.16|>|>, 
 "avg_lat_tilt" -> <|"annual" -> 5.44, 
   "monthly" -> <|"jan" -> 4.46, "feb" -> 4.91, "mar" -> 5.31, 
     "apr" -> 5.84, "may" -> 6.05, "jun" -> 6.08, "jul" -> 6.31, 
     "aug" -> 6.28, "sep" -> 6.01, "oct" -> 5.22, "nov" -> 4.69, 
     "dec" -> 4.07|>|>|>

Another option would be to download data from https://globalsolaratlas.info/downloads/world or some other source (there are a few) and index into it locally, but this is a bit more hassle. In fact, if I was to use the Global Solar Atlas data, I would probably load it into a local Postgis database (using raster2pgsql) and query it that way, since Wolfram Language's ability to query into large spatial datasets is not as good as Postgis' is. Maybe someday :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.