Solar Data
In Part 01 of this series, Andrew Durkan identified that vines need around 1300 hours of sunshine, and as such, sunlight was going to be a significant factor. After some searching for sources, I settled on the outputs from the Global Solar Atlas. This resource doesn’t provide sunlight hours but instead has other measures, including:
- Specific photovoltaic power output
- Direct normal irradiation
- Global horizontal irradiation
- Diffuse horizontal irradiation
- Global irradiation for optimally tilted surface
I figured that this dataset — whilst not exactly what I was after — should be a strong covariant. I downloaded the Annual and monthly statistics where available.
The zip file unpacked into the following file structure:
├─── 05 solar │ ├─── Australia_GISdata_LTAy_YearlyMonthlyTotals_GlobalSolarAtlas-v2_GEOTIFF │ │ └─── monthly
This data was in EPSG:4326 (WGS 84) at various resolutions, specifically:
- Solar resource data (GHI, DIF, GTI, DNI): 9 arcsecs ~ 250 m
- Specific Photovoltaic Power Output: 30 arcsecs ~ 1 km
- Optimal Tilt Angle: 120 arcsec ~ 4 km
The project so had a spatial resolution of 150 arcsecs ~ 4.6km, as determined by using the formulas below (Nominals radius of Earth at the equator of 6371 km).
Some interpolation will be required to compare these data sets directly. $GDAL$, ever faithful, has this functionality in the $translate$ function. From the documentation, I need to pass the $-tr$ option and the x and y resolutions in addition to the source and destination file paths.
The sf package has a handy helper function wrapped around $GDAL$’s native utilities sf::gdal_utils which will be the basis of the function I will map over the GeoTIFF files.
On inspection, however, I noticed a second issues:
Take a look at the extent compared to my projects:
I need to “crop” into the project and modify the extent as well. I used sf::gdal_utils again but this time passing the $-projwin$ arguments and my extent coordinates. Due to limitations under the hood, I couldn’t pipe the results from one call into the destination of another which would have been much more elegant. Instead, I dropped the first call to a TEMP file then input that into the second call. I wrapped both of these calls into a function for mapping.
I pilfered the raster to dataframe code from part #2; however, I simplified it for the single-band raster case.
I wanted the code to be flexible enough to handle the monthly and annual case with minimal rewriting, so I included a directory check and creation step in the per folder function, leading to the following structure:
├─── 05 solar │ ├─── Australia_GISdata_LTAy_YearlyMonthlyTotals_GlobalSolarAtlas-v2_GEOTIFF │ │ └─── monthly │ └─── scaled │ ├─── annual │ └─── monthly
Additionally, the names (GHI, DIF, DNI) are not very friendly, and I’ll forget what they mean when I get to the modelling steps. To get around this, I also included a named replacement list for the destination files.
It was now a straightforward exercise to call the folder_of_tifs_to_df function for the annual and monthly cases, then bind the columns into a data frame.
For validation, I generated plots of Diffuse Horizontal Irradiation and Direct Normal Irradiation, which appear to have worked correctly.
The final folder structure is below:
C:.
│ Australia_GISdata_LTAy_YearlyMonthlyTotals_GlobalSolarAtlas-v2_GEOTIFF.zip
│ df_solar.csv
│
├─── Australia_GISdata_LTAy_YearlyMonthlyTotals_GlobalSolarAtlas-v2_GEOTIFF
│ │ DIF.tif
│ │ DNI.tif
│ │ GHI.tif
│ │ GTI.tif
│ │ OPTA.tif
│ │ PVOUT.tif
│ │
│ └─── monthly
│ PVOUT_01.tif
│ PVOUT_02.tif
│ PVOUT_03.tif
│ PVOUT_04.tif
│ PVOUT_05.tif
│ PVOUT_06.tif
│ PVOUT_07.tif
│ PVOUT_08.tif
│ PVOUT_09.tif
│ PVOUT_10.tif
│ PVOUT_11.tif
│ PVOUT_12.tif
│
└─── scaled
├─── annual
│ diffuse_horizontal_irradiation.tif
│ direct_normal_irradiation.tif
│ global_horizontal_irradiation.tif
│ global_irradiation_for_optimally_tilted_surface.tif
│ optimum_tilt_to_maximize_yearly_yield.tif
│ photovoltaic_power_potential.tif
│
└─── monthly
photovoltaic_power_potential_01.tif
photovoltaic_power_potential_02.tif
photovoltaic_power_potential_03.tif
photovoltaic_power_potential_04.tif
photovoltaic_power_potential_05.tif
photovoltaic_power_potential_06.tif
photovoltaic_power_potential_07.tif
photovoltaic_power_potential_08.tif
photovoltaic_power_potential_09.tif
photovoltaic_power_potential_10.tif
photovoltaic_power_potential_11.tif
photovoltaic_power_potential_12.tif