Open alexander-petkov opened 4 years ago
Solar radiation output from an RTMA Cloud Cover file and an elevation file clipped and resampled to RTMA extent and resolution:
Edit: It looks like I have to find a DEM file covering the full RTMA extent, not just CONUS
Edit 2: Replaced the screenshot with solar computations using SRTM30 elevation data, reprojected, resampled and clipped to RTMA values.
git clone https://github.com/firelab/windninja.git
sudo apt install libboost-all-dev
sudo apt install libgdal-dev
g++ -c -Wall -g Elevation.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g Aspect.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g Slope.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g Shade.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g Solar.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g solpos.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g ninja_init.cpp -I /usr/include/gdal -l gdal
g++ -c -Wall -g ninja_conv.cpp -I /usr/include/gdal -l gdal
g++ -g -o solar_grid solar_grid.cpp \
-I /usr/include/gdal/ -I /usr/include -I ../ninja \
-l gdal -l boost_date_time \
../ninja/Elevation.o ../ninja/Shade.o ../ninja/Aspect.o ../ninja/Slope.o \
../ninja/solar.o ../ninja/ninja_init.o ../ninja/solpos.o ../ninja/ninja_conv.o
The following steps are for the RTMA files.
Prepare elevation raster with same projection, extent, and resolution as RTMA files
gdalwarp -t_srs '+proj=lcc +lat_1=25 +lat_2=25 +lat_0=25 +lon_0=-95 +x_0=0 +y_0=0 +a=6371200 +b=6371200 +units=m +no_defs' -s_srs '+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' -te -3272417.140 -265067.354 2683186.395, 3790838.337 -tr 2539.702999999999975 2539.702999999999975 -of GTiff ~/Downloads/cephfs/wfas/data/rtma/varanl/tif/2t/rtma2p5.20190911/rtma2p5.t00z.2dvaranl_ndfd.grb2_wexp ~/Downloads/cephfs/wfas/data/rtma/rtma_dem.tif
Copy timezone file to the same directory as the new executable:
cp ../data/date_time_zonespec.csv .
Run the solar_grid executable:
./solar_grid --cloud-file ~/Downloads/cephfs/wfas/data/rtma/varanl/tif/tcc/rtma2p5.20190911/rtma2p5.t00z.2dvaranl_ndfd.grb2_wexp \
--minute 0 --hour 0 --day 11 --month 9 --year 2019 --time-zone UTC \
~/Downloads/cephfs/wfas/data/rtma/rtma_dem.tif solar.tif
Compile a static executable, which is capable of running multiple threads:
wget http://download.osgeo.org/gdal/2.4.0/gdal-2.4.0.tar.gz
tar xzvf gdal-2.4.0.tar.gz
cd gdal-2.4.0/
sudo apt install libproj-dev
./configure --without-libtool --without-libz --with-grib=no --with-mrf=no --with-expat=no --with-xml2=no --with-lerc=no --with-jpeg=internal --with-crypto=no --with-proj=yes --enable-shared=no
g++ -g --static -std=c++11 -fopenmp -o solar_grid solar_grid.cpp -I ../ninja -I /home/ubuntu/gdal-2.4.0/gcore/ -I /home/ubuntu/gdal-2.4.0/port -I /home/ubuntu/gdal-2.4.0/ogr/ -I /home/ubuntu/gdal-2.4.0/alg -L /home/ubuntu/gdal-2.4.0/ -l gdal -l boost_date_time -l pthread -l proj -l z -l dl -l tiff -l geotiff -l lzma -l jbig ../ninja/Elevation.o ../ninja/Shade.o ../ninja/Aspect.o ../ninja/Slope.o ../ninja/solar.o ../ninja/ninja_init.o ../ninja/solpos.o ../ninja/ninja_conv.o
Attached is animated output for Solar radiation computed with RTMA Cloud Cover data.
I am not sure that the values are what is expected--I simply used the Cloud Cover rasters as inputs.
Solar radiation is configured for RTMA, NDFD, and GFS dataset in Geoserver, and as part of the update chain for each dataset commit
I am not sure of accuracy and usefulness for Solar radiation from GFS data, considering that the inputs are such a coarse resolution:
The static executable is working on the AWS instances as well, just by copying and running it.
Calculate the surface solar radiation grid for each hour of the RTMA and NDFD periods and pipeline it into the list of coverages for these archives.
Use the code from WindNinja as a guide: https://github.com/firelab/windninja/blob/master/src/solar_grid/solar_grid.cpp