The first licenses were awarded in 1965.
The rest is history.
Will share script if requested (but needs a bit of commenting and preparation so won’t do that until someone asks me to).
The first licenses were awarded in 1965.
The rest is history.
Will share script if requested (but needs a bit of commenting and preparation so won’t do that until someone asks me to).
Thank you for sharing this animation, I really enjoyed it. I would love to see the script when you feel ready to share it.
Hi jhm18,
So glad to hear you enjoyed it. I’ll prepare the script and share it when it’s ready.
Andreas
Very nice!!!
Thanks Esteban!
Very nice. I see the YouTube comment from Oljedirektoratet says it was all GDAL. Probably need to update that comment and link so people who wish to try this do not go down the wrong rabbit hole.
Yikes! Will fix. I did not write that description!
I did have to use some GDAL as well though for date querying SQL-style.
Thanks for noticing and letting me know!
No worries. It is a nice example but probably a bit too complicated for a gallery case (?). And requires data not easily available to users perhaps. Anyway, good job!
The data is open and for everyone to use.
The script is surprisingly simple (maybe).
If you accept three ogr2ogr
calls and four sqlite3
calls it should be OK.
I will post the script and you can decide if it fits as a gallery case.
This is the script.
It’s a bit simplified compared to my original version.
Note: If you want to test it; consider changing the dates to a smaller interval first. It takes about 7-8 hours (Intel Core i7) to complete the script with the original date span (> 20.000 frames).
Note that the downloads involve ~50 megabyte. We create a geopackage of the shapefile containing well data, but it could just as well me a ‘normal’ sqlite base as we don’t use any spatial functions. We’re only dumping the contents of the completion date, long and lat columns.
# start and end date
start=1965-01-01T
stop=2022-01-01T
# create a file with all dates from $start to $stop
gmt math -o0 -T${start}/${stop}/1d T = times.txt
# download and prepare well data
wget https://factpages.npd.no/downloads/shape/wlbPoint.zip
unzip wlbPoint.zip
ogr2ogr -F GPKG wlbPoint.gpkg wlbPoint.shp
# create list of all exploration wells sorted by completion date
# this is for gmt movie
sqlite3 wlbPoint.gpkg ".separator ' '" "select ewDesDeg,nsDesDeg,CmplDate,wbName from wlbPoint WHERE well_type = 'EXPLORATION' AND CmplDate IS NOT NULL ORDER BY CmplDate ASC" > all.wells
# all wells drilled in the north sea
# this is for the small number-of-wells-plot to the lower right
sqlite3 wlbPoint.gpkg ".separator ' '" "select CmplDate,COUNT(*) OVER (ORDER BY CmplDate ROWS UNBOUNDED PRECEDING) from wlbPoint WHERE well_type = 'EXPLORATION' AND main_area = 'NORTH SEA' AND CmplDate IS NOT NULL ORDER BY CmplDate ASC" > north-sea.wells
# all wells drilled in the norwegian sea
# this is for the small number-of-wells-plot to the lower right
sqlite3 wlbPoint.gpkg ".separator ' '" "select CmplDate,COUNT(*) OVER (ORDER BY CmplDate ROWS UNBOUNDED PRECEDING) from wlbPoint WHERE well_type = 'EXPLORATION' AND main_area = 'NORWEGIAN SEA' AND CmplDate IS NOT NULL ORDER BY CmplDate ASC" > norwegian-sea.wells
# all wells drilled in the barents sea
# this is for the small number-of-wells-plot to the lower right
sqlite3 wlbPoint.gpkg ".separator ' '" "select CmplDate,COUNT(*) OVER (ORDER BY CmplDate ROWS UNBOUNDED PRECEDING) from wlbPoint WHERE well_type = 'EXPLORATION' AND main_area = 'BARENTS SEA' AND CmplDate IS NOT NULL ORDER BY CmplDate ASC" > barents-sea.wells
# download and prepare license history
wget https://factpages.npd.no/downloads/shape/prlAreaSplitByBlock.zip
unzip prlAreaSplitByBlock.zip
ogr2ogr -F GPKG prlAreaSplitByBlock.gpkg prlAreaSplitByBlock.shp
# download and prepare subAreas
wget https://factpages.npd.no/downloads/shape/subArea.zip
unzip subArea.zip
ogr2ogr -F GMT subArea.gmt subArea.shp
# clean up zip and shapefile related stuff
rm prlAreaSplitByBlock.{cpg,dbf,prj,sbn,sbx,shp,shp.xml,shx,zip} wlbPoint.{cpg,dbf,prj,sbn,sbx,shp,shp.xml,shx,zip} subArea.{cpg,dbf,prj,sbn,sbx,shp,shp.xml,shx,zip}
# main script. run for each date
cat <<eof > main.sh
gmt begin
# want minimal theme
gmt set GMT_THEME minimal
# make backdrop
gmt grdimage @earth_relief_02m -JS15/90/18c -R2/55.5/40/75r -t40
# relinquished licenses - write to file
ogr2ogr -sql "select * from prlAreaSplitByBlock where dtvalfrom <= '\${MOVIE_COL0}'" prlAreaSplitByBlock.gmt $(pwd)/prlAreaSplitByBlock.gpkg
# relinquished licenses - plot
gmt plot prlAreaSplitByBlock.gmt -Ggray90 -l"Relinquished license"+jTL
# active licenses - write to file
ogr2ogr -sql "select * from prlAreaSplitByBlock where dtvalfrom <= '\${MOVIE_COL0}' AND (dtvalto >= '\${MOVIE_COL0}' OR dtvalto IS NULL)" prlAreaSplitByBlock.gmt $(pwd)/prlAreaSplitByBlock.gpkg
# active licenses - plot
gmt plot prlAreaSplitByBlock.gmt -Ggray70 -l"License"
# plot wells that were completed on - or before - current date
gmt events all.wells -Sc0.1c -Gblack -T\${MOVIE_COL0} -Es+r2+d6 -Ms5+c0.5 -Mi1+c-0.6 -Mt+c0 --TIME_UNIT=d
# plot subareas
gmt plot subArea.gmt -Wthinner -t80
#plot timestamp with format yyyy-mm-dd and name
gmt psbasemap -B0 -U"Bubba McMudface" --FORMAT_TIME_STAMP=%F
# lower right miniplot of well count in each sea
gmt plot -Wthick,black -R1966-01-01/2022-01-01/0/1500 -JX8c/7c -l"North Sea" -X10c north-sea.wells
gmt plot -Wthick,black,. -l"Norwegian Sea" norwegian-sea.wells
gmt plot -Wthick,black,- -l"Barents Sea" barents-sea.wells
# plot moving bar that marks the current date
echo \${MOVIE_COL0} 1402 | gmt plot -Sb0.02c -Gblack
# plot frame
gmt psbasemap -Bya300f+l"wells" -BEs --FORMAT_DATE_MAP=yy
gmt end
eof
# final dimension of the image will be width x dpu and height x dpu, e.g. 1150px x 1550px for -C23cx31cx50
time gmt movie main.sh -Nncs -C23cx31cx50 -Fmp4 -Ttimes.txt -Lc0 -D182.5 --FORMAT_CLOCK_MAP=- -V -Pf+jTC+ac0 -Z # --FORMAT_DATE_MAP=yyyy
# clean up
rm times.txt main.sh *.wells