plasticparcels.utils#
- plasticparcels.utils.create_directory(directory)[source]#
Function to create a directory if it does not exist.
- plasticparcels.utils.distance(lon1, lat1, lon2, lat2)[source]#
Function to calculate the great circle distance between two points on the earth (specified in decimal degrees).
- plasticparcels.utils.download_plasticparcels_dataset(dataset: str, settings, data_home=None)[source]#
Function to load an example dataset from the parcels website.
This function provides quick access to a small number of example datasets that are useful in documentation and testing in parcels.
- Parameters:
dataset (str) – Name of the dataset to load.
settings (dict) – Dictionary containing the settings for the models and simulation.
data_home (pathlike, optional) – The directory in which to cache data. If not specified, the value of the
PLASTICPARCELS_DATA
environment variable, if any, is used. Otherwise the default location is assigned byget_data_home()
.
- Returns:
dataset_folder – Path to the folder containing the downloaded dataset files.
- Return type:
Path
- plasticparcels.utils.get_coords_from_polygon(shape)[source]#
Function to return a list of coordinate points on a Polygon (or MultiPolygon) shape.
- plasticparcels.utils.getclosest_ij(lats, lons, latpt, lonpt)[source]#
Function to find the index of the closest point to a certain lon/lat value.