Modify all values in a hazard geotiff

I have a pipeline that can be run using either of 2 sources for the hazard files. One source has the data in metres and the other has it in centimetres. Both sets of hazard files are defined in csvs. What is the best way to convert the data to metres?

MapsInMetres.csv

id,location,ARI,res
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI10_0.tif,10,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI20_0.tif,20,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI50_0.tif,50,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI100_0.tif,100,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI200_0.tif,200,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI500_0.tif,500,10
coastal_flooding,Data/Hazard/LiDAR/NZ_ARI1000_0.tif,1000,10

MapsInCm.csv

id,regioncode,location,ARI,deltaTemp,res
0,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI10_8m.tif,10,0,8
1,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI20_8m.tif,20,0,8
2,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI50_8m.tif,50,0,8
3,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI100_8m.tif,100,0,8
4,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI200_8m.tif,200,0,8
5,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI500_8m.tif,500,0,8
6,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI1000_8m.tif,1000,0,8

Kia ora John,

You can use map-value in the bookmark to convert the value sampled from the GeoTIFF:

So in your case, you would probably define 2 bookmarks like this:

[bookmark in_centimetres]
location = placeholder.tif
map-value = value / 100

[bookmark in_metres]
description = No mapping, the data is already in metres
location = placeholder.tif

And then add an extra column to your CSV with the ID of the bookmark to use.

Hope that helps.
Tim

Hi Tim,
Im not following sorry. My bookmarks point to a csv, I have added the map-value parameter but it does not make a difference.

[hazard_in_cm]
location = MapsInCm.csv
map-value = value / 100

Im not sure what you mean about adding an extra column to the csv
Thanks

Hi John,

Sorry I wasn’t clear. You need to define the map-value bookmark for the GeoTIFF, not the CSV. And then use that bookmark when you load the GeoTIFF from the CSV.

So your MapsInCm.csv file might look like this:

id,regioncode,location,ARI,deltaTemp,res,bookmarkID
0,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI10_8m.tif,10,0,8,in_centimetres
1,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI20_8m.tif,20,0,8,in_centimetres
2,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI50_8m.tif,50,0,8,in_centimetres
3,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI100_8m.tif,100,0,8,in_centimetres
4,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI200_8m.tif,200,0,8,in_centimetres
5,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI500_8m.tif,500,0,8,in_centimetres
6,01,Data/Hazard/nationalFluvialPluvialMaps/01_ARI1000_8m.tif,1000,0,8,in_centimetres

And then in your pipeline you would do something like:

input($hazard_csv)
->
select({ *, bookmark(bookmarkID, { location: location }, type: 'coverage(floating)') as coverage })

Let me know if that still doesn’t make sense.

Tim

Hey Tim,
Yes that makes sense. I have it working now.
Thanks for your help!