dep_tools.grids module
Grid definitions for use in creating products.
- dep_tools.grids.PACIFIC_EPSG = 'EPSG:3832'
The EPSG code used for products
- Type:
str
- dep_tools.grids.GADM_FILE = PosixPath('/usr/local/lib/python3.10/dist-packages/dep_tools/gadm_pacific.gpkg')
The path to a geopackage containing GADM data over the Digital Earth Pacific countries and territories.
- Type:
Path
- dep_tools.grids.COUNTRIES_AND_CODES = {'American Samoa': 'ASM', 'Cook Islands': 'COK', 'Fiji': 'FJI', 'French Polynesia': 'PYF', 'Guam': 'GUM', 'Kiribati': 'KIR', 'Marshall Islands': 'MHL', 'Micronesia': 'FSM', 'Nauru': 'NRU', 'New Caledonia': 'NCL', 'Niue': 'NIU', 'Northern Mariana Islands': 'MNP', 'Palau': 'PLW', 'Papua New Guinea': 'PNG', 'Pitcairn Islands': 'PCN', 'Samoa': 'WSM', 'Solomon Islands': 'SLB', 'Tokelau': 'TKL', 'Tonga': 'TON', 'Tuvalu': 'TUV', 'Vanuatu': 'VUT', 'Wallis and Futuna': 'WLF'}
The names and 3-letter country codes of Digital Earth Pacific countries and territories.
- Type:
dict[str, str]
- dep_tools.grids.gadm()[source]
GADM data for Digital Earth Pacific Island Countries and Territories.
Creates and stores the file at
GADM_FILEif it does not exist. Otherwise, it is simply read and returned.- Return type:
GeoDataFrame- Returns:
A GeoDataFrame
- dep_tools.grids.gadm_union()[source]
GADM polygons as a single shape.
- Return type:
GeoDataFrame- Returns:
A GeoDataFrame.
- dep_tools.grids.get_tiles(resolution=30, country_codes=None, buffer_distance=None)[source]
Returns a list of tile IDs for the Pacific region, optionally filtered by country code.
- Parameters:
resolution (
int|float) – The output resolution of the tilescountry_codes (
Optional[list[str]]) – A list of 3-letter codes of the desired countries or territories. If unset, all PICTs are returned.buffer_distance (
Union[int,float,None]) – As forgrid().
- Return type:
Iterator[tuple[tuple[int,int],GeoBox]]
Returns:
- Raises:
ValueError – If country codes are not in
COUNTRIES_AND_CODES.
- dep_tools.grids.grid(resolution=30, simplify_tolerance=0.1, crs='EPSG:3832', return_type='GridSpec', intersect_with=None, buffer_distance=None)[source]
Returns a GridSpec or GeoSeries representing the Pacific grid, optionally intersected with an area of interest.
- Parameters:
resolution (
int|float) – The resolution, in meters, of the output. As tiles are defined to be 96,000 meters on each side, it should divide 96,000 evenly.crs – The desired crs of the output.
return_type (
Literal['GridSpec','GeoSeries','GeoDataFrame']) – The return type. If intersect_with (see below) is not None, this is ignored.intersect_with (
Optional[GeoDataFrame]) – The output is intersected with the supplied GeoDataFrame before returning, returning only tiles which overlap with those features. If return_type is GridSpec, an iterator of tuples each containing the tile id (in column, row order) and its GeoBox. Otherwise, a GeoDataFrame containing only the portions of each tile that intersect the given GeoDataFrame is returned.
- Return type:
Union[GridSpec,GeoSeries,GeoDataFrame,Iterator[tuple[tuple[int,int],GeoBox]]]
- dep_tools.grids.PACIFIC_GRID_30 = GridSpec(crs=EPSG:3832, tile_shape=Shape2d(x=3200, y=3200), resolution=Resolution(x=30, y=-30))
A 30-meter resolution grid.
- Type:
geopandas.GeoDataFrame
- dep_tools.grids.PACIFIC_GRID_10 = GridSpec(crs=EPSG:3832, tile_shape=Shape2d(x=9600, y=9600), resolution=Resolution(x=10, y=-10))
A 10-meter resolution grid.
- Type:
geopandas.GeoDataFrame