A Python package for implementing barycentric interpolation using DuckDB, specifically designed to compute SCHISM-derived depths on 30m grids. This tool provides an efficient, scalable solution for geospatial computations in large coastal domains.
- Efficient Barycentric Interpolation: Leverages DuckDB for handling large-scale geospatial data efficiently.
- Leverages Preprocessed Data: Preprocessed data from DEM, zonal coverage fraction, barycentric weight, and geosptial masks allows fast and effective interpolations.
- Efficient Storage: Data is converted and stored in DuckDB that significantly reduces storage volume.
- Customizable Pipelines: Modular structure allows easy adaptation to different datasets and use cases.
This software requires a working anaconda/miniconda installation, please visit miniconda page
-
Clone the repository:
cd your_custom_path git clone https://github.com/owp-spatial/zonal-fim.git cd zonal-fim
-
Then the package can be installed via executing
./setup.sh
-
In the case there are permission issues execute
chmod u+x setup.sh
To activate pre-configured environment execute
conda activate coastal_fim_vis
Preprocessed sample data for Atlantic Gulf domain is:
...
The script zonal_fim.py performs execution of pipeline for generating barycentric interpolation, generating masks, and preprocessing pipeline
-
Run the Barycentric Computation: General pipeline for executing barycentric interpolation is given that a preprocessing has been done once, we can pass a new .gr3 or .nc file, the path to schisim_database.duckdb, and specify the output path.
-i '/path/agGridfile.gr3'
or-i '/path/nwm.t05z.analysis_assim_coastal.total_water.tm02.atlgulf.nc'
Ensure
--execute True
.There is an option
--zarr_format
to produce the outputs as zarr instead of a .tif file and one does not need to change .tif to .zarr in depth and wse inputs this conversion will be done automatically.if
--generate_wse False
there is no need to specify a path got-q
python zonal_fim.py --generate_mask False --preprocess False --generate_wse True --generate_depth True --zarr_format False --execute True --dissolve False -i '/path/nwm.nc' -c '/path/zonal_database.duckdb' -m '/path/depth_raser_v1.tif' -q '/path/wse_raser_v1.tif'
A sample output of depth raster:
-
Output:
- Barycentric interpolation is saved as depth table in the DuckDB database.
- Can write WSE interpolation and depth values as .tif and .zarr file if specified.
- Tampa Region:
- Executed entire process: Pass
- Atlantic and Gulf Domain:
- Executed all steps except coverage fraction interpolation: Pass
- Comparison with Linear Interpolation:
- Validated results against linear interpolation: Pass
- Implemented:
- Barycentric computations.
- Batch processing for DEM and zonal data.
- Next Steps:
- Function descriptions
- Write comprehensive tests for the package.
Detailed documentation and implementation notes are available in the report: Report Link