Skip to content

Commit ee80032

Browse files
committed
Add FAQ entries for netcdf int64 error and ee.Geometry conversion
1 parent 528e6b6 commit ee80032

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

docs/faq.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,27 @@ 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. If you already have an EE geometry, you can convert it or use bounding box approaches. Shapely makes reprojection and area reasoning simpler client-side.
32+
Helpers accept shapely for convenience. If you already have an EE geometry, you can convert it to shapely with `shapely.geometry.shape(ee_geom.getInfo())`. Shapely makes reprojection and area reasoning simpler client-side.
33+
34+
## `ds.to_netcdf()` fails with `ValueError: could not safely cast array from int64 to int32`
35+
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.
36+
37+
Xarray selects backends in order: `netcdf4 → h5netcdf → scipy`. If neither `netcdf4` nor `h5netcdf` is installed, `scipy` is used and the error occurs.
38+
39+
**Fix:** Install `netcdf4` or `h5netcdf`. Xarray will then prefer them automatically:
40+
41+
```bash
42+
pip install netCDF4
43+
# or
44+
pip install h5netcdf
45+
```
46+
47+
If both are installed and you want to be explicit about which one is used:
48+
49+
```python
50+
ds.to_netcdf("out.nc", engine="netcdf4")
51+
# or
52+
ds.to_netcdf("out.nc", engine="h5netcdf")
53+
```
54+
55+
Alternatively, use `.to_zarr()` instead — Zarr supports `int64` natively and requires no additional packages.

0 commit comments

Comments
 (0)