diff --git a/catalog/conus404-daily/collection.json b/catalog/conus404-daily/collection.json index 7e99fdd5c3f1d1449857fb7f21747ed6a725beb2..c1243093bf70840c78875f849fb734c875b670c7 100644 --- a/catalog/conus404-daily/collection.json +++ b/catalog/conus404-daily/collection.json @@ -32,8 +32,8 @@ }, "x": { "type": "spatial", - "description": "x coordinate of projection", "axis": "x", + "description": "x coordinate of projection", "extent": [ -2732097.901153542, 2731902.098846458 diff --git a/catalog_items/conus404-daily/conus404-daily.json b/catalog_items/conus404-daily/conus404-daily.json index fcbb684704d3a1055ff38910a9f6ab754ca4a943..417a2ab384fbe39f2d40a0299aab381b7943d94b 100644 --- a/catalog_items/conus404-daily/conus404-daily.json +++ b/catalog_items/conus404-daily/conus404-daily.json @@ -16,8 +16,8 @@ }, "x": { "type": "spatial", - "description": "x coordinate of projection", "axis": "x", + "description": "x coordinate of projection", "extent": [ -2732097.901153542, 2731902.098846458 diff --git a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb index 2fcdba4181f2bd23f05cd982e8a0b640c591c1c1..602f929c426c6c7558f7e95e3bd739e9bd7ecdbb 100644 --- a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb @@ -567,12 +567,16 @@ "outputs": [], "source": [ "# create a dictionary of datacube dimensions you would like to assign to this dataset\n", - "# dimension name should come from the coordinates printed above\n", + "# dimension name should come from the dims printed in above cell\n", + "\n", + "# x, y, t dimension info is pulled out automatically using the dim dict we created above\n", + "# all other dims listed in above cell need to be manually written in\n", + "\n", "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", - "dims_dict = {'time': pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': get_long_name(ds, 'time'), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step': pd.Timedelta(get_step(ds, 'time')).isoformat()}),\n", - " 'x': pystac.extensions.datacube.Dimension({'type': 'spatial', 'description': get_long_name(ds, 'x'), 'axis': 'x', 'extent': [xy_bounds[0], xy_bounds[2]], 'step': get_step(ds, 'x'), 'reference_system': projjson}),\n", - " 'y': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': get_long_name(ds, 'y'), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': get_step(ds, 'y'), 'reference_system': projjson}),\n", + "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step': pd.Timedelta(get_step(ds, dim_names_dict['T'])).isoformat()}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': get_step(ds, dim_names_dict['X']), 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': get_step(ds, dim_names_dict['Y']), 'reference_system': projjson}),\n", " 'bottom_top_stag': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'bottom_top_stag')}),\n", " 'bottom_top': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'bottom_top')}),\n", " 'soil_layers_stag': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'soil_layers_stag')}),\n", @@ -635,13 +639,13 @@ "metadata": {}, "outputs": [], "source": [ - "# pull list of vars from dataset\n", - "vars = list(ds.variables)\n", - "\n", "# drop metpy_crs coordinate we have added\n", "if 'metpy_crs' in ds.coords:\n", " ds = ds.drop_vars('metpy_crs')\n", "\n", + "# pull list of vars from dataset\n", + "vars = list(ds.variables)\n", + "\n", "# spec says that the keys of cube:dimensions and cube:variables should be unique together; a key like lat should not be both a dimension and a variable.\n", "# we will drop all values in dims from vars\n", "vars = [v for v in vars if v not in dims]\n", diff --git a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb index 473e8b1d88d3888b9e80d6f221efd055b2986540..eeee77987926cf74e6b2d4f5620b7fb62941602c 100644 --- a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb @@ -577,12 +577,16 @@ "outputs": [], "source": [ "# create a dictionary of datacube dimensions you would like to assign to this dataset\n", - "# dimension name should come from the coordinates printed above\n", + "# dimension name should come from the dims printed in above cell\n", + "\n", + "# x, y, t dimension info is pulled out automatically using the dim dict we created above\n", + "# all other dims listed in above cell need to be manually written in\n", + "\n", "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", - "dims_dict = {'time': pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': get_long_name(ds, 'time'), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step': pd.Timedelta(get_step(ds, 'time')).isoformat()}),\n", - " 'x': pystac.extensions.datacube.Dimension({'type': 'spatial', 'description': get_long_name(ds, 'x'), 'axis': 'x', 'extent': [xy_bounds[0], xy_bounds[2]], 'step': get_step(ds, 'x'), 'reference_system': projjson}),\n", - " 'y': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': get_long_name(ds, 'y'), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': get_step(ds, 'y'), 'reference_system': projjson}),\n", + "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step': pd.Timedelta(get_step(ds, dim_names_dict['T'])).isoformat()}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': get_step(ds, dim_names_dict['X']), 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': get_step(ds, dim_names_dict['Y']), 'reference_system': projjson}),\n", " 'bottom_top_stag': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'bottom_top_stag')}),\n", " 'bottom_top': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'bottom_top')}),\n", " 'soil_layers_stag': pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'z', 'description': get_long_name(ds, 'soil_layers_stag')}),\n", @@ -645,12 +649,12 @@ "metadata": {}, "outputs": [], "source": [ - "# pull list of vars from dataset\n", - "vars = list(ds.variables)\n", - "\n", "# drop metpy_crs coordinate we have added\n", "if 'metpy_crs' in ds.coords:\n", " ds = ds.drop_vars('metpy_crs')\n", + " \n", + "# pull list of vars from dataset\n", + "vars = list(ds.variables)\n", "\n", "# spec says that the keys of cube:dimensions and cube:variables should be unique together; a key like lat should not be both a dimension and a variable.\n", "# we will drop all values in dims from vars\n",