Git Product home page Git Product logo

Comments (5)

scheip avatar scheip commented on July 28, 2024

I can confirm I do not see this behavior with another EE dataset. For example, the only change in the below is switching over to an ERA5 dataset:

# specify study area
ur = [35.89, -81.87] # y, x
ll = [35.83, -81.945] # y, x   # full region
coords = [ll[1], ll[0], ll[1], ur[0], ur[1], ur[0], ur[1], ll[0]]
geom = ee.Geometry.Polygon(coords)

# Specify image collections
ic = ee.ImageCollection("ECMWF/ERA5_LAND/MONTHLY_AGGR").filterDate('2016-06-01', '2024-01-01').filterBounds(geom).select('temperature_2m')

ds = xr.open_dataset(
    ic,
    engine='ee',
    crs='EPSG:32617', # utm zone 17n
    scale=500,
    geometry=geom
)

# plot lai, average across x and y
ds['temperature_2m'].mean(dim=['X', 'Y']).plot()

And this yields the same result every time, as expected.

from xee.

noahgolmant avatar noahgolmant commented on July 28, 2024

Is there a mismatch between the bounds CRS and the requested CRS of the dataset? I am not exactly sure why the issue is non-deterministic as a result. I ran this on my own test area, ParΓ‘, Brazil, and observed similar zero values until I adjusted this. When I assume EPSG:4326 for your bounds, I think the boundary is in Antarctica, so the LAI is 0 as expected.

With the original code:

import ee
import geopandas as gpd
from shapely.geometry import mapping
import xarray as xr
import xee
from ingest.consts import SERVICE_PATH, EMAIL

credentials = ee.ServiceAccountCredentials(EMAIL, SERVICE_PATH)
ee.Initialize(credentials)

bounds = gpd.read_file("/home/noah/ingest/configs/data/acre_tiny_test_site.geojson").iloc[0].geometry
geom = ee.Geometry(mapping(bounds))

# Specify image collections
ic = ee.ImageCollection("MODIS/061/MCD15A3H").filterDate('2016-06-01', '2024-01-01').filterBounds(geom).select('Lai')

ds = xr.open_dataset(
    ic,
    engine='ee',
    crs='EPSG:32617',
    scale=500,
    geometry=geom
)

# plot lai, average across x and y
ds['Lai'].mean(dim=['X', 'Y']).plot()
image

With the following variant, setting CRS to 4326, we see no zeros and expected seasonal variation:

# Specify image collections
ic = ee.ImageCollection("MODIS/061/MCD15A3H").filterDate('2016-06-01', '2024-01-01').filterBounds(geom).select('Lai')

ds = xr.open_dataset(
    ic,
    engine='ee',
    crs='EPSG:4326',
    geometry=geom
)

# plot lai, average across x and y
ds['Lai'].mean(dim=['lon', 'lat']).plot()
image

from xee.

scheip avatar scheip commented on July 28, 2024

Thank you @noahgolmant for trying this out! I don't know what happened, perhaps an update on GEE's side, but the code I listed in my first message now produces expected results, with no zeros and no code changes. Very strange!

I'd be curious if you re-ran your first code block if you also now get expected results?

from xee.

scheip avatar scheip commented on July 28, 2024

Strange - running the same troubleshooting code pasted above again is resulting in spurious/missing values. Any further thoughts on this?

Copying the troubleshooting code here:

# specify study area
ur = [35.89, -81.87] # y, x
ll = [35.83, -81.945] # y, x   # full region
coords = [ll[1], ll[0], ll[1], ur[0], ur[1], ur[0], ur[1], ll[0]]
geom = ee.Geometry.Polygon(coords)

# Specify image collections
ic = ee.ImageCollection("MODIS/061/MCD15A3H").filterDate('2016-06-01', '2024-01-01').filterBounds(geom).select('Lai')

ds = xr.open_dataset(
    ic,
    engine='ee',
    crs='EPSG:32617',
    scale=500,
    geometry=geom
)

# plot lai, average across x and y
ds['Lai'].mean(dim=['X', 'Y']).plot()

from xee.

naschmitz avatar naschmitz commented on July 28, 2024

Sounds like this is related to #119. We're looking into it.

from xee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.