id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
12,338
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Rounds a number to a specified number of decimal places. Args: num (float): The number to round. decimal (int, optional): The number of decimal places to round. Defaults to 2. Returns: float: The number with the specified decimal places rounded.
12,339
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Convert a list of jpg images to gif. Args: in_dir (str): The input directory containing jpg images. out_gif (str): The output file path to the gif. fps (int, optional): Frames per second. Defaults to 10. loop (bool, optional): controls how many times the animation repeats. 1 means that the animation will play once and ...
12,340
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Get geometry type of an Earth Engine object. Args: ee_object (object): An Earth Engine object. Returns: str: Returns geometry type. One of Point, MultiPoint, LineString, LinearRing, MultiLineString, BBox, Rectangle, Polygon, MultiPolygon.
12,341
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Add a new property to each feature containing a stylying dictionary. Args: ee_object (object): An ee.FeatureCollection. column (str): The column name to use for styling. palette (list | dict): The palette (e.g., list of colors or a dict containing label and color pairs) to use for styling. color (str, optional): A defa...
12,342
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Converts a KML to shapefile. Args: in_kml (str): The file path to the input KML. out_shp (str): The file path to the output shapefile. Raises: FileNotFoundError: The input KML could not be found. TypeError: The output must be a shapefile.
12,343
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def kml_to_ee(in_kml, **kwa...
Converts a KMZ to ee.FeatureCollection. Args: in_kmz (str): The file path to the input KMZ. Raises: FileNotFoundError: The input KMZ could not be found. Returns: object: ee.FeatureCollection
12,344
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def github_raw_url(url): ...
Converts a CSV file to pandas dataframe. Args: in_csv (str): File path to the input CSV. Returns: pd.DataFrame: pandas DataFrame
12,345
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Converts a shapefile to Geopandas dataframe. Args: in_shp (str): File path to the input shapefile. Raises: FileNotFoundError: The provided shp could not be found. Returns: gpd.GeoDataFrame: geopandas.GeoDataFrame
12,346
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Deletes a shapefile. Args: in_shp (str): The input shapefile to delete. verbose (bool, optional): Whether to print out descriptive text. Defaults to False.
12,347
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def df_to_geojson( df, ...
Converts a pandas DataFrame to ee.FeatureCollection. Args: df (pandas.DataFrame): An input pandas.DataFrame. latitude (str, optional): Column name for the latitude column. Defaults to 'latitude'. longitude (str, optional): Column name for the longitude column. Defaults to 'longitude'. Raises: TypeError: The input data ...
12,348
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Samples the pixels of an image, returning them as a ee.Dictionary. Args: ee_object (ee.Image | ee.ImageCollection): The ee.Image or ee.ImageCollection to sample. region (ee.Geometry): The region to sample from. If unspecified, uses the image's whole footprint. scale (float, optional): A nominal scale in meters of the p...
12,349
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Lists all defined avariables. Args: var_type (object, optional): The object type of variables to list. Defaults to None. Returns: list: A list of all defined variables.
12,350
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def ee_to_df( ee_object...
Samples the pixels of an image, returning them as a FeatureCollection. Each feature will have 1 property per band in the input image. Note that the default behavior is to drop features that intersect masked pixels, which result in null-valued properties (see dropNulls argument). Args: image (ee.Image): The image to sam...
12,351
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def gdf_to_ee(gdf, geodesic...
Retrieves place(s) by name or ID from the Nominatim API as an ee.FeatureCollection. Args: query (str | dict | list): Query string(s) or structured dict(s) to geocode. which_result (INT, optional): Which geocoding result to use. if None, auto-select the first (Multi)Polygon or raise an error if OSM doesn't return one. t...
12,352
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def osm_to_gdf( query, ...
Retrieves place(s) by name or ID from the Nominatim API as an ee.FeatureCollection. Args: query (str | dict | list): Query string(s) or structured dict(s) to geocode. which_result (INT, optional): Which geocoding result to use. if None, auto-select the first (Multi)Polygon or raise an error if OSM doesn't return one. t...
12,353
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Retrieves an API key based on a system environmen variable. Args: token_name (str): The token name. m (ipyleaflet.Map | folium.Map, optional): A Map instance. Defaults to None. Returns: str: The API key.
12,354
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def planet_monthly_tropical...
Generates Planet bi-annual and monthly imagery URLs based on an API key. See https://assets.planet.com/docs/NICFI_UserGuidesFAQ.pdf Args: api_key (str, optional): The Planet API key. Defaults to None. token_name (str, optional): The environment variable name of the API key. Defaults to "PLANET_API_KEY". Returns: list: ...
12,355
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def planet_monthly_tiles_tr...
Generates Planet monthly imagery TileLayer based on an API key. See https://assets.planet.com/docs/NICFI_UserGuidesFAQ.pdf Args: api_key (str, optional): The Planet API key. Defaults to None. token_name (str, optional): The environment variable name of the API key. Defaults to "PLANET_API_KEY". tile_format (str, option...
12,356
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def planet_monthly(api_key=...
Generates Planet bi-annual and monthly imagery URLs based on an API key. See https://assets.planet.com/docs/NICFI_UserGuidesFAQ.pdf Args: api_key (str, optional): The Planet API key. Defaults to None. token_name (str, optional): The environment variable name of the API key. Defaults to "PLANET_API_KEY". Returns: list: ...
12,357
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def planet_by_quarter( ...
Generates Planet quarterly imagery TileLayer based on an API key. To get a Planet API key, see https://developers.planet.com/quickstart/apis Args: year (int, optional): The year of Planet global mosaic, must be >=2016. Defaults to 2016. quarter (int, optional): The quarter of Planet global mosaic, must be 1-4. Defaults...
12,358
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def planet_by_month( ye...
Generates Planet monthly imagery TileLayer based on an API key. To get a Planet API key, see https://developers.planet.com/quickstart/apis Args: year (int, optional): The year of Planet global mosaic, must be >=2016. Defaults to 2016. month (int, optional): The month of Planet global mosaic, must be 1-12. Defaults to 1...
12,359
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Get the current latitude and longitude based on the user's location.
12,360
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Returns a dictionary of Census data. Args: reset (bool, optional): Reset the dictionary. Defaults to False. Returns: dict: A dictionary of Census data.
12,361
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Returns a list of WMS layers from a WMS service. Args: url (str): The URL of the WMS service. return_titles (bool, optional): If True, the titles of the layers will be returned. Defaults to False. Returns: list: A list of WMS layers.
12,362
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Reads a file from a URL. Args: url (str): The URL of the file. return_type (str, optional): The return type, can either be string or list. Defaults to "list". encoding (str, optional): The encoding of the file. Defaults to "utf-8". Raises: ValueError: The return type must be either list or string. Returns: str | list: ...
12,363
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Streamlit function to create a download button. Args: label (str): A short label explaining to the user what this button is for.. data (str | list): The contents of the file to be downloaded. See example below for caching techniques to avoid recomputing this data unnecessarily. file_name (str, optional): An optional st...
12,364
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Converts a GeoDataFame to GeoJSON. Args: gdf (GeoDataFrame): A GeoPandas GeoDataFrame. out_geojson (str, optional): File path to he output GeoJSON. Defaults to None. epsg (str, optional): An EPSG string, e.g., "4326". Defaults to None. Raises: TypeError: When the output file extension is incorrect. Exception: When the ...
12,365
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def mosaic(images, output, ...
Creates contours from an image. Code adapted from https://mygeoblog.com/2017/01/28/contour-lines-in-gee. Credits to MyGeoBlog. Args: image (ee.Image): An image to create contours. min_value (float): The minimum value of contours. max_value (float): The maximum value of contours. interval (float): The interval between c...
12,366
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple palettes = Box(_palette_di...
Get a list of palettable color palettes. Args: types (list, optional): A list of palettable types to return, e.g., types=['matplotlib', 'cartocolors']. Defaults to None. Returns: list: A list of palettable color palettes.
12,367
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Connects to a PostGIS database. Args: database (str): Name of the database host (str, optional): Hosting server for the database. Defaults to "localhost". user (str, optional): User name to access the database. Defaults to None. password (str, optional): Password to access the database. Defaults to None. port (int, opt...
12,368
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Reads data from a PostGIS database and returns a GeoDataFrame. Args: sql (str): SQL query to execute in selecting entries from database, or name of the table to read from the database. con (sqlalchemy.engine.Engine): Active connection to the database to query. geom_col (str, optional): Column name to convert to shapely...
12,369
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Create a GeoPandas GeoDataFrame from a csv or Pandas DataFrame containing x, y, z values. Args: data (str | pd.DataFrame): A csv or Pandas DataFrame containing x, y, z values. x (str, optional): The column name for the x values. Defaults to "longitude". y (str, optional): The column name for the y values. Defaults to "...
12,370
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Returns the centroids of an ee.FeatureCollection. Args: ee_object (ee.FeatureCollection): The ee.FeatureCollection to get the centroids of. Raises: TypeError: If the ee_object is not an ee.FeatureCollection. Returns: ee.FeatureCollection: The centroids of the ee_object.
12,371
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def cog_info(url, titiler_e...
Validate Cloud Optimized Geotiff. Args: source (str): A dataset path or URL. Will be opened in "r" mode. verbose (bool, optional): Whether to print the output of the validation. Defaults to False. Raises: ImportError: If the rio-cogeo package is not installed. FileNotFoundError: If the provided file could not be found....
12,372
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def gdf_to_df(gdf, drop_geo...
Join a table to an ee.FeatureCollection attribute table. Args: ee_object (ee.FeatureCollection): The ee.FeatureCollection to be joined by a table. data (str | pd.DataFraem | gpd.GeoDataFrame): The table to join to the ee.FeatureCollection. src_key (str): The key of ee.FeatureCollection attribute table to join. dst_key ...
12,373
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def gdf_bounds(gdf, return_...
Returns the centroid of a GeoDataFrame. Args: gdf (gpd.GeoDataFrame): A GeoDataFrame. return_geom (bool, optional): Whether to return the bounding box as a GeoDataFrame. Defaults to False. Returns: list | gpd.GeoDataFrame: A bounding box in the form of a list (lon, lat) or GeoDataFrame.
12,374
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Returns the geometry type of a GeoDataFrame. Args: gdf (gpd.GeoDataFrame): A GeoDataFrame. first_only (bool, optional): Whether to return the geometry type of the first feature in the GeoDataFrame. Defaults to True. Returns: str: The geometry type of the GeoDataFrame.
12,375
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Converts an image to a numpy array. Args: image (str): A dataset path, URL or rasterio.io.DatasetReader object. Raises: FileNotFoundError: If the provided file could not be found. Returns: np.array: A numpy array.
12,376
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_dir(dir_path, mak...
Converts a numpy array to a COG file. Args: np_array (np.array): A numpy array representing the image. out_cog (str): The output COG file path. bounds (tuple, optional): The bounds of the image in the format of (minx, miny, maxx, maxy). Defaults to None. profile (str | dict, optional): File path to an existing COG file...
12,377
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def in_colab_shell(): "...
View LiDAR data in 3D. Args: filename (str): The filepath to the LiDAR data. cmap (str, optional): The colormap to use. Defaults to "terrain". cmap currently does not work for the open3d backend. backend (str, optional): The plotting backend to use, can be pyvista, ipygany, panel, and open3d. Defaults to "pyvista". bac...
12,378
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_file_path(file_pa...
Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id Args: source (str | laspy.lasdatas.base.LasBase): The source data to be converted. destination (str, optional): The destination file path. Defaults to None. point...
12,379
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Downloads the entire folder from URL. Args: url (str, optional): URL of the Google Drive folder. Must be of the format 'https://drive.google.com/drive/folders/{url}'. Defaults to None. id (str, optional): Google Drive's folder ID. Defaults to None. output (str, optional): String containing the path of the output folder...
12,380
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def temp_file_path(extensio...
Clip an image by mask. Args: image (str): Path to the image file in GeoTIFF format. mask (str | list | dict): The mask used to extract the image. It can be a path to vector datasets (e.g., GeoJSON, Shapefile), a list of coordinates, or m.user_roi. output (str): Path to the output file. Raises: ImportError: If the fiona...
12,381
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_file_path(file_pa...
Convert a netcdf file to a GeoTIFF file. Args: filename (str): Path to the netcdf file. output (str, optional): Path to the output GeoTIFF file. Defaults to None. If None, the output file will be the same as the input file with the extension changed to .tif. variables (str | list, optional): Name of the variable or a l...
12,382
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def download_file( url=...
Read a netcdf file. Args: filename (str): File path or HTTP URL to the netcdf file. Raises: ImportError: If the xarray or rioxarray package is not installed. FileNotFoundError: If the netcdf file is not found. Returns: xarray.Dataset: The netcdf file as an xarray dataset.
12,383
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_package(name, URL...
Generate an ipyleaflet/folium TileLayer from a netCDF file. If you are using this function in JupyterHub on a remote server (e.g., Binder, Microsoft Planetary Computer), try adding to following two lines to the beginning of the notebook if the raster does not render properly. import os os.environ['LOCALTILESERVER_CLIEN...
12,384
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def check_color(in_color): ...
Classify a dataframe column using a variety of classification schemes. Args: data (str | pd.DataFrame | gpd.GeoDataFrame): The data to classify. It can be a filepath to a vector dataset, a pandas dataframe, or a geopandas geodataframe. column (str): The column to classify. cmap (str, optional): The name of a colormap r...
12,385
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create an image with the number of available images for a specific region. Args: collection (ee.ImageCollection): The collection to be queried. region (ee.Geometry | ee.FeatureCollection, optional): The region to be queried. start_date (str | ee.Date, optional): The start date of the query. band (str, optional): The ba...
12,386
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create 10-m land cover composite based on Dynamic World. The source code is adapted from the following tutorial by Spatial Thoughts: https://developers.google.com/earth-engine/tutorials/community/introduction-to-dynamic-world-pt-1 Args: region (ee.Geometry | ee.FeatureCollection): The region of interest. start_date (st...
12,387
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create Sentinel-2 composite for the Dynamic World Land Cover product. Args: region (ee.Geometry | ee.FeatureCollection): The region of interest. Default to None. start_date (str | ee.Date): The start date of the query. Default to "2020-01-01". end_date (str | ee.Date): The end date of the query. Default to "2021-01-01"...
12,388
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def download_ee_image( ...
Download an Earth Engine Image as small tiles based on ee.FeatureCollection. Images larger than the `Earth Engine size limit are split and downloaded as separate tiles, then re-assembled into a single GeoTIFF. See https://github.com/dugalh/geedim/blob/main/geedim/download.py#L574 Args: image (ee.Image): The image to be...
12,389
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def ee_initialize( toke...
Download an Earth Engine Image as small tiles based on ee.FeatureCollection. Images larger than the `Earth Engine size limit are split and downloaded as separate tiles, then re-assembled into a single GeoTIFF. See https://github.com/dugalh/geedim/blob/main/geedim/download.py#L574 Args: image (ee.Image): The image to be...
12,390
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def download_ee_image( ...
Download an Earth Engine ImageCollection as GeoTIFFs. Images larger than the `Earth Engine size limit are split and downloaded as separate tiles, then re-assembled into a single GeoTIFF. See https://github.com/dugalh/geedim/blob/main/geedim/download.py#L574 Args: collection (ee.ImageCollection): The image collection to...
12,391
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Get a palette from a matplotlib colormap. See the list of colormaps at https://matplotlib.org/stable/tutorials/colors/colormaps.html. Args: cmap_name (str, optional): The name of the matplotlib colormap. Defaults to None. n_class (int, optional): The number of colors. Defaults to None. hashtag (bool, optional): Whether...
12,392
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def in_colab_shell(): "...
Plot a raster image. Args: image (str | xarray.DataArray ): The input raster image, can be a file path, HTTP URL, or xarray.DataArray. band (int, optional): The band index, starting from zero. Defaults to None. cmap (str, optional): The matplotlib colormap to use. Defaults to "terrain". proj (str, optional): The EPSG p...
12,393
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def in_colab_shell(): "...
Plot a raster image in 3D. Args: image (str | xarray.DataArray): The input raster image, can be a file path, HTTP URL, or xarray.DataArray. band (int, optional): The band index, starting from zero. Defaults to None. cmap (str, optional): The matplotlib colormap to use. Defaults to "terrain". factor (float, optional): T...
12,394
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Display an HTML file in a Jupyter Notebook. Args src (str): File path to HTML file. width (int, optional): Width of the map. Defaults to 950. height (int, optional): Height of the map. Defaults to 600.
12,395
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Get the bounding box coordinates of a geometry. Args: geometry (ee.Geometry | ee.FeatureCollection): The input geometry. decimals (int, optional): The number of decimals to round to. Defaults to 4. Returns: list: The bounding box coordinates in the form [west, south, east, north].
12,396
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def ee_initialize( toke...
Import Earth Engine JavaScript libraries. Based on the Open Earth Engine Library (OEEL). For more info, visit https://www.open-geocomputing.org/OpenEarthEngineLibrary. Args: lib_path (str, optional): A local file path or HTTP URL to a JavaScript library. It can also be in a format like 'users/gena/packages:grid'. Defau...
12,397
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Install npm packages for Earth Engine JavaScript libraries. Based on the Open Earth Engine Library (OEEL).
12,398
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create a vector style for a feature collection. Args: collection (ee.FeatureCollection): The input feature collection. column (str): The name of the column to use for styling. labels (list, optional): A list of labels to use for styling. Defaults to None. color (str | list, optional): A default color (CSS 3.0 color val...
12,399
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Add a CRS to a raster dataset. Args: filename (str): The filename of the raster dataset. epsg (int | str): The EPSG code of the CRS.
12,400
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create a JRC monthly history plot. Args: collection (ee.ImageCollection, optional): The image collection of JRC surface water monthly history. Default to ee.ImageCollection('JRC/GSW1_4/MonthlyHistory') region (ee.Geometry | ee.FeatureCollection, optional): The region to plot. Default to None. start_date (str, optional)...
12,401
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Renders an HTML file as a Streamlit component. Args: filename (str): The filename of the HTML file. width (int, optional): Width of the map. Defaults to None. height (int, optional): Height of the map. Defaults to 600. scrolling (bool, optional): Whether to allow the map to scroll. Defaults to False. replace_dict (dict...
12,402
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def mosaic(images, output, ...
Performs a convolution on an image. Args: image (ee.Image | ee.ImageCollection): The image to convolve. kernel (ee.Kernel, optional): The kernel to convolve with. Defaults to None, a 7x7 gaussian kernel. resample (str, optional): The resample method to use. It can be either 'bilinear' or 'bicubic'". Defaults to None, w...
12,403
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def download_file( url=...
Download the US National Elevation Datasets (NED) for a region. Args: region (str | list): A filepath to a vector dataset or a list of bounds in the form of [minx, miny, maxx, maxy]. out_dir (str, optional): The directory to download the files to. Defaults to None, which uses the current working directory. return_url (...
12,404
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Print out the information for an Earth Engine object using a tree structure. The source code was adapted from https://github.com/google/earthengine-jupyter. Credits to Tyler Erickson. Args: ee_object (object): The Earth Engine object. layer_name (str, optional): The name of the layer. Defaults to "". opened (bool, opti...
12,405
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def download_ee_image( ...
null
12,406
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Test if the current notebook is running in mkdocs. Returns: bool: True if the notebook is running in mkdocs.
12,407
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def rgb_to_hex(rgb=(255, 25...
Create a legend in HTML format. Reference: https://bit.ly/3oV6vnH Args: title (str, optional): Title of the legend. Defaults to 'Legend'. Defaults to "Legend". colors (list, optional): A list of legend colors. Defaults to None. labels (list, optional): A list of legend labels. Defaults to None. legend_dict (dict, optio...
12,408
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def is_arcpy(): """Chec...
Add a layer to the active map in ArcGIS Pro. Args: url (str): The URL of the tile layer to add. name (str, optional): The name of the layer. Defaults to None. shown (bool, optional): Whether the layer is shown. Defaults to True. opacity (float, optional): The opacity of the layer. Defaults to 1.0.
12,409
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def is_arcpy(): """Chec...
Zoom to an extent in ArcGIS Pro. Args: xmin (float): The minimum x value of the extent. ymin (float): The minimum y value of the extent. xmax (float): The maximum x value of the extent. ymax (float): The maximum y value of the extent.
12,410
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Converts the map to an HTML string that can be used in Gradio. Removes unsupported elements, such as attribution and any code blocks containing functions. See https://github.com/gradio-app/gradio/issues/3190 Args: width (str, optional): The width of the map. Defaults to '100%'. height (str, optional): The height of the...
12,411
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get a LocalTileserver TileClient from an image. Args: image (str): The input image filepath or URL. Returns: TileClient: A LocalTileserver TileClient.
12,412
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the center of an image. Args: image (str): The input image filepath or URL. Returns: tuple: A tuple of (latitude, longitude).
12,413
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the bounds of an image. Args: image (str): The input image filepath or URL. Returns: list: A list of bounds in the form of [(south, west), (north, east)].
12,414
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the metadata of an image. Args: image (str): The input image filepath or URL. Returns: dict: A dictionary of image metadata.
12,415
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the number of bands in an image. Args: image (str): The input image filepath or URL. Returns: int: The number of bands in the image.
12,416
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the size (width, height) of an image. Args: image (str): The input image filepath or URL. Returns: tuple: A tuple of (width, height).
12,417
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the projection of an image. Args: image (str): The input image filepath or URL. Returns: str: The projection of the image.
12,418
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Define the CRS of an image. Args: image (str): The input image filepath epsg (int): The EPSG code of the CRS to set.
12,419
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the geotransform of an image. Args: image (str): The input image filepath or URL. Returns: list: A list of geotransform values.
12,420
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def get_local_tile_layer( ...
Get the resolution of an image. Args: image (str): The input image filepath or URL. Returns: float: The resolution of the image.
12,421
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Find files in a directory. Args: input_dir (str): The input directory. ext (str, optional): The file extension to match. Defaults to None. fullpath (bool, optional): Whether to return the full path. Defaults to True. recursive (bool, optional): Whether to search recursively. Defaults to True. Returns: list: A list of m...
12,422
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Returns the approximate pixel scale based on zoom level and latutude. See https://blogs.bing.com/maps/2006/02/25/map-control-zoom-levels-gt-resolution Args: zoom (int): The zoom level. latitude (float, optional): The latitude. Defaults to 0. Returns: float: Map resolution in meters.
12,423
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
coordinate conversion between web mercator to lat/lon in decimal degrees Args: x (float): The x coordinate. y (float): The y coordinate. Returns: tuple: A tuple of (longitude, latitude) in decimal degrees.
12,424
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def lnglat_to_meters(longit...
Convert bounds to x and y range to be used as input to bokeh map. Args: bounds (list): A list of bounds in the form [(south, west), (north, east)] or [xmin, ymin, xmax, ymax]. Returns: tuple: A tuple of (x_range, y_range).
12,425
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def lnglat_to_meters(longit...
Convert center and zoom to x and y range to be used as input to bokeh map. Args: center (tuple): A tuple of (latitude, longitude). zoom (int): The zoom level. Returns: tuple: A tuple of (x_range, y_range).
12,426
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def lnglat_to_meters(longit...
Returns the coordinates ('x' or 'y') of edges of a Polygon exterior. :param: (GeoPandas Series) row : The row of each of the GeoPandas DataFrame. :param: (str) geom : The column name. :param: (str) coord_type : Whether it's 'x' or 'y' coordinate. :param: (str) shape_type
12,427
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Apply scaling factors to a Landsat image. See an example at https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC09_C02_T1_L2 Args: image (ee.Image): The input Landsat image. thermal_bands (bool, optional): Whether to apply scaling to thermal bands. Defaults to True. apply_fmask (bool, optional): Wheth...
12,428
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Converts a GeoTIFF to JPEG2000. Args: filename (str): The path to the GeoTIFF file. output (str): The path to the output JPEG2000 file. creationOptions (list): A list of creation options for the JPEG2000 file. See https://gdal.org/drivers/raster/jp2openjpeg.html. For example, to specify the compression ratio, use ``["Q...
12,429
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def ee_to_bbox(ee_object): ...
Downloads an Earth Engine object as GeoTIFF. Args: ee_object (ee.Image | ee.FeatureCollection): The Earth Engine object to download. output (str): The output path for the GeoTIFF. bbox (str, optional): The bounding box in the format [xmin, ymin, xmax, ymax]. Defaults to None, which is the bounding box of the Earth Engi...
12,430
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Create a grid covering an Earth Engine object. Args: ee_object (ee.Image | ee.Geometry | ee.FeatureCollection): The Earth Engine object. scale (float): The grid cell size. proj (str, optional): The projection. Defaults to None. Returns: ee.FeatureCollection: The grid as a feature collection.
12,431
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Check Google basemaps Args: basemap (str): The basemap name. Returns: str: The basemap name.
12,432
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Get Earth Engine token. Returns: dict: The Earth Engine token.
12,433
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def random_string(string_le...
Create a widget template. Args: widget (ipywidgets.Widget, optional): The widget to be displayed. Defaults to None. opened (bool, optional): Whether to open the toolbar. Defaults to True. show_close_button (bool, optional): Whether to show the close button. Defaults to True. widget_icon (str, optional): The icon name f...
12,434
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple The provided code snippet ...
Converts a GeoTIFF file to a JPEG/PNG image. Args: image (str): The path to the input GeoTIFF file. output (str): The path to save the output JPEG/PNG file. Returns: None
12,435
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def install_package(package...
Convert xarray Dataset to georeferenced images. Args: xds (xr.Dataset): The xarray Dataset to convert to images. filenames (Union[str, List[str]], optional): Output filenames for the images. If a single string is provided, it will be used as the filename for all images. If a list of strings is provided, the filenames w...
12,436
import csv import datetime import io import json import math import os import requests import shutil import tarfile import urllib.request import warnings import zipfile import ee import ipywidgets as widgets from ipytree import Node, Tree from typing import Union, List, Dict, Optional, Tuple def array_to_memory_file( ...
Save a NumPy array as a GeoTIFF using the projection information from an existing GeoTIFF file. Args: array (np.ndarray): The NumPy array to be saved as a GeoTIFF. output (str): The path to the output image. If None, a temporary file will be created. Defaults to None. source (str, optional): The path to an existing Geo...
12,437
import os import warnings from typing import Optional, Any, Dict import ee import ipyleaflet import ipywidgets as widgets from box import Box from bqplot import pyplot as plt from IPython.display import display from .basemaps import get_xyz_dict, xyz_to_leaflet from .common import * from .conversion import * from .ee_t...
Converts and Earth Engine layer to ipyleaflet TileLayer. Args: ee_object (Collection|Feature|Image|MapId): The object to add to the map. vis_params (dict, optional): The visualization parameters. Defaults to {}. name (str, optional): The name of the layer. Defaults to 'Layer untitled'. shown (bool, optional): A flag in...