Skip to content

Commit 51d77b2

Browse files
committed
chore: update docs
1 parent 85cee6b commit 51d77b2

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

docs/faq.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ To align with CF conventions (`[time, y, x]`) and reduce the need for transposes
2929
Your AOI may fall outside the dataset extent or the CRS mismatch caused an unexpected reprojection. Try matching source grid first to confirm availability.
3030

3131
## Do I need shapely geometries?
32-
Helpers accept shapely for convenience, as it makes reprojection and area reasoning simpler client-side. However, `fit_geometry` also accepts an Earth Engine geometry (e.g. `ee.Geometry`) directly and converts it for you via `shapely.geometry.shape(ee_geom.getInfo())`. That said, if you do need a shapely geometry elsewhere, you may want to handle this conversion explicitly.
32+
`fit_geometry` accepts **shapely geometries** or **ee.Geometry** only. Shapely is convenient for client-side reprojection and area reasoning. If you have an `ee.Geometry`, it is auto-converted for you via `shapely.geometry.shape(ee_geom.getInfo())`.
33+
34+
If you have an `ee.Feature` or other `ee.ComputedObject`, call `.geometry()` first:
35+
```python
36+
# Correct
37+
fit_geometry(geometry=ee_feature.geometry(), ...)
38+
39+
# Incorrect
40+
fit_geometry(geometry=ee_feature, ...)
41+
```
3342

3443
## `ds.to_netcdf()` fails with `ValueError: could not safely cast array from int64 to int32`
3544
Xee time coordinates are stored as `int64` (nanoseconds since epoch). The `scipy` netCDF writer only supports netCDF3, which is limited to `int32`, so the write fails when `scipy` is the only available backend.

docs/guide.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ds = xr.open_dataset('ee://ECMWF/ERA5_LAND/MONTHLY_AGGR', engine='ee', **grid_pa
5959

6060
## Using an Earth Engine Geometry as the AOI
6161

62-
`fit_geometry` accepts an `ee.Geometry` directly. It is auto-converted to shapely via `shapely.geometry.shape(geometry.getInfo())`, so you can stay in an Earth Engine-native workflow without converting by hand.
62+
`fit_geometry` accepts `ee.Geometry` directly and auto-converts it to shapely via `shapely.geometry.shape(geometry.getInfo())`.
6363

6464
```python
6565
import ee
@@ -76,7 +76,22 @@ grid_params = helpers.fit_geometry(
7676
ds = xr.open_dataset('ee://ECMWF/ERA5_LAND/MONTHLY_AGGR', engine='ee', **grid_params)
7777
```
7878

79-
If you prefer to convert explicitly or need the shapely geometry elsewhere, the equivalent end-to-end conversion is as follows:
79+
**Important:** If you have an `ee.Feature` or other `ee.ComputedObject`, extract the geometry first:
80+
81+
```python
82+
aoi_feature = ee.Feature(...)
83+
# Correct - Extracting the geometry
84+
grid_params = helpers.fit_geometry(
85+
geometry=aoi_feature.geometry(),
86+
grid_crs='EPSG:4326',
87+
grid_shape=(256, 256),
88+
)
89+
90+
# Incorrect - Passing the feature directly
91+
# grid_params = helpers.fit_geometry(geometry=aoi_feature, ...)
92+
```
93+
94+
If you prefer to convert to shapely explicitly or need the shapely geometry elsewhere:
8095

8196
```python
8297
import shapely

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ ds = xr.open_dataset('ee://ECMWF/ERA5_LAND/MONTHLY_AGGR', engine='ee', **grid)
126126
```{admonition} Already have an Earth Engine geometry?
127127
:class: tip
128128
129-
`helpers.fit_geometry` accepts an `ee.Geometry` directly. See the [User Guide](guide.md) for an end-to-end example.
129+
`helpers.fit_geometry` accepts `shapely.geometry` or `ee.Geometry` directly. If you have an `ee.Feature`, call `.geometry()` first. See the [User Guide](guide.md) for examples.
130130
```
131131

132132
## 7. Having trouble?

0 commit comments

Comments
 (0)