CyprienBosserelle / BG_Flood

Numerical model for simulating shallow water hydrodynamics on the GPU using an Adaptive Mesh Refinment type grid. The model was designed with the goal of simulating inundation (River, Storm surge or tsunami). The model uses a Block Uniform Quadtree approach that runs on the GPU but the adaptive/multi-resolution/AMR is being implemented and not yet operational. The core SWE engine and adaptivity has been inspired and taken from St Venant solver from Basilisk and the CUDA GPU memory model has been inspired by the work from Vacondio _et al._2017)
GNU General Public License v3.0
34 stars 15 forks source link

Using "time" and not "t" as time variable in input netcdf #99

Closed GuglielmoStecca closed 7 months ago

GuglielmoStecca commented 9 months ago

At present, when dealing with input multi-temporal rasters (e.g., rain), BGFlood requires the time coordinate of the netcdf file to be called "time", and crashes if it is called "t" (with the message that it cannot find the variable). It would be useful if either the code allowed using "t", or if this instruction on preparing inputs was clearly stated in the wiki.

I came across this bug because of using my own matlab script to prepare the netcdf input.

Here, my Matlab script as it did not work:

args={ "int",["x", "y", "t"], [length(xp), length(yp), 2], 'nc_float',intensity_output}; axisdef = {"x", length(xp), 'nc_float', xp'; "y", length(yp), 'nc_float', yp'; "t", 2, 'nc_float', times}; ncdfsave_last(ncdffile, args, axisdef, DeflateLevel);

Here, an amended version that worked (where "t" has been replaced by "time" in two instances).

args={ "int",["x", "y", "time"], [length(xp), length(yp), 2], 'nc_float',intensity_output}; axisdef = {"x", length(xp), 'nc_float', xp'; "y", length(yp), 'nc_float', yp'; "time", 2, 'nc_float', times}; ncdfsave_last(ncdffile, args, axisdef, DeflateLevel);