local_values
¶
Functions:
-
distanceToCoastline–Computes the distance to the coastline from a given geographic point.
-
waterDepthFromLocation–Returns the water depth (in meters) at a given geographic location.
distanceToCoastline
¶
distanceToCoastline(
latitude, longitude, distancetoCoastFilePath=None
)
Computes the distance to the coastline from a given geographic point.
Parameters:
-
(latitude¶float) –Latitude in decimal degrees.
-
(longitude¶float) –Longitude in decimal degrees.
-
(distancetoCoastFilePath¶str, default:None) –File path to the distance-to-coast raster. Loaded from defaults if not specified. Relevant files can be downloaded from https://oceancolor.gsfc.nasa.gov/resources/docs/distfromcoast/
Returns:
-
float or None–Distance in kilometers, or None if the point is out of bounds or an error occurs.
Source code in reskit/util/local_values.py
waterDepthFromLocation
¶
waterDepthFromLocation(
latitude: int | float,
longitude: int | float,
waterDepthFilePath: Optional[str] = None,
consider_only: Literal[
False, "negative", "positive"
] = False,
)
Returns the water depth (in meters) at a given geographic location.
Parameters:
-
(latitude¶int | float) –Latitude in decimal degrees.
-
(longitude¶int | float) –Longitude in decimal degrees.
-
(waterDepthFilePath¶str, default:None) –Path or pattern to one or more GeoTIFF water depth files. Support wildcards such as '*'. Relevant files can be downloaded from https://www.gebco.net/data-products/gridded-bathymetry-data.
-
(consider_only¶(False, negative, positive), default:False) –Controls how to interpret the sign of the source raster values: - False: legacy behavior — return abs(resultDepth) if a value is found. - "negative": treat water depth as NEGATIVE below sea level (e.g., GEBCO). Positive values (land) are returned as 0.0. Negative values are returned as their magnitude (e.g., -7.3 -> 7.3). - "positive": treat water depth as POSITIVE below sea level (inverted rasters). Negative values (land/invalid) are returned as 0.0. Positive values are returned as-is.
Returns:
-
float or None–Water depth at the specified location in meters (always positive). Returns None if not found.
Source code in reskit/util/local_values.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |