hydromt_sfincs.components.quadtree.SfincsQuadtreeGrid#
- class hydromt_sfincs.components.quadtree.SfincsQuadtreeGrid(model: SfincsModel)[source]#
Quadtree grid component attached to an
SfincsModel.All layers live in the
dataattribute as axugrid.UgridDataset, but a component may claim the layers it is responsible for through agrid_variablesattribute.write()keeps those out ofsfincs.ncunless called withwrite_components=True; the component writes them to its own UGRID netcdf through_write_layers(). Anything not claimed stays in the main file.Elevation, the SFINCS mask and the SnapWave mask stay in
qtrfile. Their componentread()methods ensure this grid is loaded, while theirwrite()methods are no-ops; persistence is handled here. Componentdataproperties expose their own layers with the mesh and attributes; this grid remains the full dataset and the destination forset()calls.Initialise the component with a back-reference to its parent model.
- __init__(model: SfincsModel) None[source]#
Initialise the component with a back-reference to its parent model.
Methods
__init__(model)Initialise the component with a back-reference to its parent model.
clear_overlay()Invalidate the cached edge-overlay dataframe.
close()Clean up all open datasets.
create(x0, y0, nmax, mmax, dx, dy, rotation, ...)Build the Quadtree grid.
create_from_region(region[, res, crs, ...])Setup a quadtree grid from a region.
create_index_cog(filename, filename_topobathy)Write a COG raster mapping each pixel to a quadtree cell index.
create_topobathy_cog(filename, elevation_list)Write a COG raster sampling the model topobathy.
cut_inactive_cells()Remove cells that are outside the active mask from the grid.
finish_write()Finish the write functionality after cleanup was called for all components in the model.
get_indices_at_points(x, y)Return the cell index at each (x, y) sample.
get_mesh(grid_name[, include_data])Return a specific grid topology from mesh based on grid_name.
map_overlay(file_name[, xlim, ylim, color, ...])Render a PNG map overlay of the grid edges.
read([filename, read_components])Reads a quadtree netcdf file and stores it in the QuadtreeGrid object.
set(data, *[, name, grid_name, overwrite_grid])Add data to mesh.
snap_to_grid(polyline)Snap a set of lines to the edges of the quadtree grid.
test_equal(other)Test if two components are equal.
write([filename, write_components])Writes a quadtree SFINCS netcdf file.
write_region([filename, to_wgs84, ...])Write the model region to file.
Attributes
boundsReturns model mesh bounds.
crsReturn the coordinate reference system of the regular grid.
Model static mesh data.
data_catalogReturn the data catalog of the model this component is associated with.
empty_maskReturn an all-zero mask with the shape of the current grid.
exteriorReturn the outer boundary of the active grid as polygons.
face_coordinatesReturn the (x, y) coordinates of the cell face centres.
is_emptyCheck whether the mesh is empty or not.
maskReturn the mask of the quadtree grid.
mesh_datasetsDictionnary of grid names and corresponding UgridDataset topology and data variables in mesh.
mesh_gdfReturns dict of geometry of grids in mesh as a gpd.GeoDataFrame.
mesh_gridsDictionary of grid names and Ugrid topologies in mesh.
mesh_namesList of grid names in mesh.
modelReturn the model object this component is associated with.
name_in_modelFind the name of the component in the parent model components.
regionReturn the outer boundary of the active grid as polygons
rootReturn the root of the model this component is associated with.