diff --git a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb index 0649a030da1eac74837011b77bdd7cf9d90f6102..e92b50901dd55df995f9ca367969a41f289fc7f8 100644 --- a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb @@ -317,6 +317,11 @@ "# pull out first and last timestamps\n", "temporal_extent_lower = pd.Timestamp(ds[dim_names_dict['T']].data.min())\n", "temporal_extent_upper = pd.Timestamp(ds[dim_names_dict['T']].data.max())\n", + "# if you get an error:\n", + "# Cannot convert input [] of type <class 'cftime._cftime.DatetimeNoLeap'> to Timestamp\n", + "# use the following instead:\n", + "# temporal_extent_lower = pd.Timestamp(ds.indexes[dim_names_dict['T']].to_datetimeindex().min())\n", + "# temporal_extent_upper = pd.Timestamp(ds.indexes[dim_names_dict['T']].to_datetimeindex().max())\n", "print(f'min: {temporal_extent_lower} \\nmax: {temporal_extent_upper}')\n", "# create a temporal extent object\n", "temporal_extent = pystac.TemporalExtent(intervals=[[temporal_extent_lower, temporal_extent_upper]])" diff --git a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb index 722e28c12ca9a15fa2ccefe2df8e07f4593b2182..c18ea7037109603d2fb130f27b23934fe1bcec40 100644 --- a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb @@ -339,6 +339,11 @@ "# pull out first and last timestamps\n", "temporal_extent_lower = pd.Timestamp(ds[dim_names_dict['T']].data.min())\n", "temporal_extent_upper = pd.Timestamp(ds[dim_names_dict['T']].data.max())\n", + "# if you get an error:\n", + "# Cannot convert input [] of type <class 'cftime._cftime.DatetimeNoLeap'> to Timestamp\n", + "# use the following instead:\n", + "# temporal_extent_lower = pd.Timestamp(ds.indexes[dim_names_dict['T']].to_datetimeindex().min())\n", + "# temporal_extent_upper = pd.Timestamp(ds.indexes[dim_names_dict['T']].to_datetimeindex().max())\n", "print(f'min: {temporal_extent_lower} \\nmax: {temporal_extent_upper}')" ] },