scalenav.data.centre_cell_to_square(h3_cell, neighbs)

If a centroid h3 index is known, return the square cover for a cell and grid_param

Parameters:
  • h3_cell (str)

  • neighbs (list[tuple[int]])

Return type:

list[str]

scalenav.data.df_project_on_grid(data, res=11)
scalenav.data.df_project_on_grid(data, res=11)

Project a geopandas.GeoDataFrame containing points on the H3 grid at a given resolution.

Parameters:
  • data (a geopandas.GeoDataFrame with a geometry column containing points.)

  • res (a integer value of H3 resolution.)

Return type:

The original data frame with a new column called h3_id ccontaining the H3 code for each geometry.

scalenav.data.layer_constrain(layer, constraint)

Apply a constraint to a layer. Remove the constrained cells from the layer and renormalise the values.

Parameters:
  • layer ([<class 'pandas.core.frame.DataFrame'>, <class 'geopandas.geodataframe.GeoDataFrame'>])

  • constraint ([<class 'pandas.core.frame.DataFrame'>, <class 'pandas.core.series.Series'>])

scalenav.data.pt_project_on_grid(lat, lon, res=11)

Get H3 index of lat,lon coordinates for a resolution. Simple wrapper around the H3.latlng_to_cell function.

Parameters:
  • lat (float)

  • lon (float)

  • res (int)

Return type:

DataFrame

scalenav.data.rast_to_centroid(out_path, in_paths)

Convert a bunch of raster files given by their file location in a list into a single geospatial file containing the centroids of cells. If the out_path exists, then simply read it. This is kind of deprecated and replaced by the command line tool and higher performance function using pyArrow.

Parameters:
  • out_path (str, is a single path to a parquet file.)

  • in_paths (list(str), is a list of paths to .tiff or .nc files.)

Return type:

a pandas.DataFrame with columns lon, lat and band.

scalenav.data.rast_to_h3_map(x=0.0, y=51.51, ref='m', dist=0)

Allows adding a custom distance value for unusual grid shapes and specify if the raster cells are in projected or arc sizes.

Parameters:
  • x (float)

  • y (float)

  • ref (str)

  • dist (float)

scalenav.data.square_poly(lat, lon, distance=10000, ref='arc')

Make a square box with side size given in the distance parameter centered on the (lon,lat) point. The distance is expected to be in meters. The coordinates in degrees according to WGS:84.

Parameters:
  • lat (float)

  • lon (float)

  • distance (int)

  • ref (str)

Return type:

Polygon