Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDR Xarray covjson reordering y #1780

Open
pzaborowski opened this issue Aug 12, 2024 · 1 comment
Open

EDR Xarray covjson reordering y #1780

pzaborowski opened this issue Aug 12, 2024 · 1 comment
Labels
bug Something isn't working OGC API - Environmental Data Retrieval OGC API - Environmental Data Retrieval
Milestone

Comments

@pzaborowski
Copy link
Contributor

Description
in
provider/xarray_.py
gen_covjson function
following code:

minx, miny, maxx, maxy = metadata['bbox']
        mint, maxt = metadata['time']
        try:
            tmp_min = data.coords[self.y_field].values[0]
        except IndexError:
            tmp_min = data.coords[self.y_field].values
        try:
            tmp_max = data.coords[self.y_field].values[-1]
        except IndexError:
            tmp_max = data.coords[self.y_field].values

        if tmp_min > tmp_max:
            LOGGER.debug(f'Reversing direction of {self.y_field}')
            miny = tmp_max
            maxy = tmp_min
...
                    'y': {
                        'start': maxy,
                        'stop': miny,

Is reversing only axis north-south but not data. It breaks resulting coveragejson with inconsistent axis-data.
Either it shall be followed by the data reordering (not cheap so maybe not recommended) or axis start/stop shall be read from data.
Reading start/stop from data would also partly address the issue when data grid does not fill the query bbox and resulting array would not fill current axis.
Steps to Reproduce
Steps to reproduce the behavior:
Use reference configuration from https://docs.pygeoapi.io/en/latest/data-publishing/ogcapi-edr.html
View the results on the map - see it is upside down.

Expected behavior

  1. Reordering of axis shall be removed or followed by data reordering - in case data is not expected organisation exception could be rised optionally.
  2. start/stop of axis shall be read from data to make it consistent with variables (not bbox min/max which could make data stretched inproperly

Screenshots/Tracebacks
If applicable, add screenshots to help explain your problem.

Environment

  • OS:
  • Python version:
  • pygeoapi version:

Additional context
Test data from https://docs.pygeoapi.io/en/latest/data-publishing/ogcapi-edr.html

  • tests/data/coads_sst.nc
    looks like longitude is in fact 0-360 not as in coords -180:180
@pzaborowski pzaborowski added the bug Something isn't working label Aug 12, 2024
@pzaborowski
Copy link
Contributor Author

pzaborowski commented Sep 13, 2024

@pzaborowski pzaborowski mentioned this issue Sep 18, 2024
2 tasks
@tomkralidis tomkralidis added this to the 0.18.0 milestone Sep 18, 2024
@tomkralidis tomkralidis added the OGC API - Environmental Data Retrieval OGC API - Environmental Data Retrieval label Sep 18, 2024
@tomkralidis tomkralidis modified the milestones: 0.18.0, 0.19.0 Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OGC API - Environmental Data Retrieval OGC API - Environmental Data Retrieval
Projects
None yet
Development

No branches or pull requests

2 participants