From d4e151c3a0b62ead168b8fbeddc8ab3edf63ad22 Mon Sep 17 00:00:00 2001
From: amsnyder <asnyder@usgs.gov>
Date: Mon, 8 Apr 2024 12:37:40 -0500
Subject: [PATCH] fix crs var detection"

---
 ...iver_future_create_collection_from_zarr.ipynb | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb b/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb
index ce941d3b..9f282764 100644
--- a/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb
+++ b/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb
@@ -207,6 +207,18 @@
     "## Get crs info"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "4228e138-c46d-45fd-8f74-80f27972179c",
+   "metadata": {
+    "tags": []
+   },
+   "outputs": [],
+   "source": [
+    "crs_var = 'crs'"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
@@ -215,7 +227,7 @@
    "outputs": [],
    "source": [
     "# use pyproj to automatically extract crs info\n",
-    "crs = pyproj.CRS.from_cf(ds.crs.attrs)\n",
+    "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n",
     "\n",
     "# alternatively, create the appropriate cartopy projection\n",
     "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n",
@@ -771,7 +783,7 @@
     "vars_dict={}\n",
     "for v in vars:\n",
     "    unit = stac_helpers.get_unit(ds, v)\n",
-    "    var_type = stac_helpers.get_var_type(ds, v)\n",
+    "    var_type = stac_helpers.get_var_type(ds, v, crs_var)\n",
     "    long_name = stac_helpers.get_long_name(ds, v)\n",
     "    vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})"
    ]
-- 
GitLab