GeoscienceAustralia / hazimp

Hazard impact assessment tool
https://hazimp.readthedocs.io/
GNU Affero General Public License v3.0
14 stars 7 forks source link

Enable `hazimp` to run using netcdf files #53

Closed kieranricardo closed 2 years ago

kieranricardo commented 2 years ago

This PR enables files_raster_data_at_points to use netcdf files so that hazimp can be run with the wind gusts files (without multipliers applied). A limitation is that only the first band is loaded in which is sufficient for this use case, and the tif processing code does the same thing.

codecov-commenter commented 2 years ago

Codecov Report

Merging #53 (57b17a0) into develop (4b2eeb6) will decrease coverage by 0.05%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop      #53      +/-   ##
===========================================
- Coverage    86.60%   86.55%   -0.06%     
===========================================
  Files           26       26              
  Lines         1836     1844       +8     
===========================================
+ Hits          1590     1596       +6     
- Misses         246      248       +2     
Impacted Files Coverage Δ
hazimp/raster.py 98.92% <100.00%> (+0.10%) :arrow_up:
hazimp/misc.py 93.15% <0.00%> (-1.06%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4b2eeb6...57b17a0. Read the comment docs.

wcarthur commented 2 years ago

Hazimp already can read netcdf files using the GDAL API. There's a function hazimp.misc.mod_file_list() that alters the supplied file name to be NETCDF:"<filename>":<variable>, with both filename and variable required in the configuration: file.https://github.com/GeoscienceAustralia/hazimp/blob/ebe22f58a246645189bee12b9e6f4e0eebc4112b/hazimp/misc.py#L89 See also https://github.com/GeoscienceAustralia/hazimp/blob/ebe22f58a246645189bee12b9e6f4e0eebc4112b/hazimp/templates/wind.py#L206 and https://hazimp.readthedocs.io/en/latest/docs/user_guide.html#wind-template With that example configuration on the docs though, you can now use hazard_raster instead of load_wind

kieranricardo commented 2 years ago

my bad - I didn't realise this functionality already existed!