firetools / qgis2fds

An open source and free tool to export terrain elevation, landuse, and georeferencing to NIST FDS for computational fluid dynamics (CFD) wildfire or atmospheric pollutants dispersion simulations.
GNU General Public License v3.0
17 stars 13 forks source link

extracting FDS-LS data to netcdf #92

Open 3dfirelab opened 1 month ago

3dfirelab commented 1 month ago

I use the attached code to read the terrain data (.ter files) that were generated with qgis2fds terrainToNc.py.txt

when I plot the terrain from fds on the original data used in qgis2fd, I can see a slight rotation. Screenshot_2024-09-26_20-11-52

Am i trying to redo something that already exist? if not, I have been trying to see where I could have included a rotation, but without success The code is using an slread function I got from randy sometime ago that load the .ter files then it set a grid for the whole domain that is not critical I think and finally use the scipy function griddata to interpolate the fds value on a 2D plan.

Let me know if i should put my qgis project somewhere together with the generated fds config file

rmcdermo commented 1 month ago

@johodges @emanuelegissi Any chance this is already fixed in the dev branch for qgis2fds?

johodges commented 1 month ago

I remember we did some work on the projections, so I think this might be fixed already. If you can upload the project file as a zip with any local file dependencies included I can try and run it on dev.

3dfirelab commented 1 month ago

the data testTerrain.tar.gz

my config for qgis2fds 20240926_22h50m09s_grim

domain extent: 1.888192625,1.898496697,41.706845194,41.718590395 [EPSG:4326]

3dfirelab commented 1 month ago

I am trying to deploy the dev version from the git repository
I managed to deploy the plugin from the branch master and install in QGIS I then tried to switch to the branch dev, but there I am missing the algo folder and cannot /deploy.sh the dev version.
what should I do to get the dev version of the plugin? Thanks

emanuelegissi commented 1 month ago

I use the attached code to read the terrain data (.ter files) that were generated with qgis2fds terrainToNc.py.txt

when I plot the terrain from fds on the original data used in qgis2fd, I can see a slight rotation.

It is hard to exactly understand what happened, because you did not specify where the original data comes from and what kind of transformations you applied.

I suppose the following happened:

Always double check that each of your data layers are correctly configured with the right reference system. GIS tools are not for the faint of heart ;-)

Check what I supposed by showing the View > Decorations > North arrow.

emanuelegissi commented 1 month ago

I am trying to deploy the dev version from the git repository

Install git on you computer and check out the qgis2fds repo. Then replace your existing qgis2fds plugin folder contents with the qgis2fds repo you just downloaded. Reload QGIS.

Or wait for me releasing a new qgis2fds version.

Disclaimer: this is an open source tool, I am volunteering for it. I have got some work deadlines that do not allow me to fix that in the next few days.

johodges commented 1 month ago

I ran your project file on the dev branch and the fds file with the latest FDS master. I think the issue you are seeing is related to the CRS in your python script. I have an updated project file and processing script in the attached which does not show the same rotation issue. The elevation maps are still slightly offset in x-y but I attribute that to artifacts from repeated coordinate transformations and interpolation.

testTerrain_jh.zip

@emanuelegissi I had to make some local changes to pb_tool.cfg to update to the dev branch. Mainly updating the name of one of the python scripts and adding the "lang" directory. Also the plugin directory is hard coded so I had to make that match my machine. Do you want me to put in a PR to add this change on dev? We might want to figure out the best way to have pb_tool find the local qgis plugin folder rather than hard coding.

image

emanuelegissi commented 1 month ago

@johodges okay

3dfirelab commented 3 weeks ago

my problem was a projection issue. I was assuming that the UTM projection was aligned with the north. Using the fds2qgis version from github and making sure the projection to epsg:4326 is correct, I have now the terrain exported from FDS that aligned with the original terrain used in qgis2fds. I can then save the output in netcdf and open them in QGIS.

Then I moved forward and try to compute the ROS using an arrival time map that I computed from the level set contour variable. For the remaining of my question I moved to the FDS issue tracking as it is more relevant to FDS-LS.

https://github.com/firemodels/fds/issues/13607