# Import modules
import ee
from datetime import datetime, timezone
from pprint import pprint3 Value at a point
gee, single value, point
Perhaps, one of the simplest and most basic operations in Google Earth Engine is to retrieve information for a single point. Typical examples include elevation, mean annual temperature, and soil properties. In other words, this type of operation is mostly intended for retrieving information that does not change with time.
# Authenticate
ee.Authenticate()
# Initialize the library.
ee.Initialize()While we need to run ee.Initialize() every time we start a notebook or restart the Python kernel, we only need to authenticate once, so a handy tip is to mute the ee.Authenticate() line with a # once you are done. Note that after several hours or days of inactivity you will need to authenticate again.
Example 1: Elevation
In the following example we will retrieve the elevation for a specific point on Earth.
Product: USGS/SRTMGL1_003
# Define geographic coordinates
lat = 39.186512 # This is y
lon = -96.576844 # This is x
# Convert coordinates into a Point geometry following the x,y notation
point = ee.Geometry.Point([lon, lat])
# Explore point geometry
point.getInfo(){'type': 'Point', 'coordinates': [-96.576844, 39.186512]}
In this tutorial we will use the .getInfo() method to print the underlying data and metadata of multiple objects, so that you can see the output and become more familiar with GEE data structures and the geoJSON format. This information is also valuable for debugging code errors. However, you don’t typically want to clutter your notebooks with these long outputs, so we will skip some of these steps in future tutorials.
# Load digital elevation model (DEM) from Shuttle Radar Topography Mission (SRTM)
dem = ee.Image('USGS/SRTMGL1_003')# Obtain some information about the DEM layer (output is long!)
pprint(dem.getInfo()){'bands': [{'crs': 'EPSG:4326',
'crs_transform': [0.0002777777777777778,
0,
-180.0001388888889,
0,
-0.0002777777777777778,
60.00013888888889],
'data_type': {'max': 32767,
'min': -32768,
'precision': 'int',
'type': 'PixelType'},
'dimensions': [1296001, 417601],
'id': 'elevation'}],
'id': 'USGS/SRTMGL1_003',
'properties': {'date_range': [950227200000, 951177600000],
'description': '<p>The Shuttle Radar Topography Mission (SRTM, '
'see <a '
'href="https://onlinelibrary.wiley.com/doi/10.1029/2005RG000183/full">Farr\n'
'et al. 2007</a>)\n'
'digital elevation data is an international '
'research effort that\n'
'obtained digital elevation models on a '
'near-global scale. This\n'
'SRTM V3 product (SRTM Plus) is provided by '
'NASA JPL\n'
'at a resolution of 1 arc-second (approximately '
'30m).</p><p>This dataset has undergone a '
'void-filling process using open-source data\n'
'(ASTER GDEM2, GMTED2010, and NED), as opposed '
'to other versions that\n'
'contain voids or have been void-filled with '
'commercial sources.\n'
'For more information on the different versions '
'see the\n'
'<a '
'href="https://lpdaac.usgs.gov/documents/13/SRTM_Quick_Guide.pdf">SRTM '
'Quick '
'Guide</a>.</p><p>Documentation:</p><ul><li><p><a '
'href="https://lpdaac.usgs.gov/documents/179/SRTM_User_Guide_V3.pdf">User's '
'Guide</a></p></li><li><p><a '
'href="https://lpdaac.usgs.gov/documents/13/SRTM_Quick_Guide.pdf">General '
'Documentation</a></p></li><li><p><a '
'href="https://doi.org/10.1029/2005RG000183">Algorithm '
'Theoretical Basis Document '
'(ATBD)</a></p></li></ul><p><b>Provider: <a '
'href="https://cmr.earthdata.nasa.gov/search/concepts/C1000000240-LPDAAC_ECS.html">NASA '
'/ USGS / '
'JPL-Caltech</a></b><br><p><b>Bands</b><table '
'class="eecat"><tr><th scope="col">Name</th><th '
'scope="col">Description</th></tr><tr><td>elevation</td><td><p>Elevation</p></td></tr></table><p><b>Terms '
'of Use</b><br><p>Unless otherwise noted, '
'images and video on JPL public\n'
'web sites (public sites ending with a '
'jpl.nasa.gov address) may\n'
'be used for any purpose without prior '
'permission. For more information\n'
'and exceptions visit the <a '
'href="https://www.jpl.nasa.gov/imagepolicy/">JPL '
'Image Use Policy site</a>.</p><p><b>Suggested '
'citation(s)</b><ul><li><p>Farr, T.G., Rosen, '
'P.A., Caro, E., Crippen, R., Duren, R., '
'Hensley,\n'
'S., Kobrick, M., Paller, M., Rodriguez, E., '
'Roth, L., Seal, D.,\n'
'Shaffer, S., Shimada, J., Umland, J., Werner, '
'M., Oskin, M., Burbank,\n'
'D., and Alsdorf, D.E., 2007, The shuttle radar '
'topography mission:\n'
'Reviews of Geophysics, v. 45, no. 2, RG2004, '
'at\n'
'<a '
'href="https://doi.org/10.1029/2005RG000183">https://doi.org/10.1029/2005RG000183</a>.</p></li></ul><style>\n'
' table.eecat {\n'
' border: 1px solid black;\n'
' border-collapse: collapse;\n'
' font-size: 13px;\n'
' }\n'
' table.eecat td, tr, th {\n'
' text-align: left; vertical-align: top;\n'
' border: 1px solid gray; padding: 3px;\n'
' }\n'
' td.nobreak { white-space: nowrap; }\n'
'</style>',
'keywords': ['dem',
'elevation',
'geophysical',
'nasa',
'srtm',
'topography',
'usgs'],
'period': 0,
'product_tags': ['srtm',
'elevation',
'topography',
'dem',
'geophysical'],
'provider': 'NASA / USGS / JPL-Caltech',
'provider_url': 'https://cmr.earthdata.nasa.gov/search/concepts/C1000000240-LPDAAC_ECS.html',
'sample': 'https://mw1.google.com/ges/dd/images/SRTM90_V4_sample.png',
'source_tags': ['nasa', 'usgs'],
'system:asset_size': 132792638252,
'system:visualization_0_bands': 'elevation',
'system:visualization_0_gamma': '1.6',
'system:visualization_0_max': '6000.0',
'system:visualization_0_min': '0.0',
'system:visualization_0_name': 'Elevation',
'tags': ['dem',
'elevation',
'geophysical',
'nasa',
'srtm',
'topography',
'usgs'],
'thumb': 'https://mw1.google.com/ges/dd/images/SRTM90_V4_thumb.png',
'title': 'NASA SRTM Digital Elevation 30m',
'type_name': 'Image',
'visualization_0_bands': 'elevation',
'visualization_0_gamma': '1.6',
'visualization_0_max': '6000.0',
'visualization_0_min': '0.0',
'visualization_0_name': 'Elevation'},
'type': 'Image',
'version': 1641990767055141}
# Retrieve the elevation value: This step will get us close to the answer, but we are not there yet
pprint(dem.sample(point, 1).getInfo()){'columns': {'elevation': 'Short'},
'features': [{'geometry': None,
'id': '0',
'properties': {'elevation': 317},
'type': 'Feature'}],
'properties': {'band_order': ['elevation']},
'type': 'FeatureCollection'}
# Retrieve the elevation value: This step will get us even closer to the answer, but we are not there yet
dem.sample(point, 1).first().getInfo(){'type': 'Feature',
'geometry': None,
'id': '0',
'properties': {'elevation': 317}}
# Retrieve the elevation value: This step will get us the correct value
elev = dem.sample(point, 1).first().getNumber('elevation').getInfo()
print(f'Elevation: {elev} m')Elevation: 317 m
Example 2: Weather variables
Obtain the long-term mean annual air temperature and precipitation for a specific location
Product: For more information about bands and units visit: WorldClim BIO
# Define geographic coordinates
lat = 39.186512 # This is y
lon = -96.576844 # This is x
# Convert coordinates into a Point geometry following the x,y notation
point = ee.Geometry.Point(lon, lat)# Load WorldClim BIO dataset
dataset = ee.Image('WORLDCLIM/V1/BIO')# Remove the comment to access metadata of the product (output is long!)
# dataset.getInfo()# Get long-term mean annual air temperature
T_mean = dataset.select('bio01').sample(point,1).first().getNumber('bio01').multiply(0.1).getInfo()
print(f'Mean annual air temperature: {round(T_mean,1)} Celsius')Mean annual air temperature: 12.2 Celsius
# Get long-term annual precipitation
P_annual = dataset.select('bio12').sample(point,1).first().get('bio12').getInfo()
print(f'Mean annual precipitation: {round(P_annual,1)} mm')Mean annual precipitation: 857 mm
Example 3: Reference ET
In this example we will retrieve daily values of reference evapotranspiration for a point.
Product: For more information visit the description in Google Earth Engine of GRIDMET
# Define point
point = ee.Geometry.Point([-96.576844, 39.186512])# Obtain GRIDMET dataset for a specific period. End date is excluded from the call
start_date = ee.Date('2022-07-01')
end_date = ee.Date('2022-07-02')
dataset = ee.ImageCollection('IDAHO_EPSCOR/GRIDMET').filterDate(start_date, end_date)# Remove the comment to see information about the image collection (output is long!)
# pprint(dataset.getInfo())# Use the get method to retrieve a specific property
dataset.get('description').getInfo()'<p>The Gridded Surface Meteorological dataset provides\nhigh spatial resolution (~4-km) daily surface fields of temperature,\nprecipitation, winds, humidity and radiation across the contiguous\nUnited States from 1979. The dataset blends the high resolution\nspatial data from PRISM with the high temporal resolution data\nfrom the National Land Data Assimilation System (NLDAS) to produce\nspatially and temporally continuous fields that lend themselves\nto additional land surface modeling.</p><p>This dataset contains provisional products that are replaced with\nupdated versions when the complete source data become available.\nProducts can be distinguished by the value of the 'status' property.\nAt first, assets are ingested with status='early'. After several\ndays, they are replaced by assets with status='provisional'.\nAfter about 2 months, they are replaced by the final assets with\nstatus='permanent'.</p><p><b>Provider: <a href="http://www.climatologylab.org/gridmet.html">University of California Merced</a></b><br><p><b>Resolution</b><br>4638.3 meters\n</p><p><b>Cadence</b><br>\n 1 day\n</p><p><b>Bands</b><table class="eecat"><tr><th scope="col">Name</th><th scope="col">Description</th></tr><tr><td>pr</td><td><p>Precipitation amount</p></td></tr><tr><td>rmax</td><td><p>Maximum relative humidity</p></td></tr><tr><td>rmin</td><td><p>Minimum relative humidity</p></td></tr><tr><td>sph</td><td><p>Specific humididy</p></td></tr><tr><td>srad</td><td><p>Surface downward shortwave radiation</p></td></tr><tr><td>th</td><td><p>Wind direction</p></td></tr><tr><td>tmmn</td><td><p>Minimum temperature</p></td></tr><tr><td>tmmx</td><td><p>Maximum temperature</p></td></tr><tr><td>vs</td><td><p>Wind velocity at 10m</p></td></tr><tr><td>erc</td><td><p>Energy release component</p></td></tr><tr><td>eto</td><td><p>Daily reference evapotranspiration</p></td></tr><tr><td>bi</td><td><p>Burning index</p></td></tr><tr><td>fm100</td><td><p>100-hour dead fuel moisture</p></td></tr><tr><td>fm1000</td><td><p>1000-hour dead fuel moisture</p></td></tr><tr><td>etr</td><td><p>Daily reference evapotranspiration</p></td></tr><tr><td>vpd</td><td><p>Mean vapor pressure deficit</p></td></tr></table><p><b>Image Properties</b><table class="eecat"><tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Description</th></tr><tr><td>status</td><td>STRING</td><td><p>'early', 'provisional', or 'permanent'</p></td></tr></table><p><b>Terms of Use</b><br><p>This work (METDATA, by John Abatzoglou) is in the public\ndomain and is free of known copyright restrictions. Users should\nproperly cite the source used in the creation of any reports and\npublications resulting from the use of this dataset and note the\ndate when the data was acquired.</p><p><b>Suggested citation(s)</b><ul><li><p>Abatzoglou J. T., Development of gridded surface meteorological\ndata for ecological applications and modelling, International Journal\nof Climatology. (2012) <a href="https://doi.org/10.1002/joc.3413">doi:10.1002/joc.3413</a></p></li></ul><style>\n table.eecat {\n border: 1px solid black;\n border-collapse: collapse;\n font-size: 13px;\n }\n table.eecat td, tr, th {\n text-align: left; vertical-align: top;\n border: 1px solid gray; padding: 3px;\n }\n td.nobreak { white-space: nowrap; }\n</style>'
# Information about first image within the collection (output is long!)
dataset.first().getInfo(){'type': 'Image',
'bands': [{'id': 'pr',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'rmax',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'rmin',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'sph',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'srad',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'th',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'tmmn',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'tmmx',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'vs',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'erc',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'eto',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'bi',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'fm100',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'fm1000',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'etr',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]},
{'id': 'vpd',
'data_type': {'type': 'PixelType', 'precision': 'float'},
'dimensions': [1386, 585],
'crs': 'GEOGCS["unknown", \n DATUM["unknown", \n SPHEROID["Spheroid", 6378137.0, 298.257223563]], \n PRIMEM["Greenwich", 0.0], \n UNIT["degree", 0.017453292519943295], \n AXIS["Longitude", EAST], \n AXIS["Latitude", NORTH]]',
'crs_transform': [0.041666666666666664,
0,
-124.78749996666667,
0,
-0.041666666666666664,
49.42083333333334]}],
'version': 1727559396388962,
'id': 'IDAHO_EPSCOR/GRIDMET/20220701',
'properties': {'system:time_start': 1656655200000,
'system:footprint': {'type': 'LinearRing',
'coordinates': [[-106.74062492669543, 49.46257585069892],
[-113.9593748919571, 49.46257584884527],
[-124.85170940475892, 49.4620585601637],
[-124.83354858089547, 25.003807946517743],
[-120.27578118613717, 24.963260528555146],
[-113.05703125852676, 24.963260546620877],
[-107.6429687455267, 24.99592649355212],
[-103.13124999231805, 24.982315818325798],
[-97.71718742828612, 24.982315807206604],
[-93.2054687043565, 24.995926577622235],
[-87.79140622110124, 24.963260551222906],
[-81.47499994941238, 24.98231586351413],
[-76.06093750618331, 24.982315827166854],
[-70.64687499780167, 24.982315812070983],
[-66.99145134929572, 25.003807969975153],
[-66.97329042095092, 49.4620585688528],
[-79.67031245159846, 49.46257587132357],
[-88.69374997570004, 49.46257588868212],
[-99.52187494924127, 49.462575897954686],
[-106.74062492669543, 49.46257585069892]]},
'system:time_end': 1656741600000,
'system:asset_size': 11134492,
'status': 'permanent',
'system:index': '20220701'}}
# Information about feature collection
dataset.first().sample(point,1).getInfo() # Sample at 1 meter resolution{'type': 'FeatureCollection',
'columns': {'bi': 'Float',
'erc': 'Float',
'eto': 'Float',
'etr': 'Float',
'fm100': 'Float',
'fm1000': 'Float',
'pr': 'Float',
'rmax': 'Float',
'rmin': 'Float',
'sph': 'Float',
'srad': 'Float',
'th': 'Float',
'tmmn': 'Float',
'tmmx': 'Float',
'vpd': 'Float',
'vs': 'Float'},
'properties': {'band_order': ['pr',
'rmax',
'rmin',
'sph',
'srad',
'th',
'tmmn',
'tmmx',
'vs',
'erc',
'eto',
'bi',
'fm100',
'fm1000',
'etr',
'vpd']},
'features': [{'type': 'Feature',
'geometry': None,
'id': '0',
'properties': {'bi': 0,
'erc': 20,
'eto': 4.400000095367432,
'etr': 5.099999904632568,
'fm100': 15.199999809265137,
'fm1000': 18,
'pr': 43,
'rmax': 92.5,
'rmin': 62.599998474121094,
'sph': 0.014340000227093697,
'srad': 249.39999389648438,
'th': 114,
'tmmn': 293.3999938964844,
'tmmx': 299.5,
'vpd': 0.6399999856948853,
'vs': 2.799999952316284}}]}
# Information about feature
eto = dataset.first().sample(point,1).first().getNumber('eto').getInfo()
print(f'The grass reference ET is {eto} mm')The grass reference ET is 4.400000095367432 mm
Alternative solution: Access the image directly rather than the collection.
ee.Image('IDAHO_EPSCOR/GRIDMET/20220701').sample(point,1).first().getNumber('eto').getInfo()Get dataset timestamps
# Obtain the START time of the dataset to check that it matches our request.
# Response is in milliseconds since 1-Jan-1970
dataset.select('eto').first().getNumber('system:time_start').getInfo()1656655200000
# Obtain the END time of the dataset to check that it matches our request.
# Response is in milliseconds since 1-Jan-1970
dataset.select('eto').first().getNumber('system:time_end').getInfo()1656741600000
# Find the datetime of the serial date numbers
# Input in "fromtimestamp()" has to be in seconds, so we divide by 1000
# GEE timestamps are in UTC, so we also specify the time zone
print('Start time:', datetime.fromtimestamp(1656655200000/1000, tz=timezone.utc).strftime('%Y-%m-%d %H:%M:%S.%f'))
print('End time:', datetime.fromtimestamp(1656741600000/1000, tz=timezone.utc).strftime('%Y-%m-%d %H:%M:%S.%f'))Start time: 2022-07-01 06:00:00.000000
End time: 2022-07-02 06:00:00.000000
Example 4: Retrieve soil properties for a given location
Product: SoilGrids
Source: https://samapriya.github.io/awesome-gee-community-datasets/projects/isric/
# Load the SoilGrids dataset from GEE
soil_grids = ee.Image("projects/soilgrids-isric/sand_mean")# Define a point geometry
lat = 37.839154
lon = -99.101594
point = ee.Geometry.Point(lon,lat)
# SoilGrids reports sand content in g/kg, so we multiply by 0.1 to obtain percent
sand = soil_grids.sample(point,250).first().getNumber('sand_0-5cm_mean').multiply(0.1).getInfo()print(f'The percentage of sand at ({lat},{lon}) is: {round(sand)} %')The percentage of sand at (37.839154,-99.101594) is: 53 %