I am experimenting with using two hazards. These are both NetCDF files containing multiple timesteps of hazard data, where each timestep is considered to be an event. I have edited my single hazard pipeline to combine the hazard files using union() but have not been able to get things working. I would still like to use a site-mesh as I am working with large data. My hazard files are at the same resolution, same grids etc. so I thought I could join them and still use the site mesh built from one time step of one hazard. Is there something else I could try instead of union()?
Union only works for relational data (CSVs, shapefiles - anything that’s a table of data), not coverage data. I think the simplest fix for what you want here is to adjust your second select step so that you can bring in both of your NetCDFs at once and sample them independently so that you get two hazard values in your pipeline, e.g. sample_one and sampled_two. It might look something like…
select({
*,
to_coverage(bookmark('site-mesh-one'), options: {index: 'nearest_neighbour', nearest_neighbour_max_distance: $nn_cutoff}) as site_mesh_coverage_one,
to_coverage(bookmark('site-mesh-two'), options: {index: 'nearest_neighbour', nearest_neighbour_max_distance: $nn_cutoff}) as site_mesh_coverage_two
})
At this point you can either combine the coverages using the combine_coverages function, or sample them independently. Using combine_coverages lets you treat multiple coverages as a single one, which can be slightly more convenient than having two. You build it like this:
select({
*,
combine_coverages({
one: site_mesh_coverage_one,
two: site_mesh_coverage_two
},
# the grid resolution is only important if your sampling non point geometry, which it looks like you're not
grid-resolution: 100) as hazard_combined
})
You can then sample this like the other coverage before on line 11 in your image. The result will have one and two attributes, which are the result of sampling each of the coverages you combined. You can change these names to be more meaningful if you want, e.g. basecase and scenario or slr100 or what have you.
Hope that helps, get back in touch if you hit a wall,
Nick