Skip to content

Refactor tide graph path method to avoid odc.geobox#1413

Merged
vnewey merged 2 commits into
masterfrom
tide_graphs_nogeobox
Mar 24, 2026
Merged

Refactor tide graph path method to avoid odc.geobox#1413
vnewey merged 2 commits into
masterfrom
tide_graphs_nogeobox

Conversation

@robbibt

@robbibt robbibt commented Mar 24, 2026

Copy link
Copy Markdown
Member

Currently, the new tide graph calculation method uses .odc.geobox to obtain the coordinates of the GetFeatureInfo request. Unfortunately this seems to fail, as the GetFeatureInfo returned on data does not appear to have a valid GeoBox:

https://ows.dev.dea.ga.gov.au/wms?service=WMS&version=1.3.0&request=GetFeatureInfo&layers=ga_s2ls_intertidal_cyear_3&query_layers=ga_s2ls_intertidal_cyear_3&styles=intertidal_elevation_adaptive&crs=EPSG:4326&bbox=-12.222735,131.869438,-12.221735,131.870438&width=101&height=101&i=50&j=50&info_format=application/json&time=2023-01-01

<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
<ServiceException> Unexpected server error: 'NoneType' object has no attribute 'extent' </ServiceException>
<ServiceException>
<![CDATA[ Traceback (most recent call last): ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/ogc.py", line 123, in ogc_svc_impl return version_support.router(nocase_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/utils.py", line 38, in log_wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/wms.py", line 31, in handle_wms return feature_info(nocase_args) ^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/utils.py", line 38, in log_wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/feature_info.py", line 277, in feature_info date_info[k] = f(pixel_ds, ds) ^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/config_utils.py", line 1149, in __call__ return self._func(*calling_args, **calling_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/env/config/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py", line 78, in tide_graph_path point_albers = data.odc.geobox.extent.centroid.to_crs("EPSG:3577").geom ^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ AttributeError: 'NoneType' object has no attribute 'extent' ]]>
</ServiceException>
</ServiceExceptionReport>

This PR attempts a new approach - still using the .odc accessor but instead using the .odc.map_bounds() method to get the extent of the data in lat/lon coordinates.

Refactor tide graph path calculation to use point from map bounds.
@robbibt robbibt requested review from SpacemanPaul and vnewey March 24, 2026 05:51
@robbibt robbibt marked this pull request as ready for review March 24, 2026 05:55
@robbibt

robbibt commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

@SpacemanPaul If you had any thoughts as to why data doesn't have a Geobox, or even how I could simulate what is returned as data in a notebook, that would be fantastic. I have tried doing a single pixel load via datacube and it appears to include a valid geobox, but apparently what OWS returns for data does not.

@vnewey vnewey merged commit e1a861c into master Mar 24, 2026
5 checks passed
@vnewey vnewey deleted the tide_graphs_nogeobox branch March 24, 2026 06:07
@robbibt

robbibt commented Mar 25, 2026

Copy link
Copy Markdown
Member Author

OK, this didn't fix the issue, but we do get a different error now:

https://ows.dev.dea.ga.gov.au/wms?service=WMS&version=1.3.0&request=GetFeatureInfo&layers=ga_s2ls_intertidal_cyear_3&query_layers=ga_s2ls_intertidal_cyear_3&styles=intertidal_elevation_adaptive&crs=EPSG:4326&bbox=-12.222735,131.869438,-12.221735,131.870438&width=101&height=101&i=50&j=50&info_format=application/json&time=2023-01-01

<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
<ServiceException> Unexpected server error: Not geo registered </ServiceException>
<ServiceException>
<![CDATA[ Traceback (most recent call last): ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/ogc.py", line 123, in ogc_svc_impl return version_support.router(nocase_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/utils.py", line 38, in log_wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/wms.py", line 31, in handle_wms return feature_info(nocase_args) ^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/utils.py", line 38, in log_wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/feature_info.py", line 277, in feature_info date_info[k] = f(pixel_ds, ds) ^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/datacube_ows/config_utils.py", line 1156, in __call__ return self._func(*calling_args, **calling_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/env/config/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py", line 79, in tide_graph_path lat, lon = data.odc.map_bounds()[0] ^^^^^^^^^^^^^^^^^^^^^ ]]>
<![CDATA[ File "/app/lib/python3.12/site-packages/odc/geo/_xr_interop.py", line 1080, in map_bounds raise ValueError("Not geo registered") ]]>
<![CDATA[ ValueError: Not geo registered ]]>
</ServiceException>
</ServiceExceptionReport>

Seems like the data array isn't playing nicely with odc-geo and the .odc.* accessor...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants