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

Coordinate priority with non-spherical CRS #490

Open
bekozi opened this issue Nov 19, 2018 · 7 comments
Open

Coordinate priority with non-spherical CRS #490

bekozi opened this issue Nov 19, 2018 · 7 comments
Labels

Comments

@bekozi
Copy link
Contributor

bekozi commented Nov 19, 2018

@mkmitchell reported an issue with a NARR dataset having a Lambert Conformal Conic projection. The lat/lon coordinate variables were marked with axis x/y attributes. The Cartesian x/y coordinate variables had no axis attributes. ocgis errored out during a subset as it chose the LCC projection correctly but picked the wrong coordinates because of axis attribute priority during coordinate selection. This was fixed by updating the dimension map prior to the subset.

To fix this, coordinate variable selection should attempt to match coordinate variable units against the units recommended by the coordinate system prior to using the axis attributes.

@bekozi bekozi added the bug label Nov 19, 2018
@mkmitchell
Copy link

I was able to bypass the error by using your suggestion

rdc = RequestDataset(uri, 'variable')
rdc.dimension_map.set_variable('x', 'x')
rdc.dimension_map.set_variable('y', 'y')

but it only worked for a bit. I'm getting the same error again.

ocgis.exc.ExtentError: A subset operation on variable "None" returned empty. This typically means the selection geometry falls outside the spatial domain of the target dataset.

I'm attempting to sum the variable by day/month/year for every shape in the shapefile using the following command:

ops = OcgOperations(dataset=rdc, output_format='shp', time_region={'month': [1,2,3,4,9,10,11,12]}, spatial_operation='clip', geom=shp, calc=calc,
                calc_raw=True, aggregate=True, calc_grouping=['day', 'month', 'year'], prefix=prefix)

Thanks in advance!

@bekozi
Copy link
Contributor Author

bekozi commented Mar 6, 2019

Bummer! A few quick questions:

  • Did the netcdf metadata change?
  • Are you using a different shapefile?
  • Did you update ocgis recently?

I cannot think of any recent changes that would cause this. It's possible (if the shapfile changed) that you do have some empty subsets in there. In that case, you can try setting allow_empty=True in the operations call.

@mkmitchell
Copy link

  • I've created multiple NetCDF files but have also used original NARR data with the same result.

It must be the shapefile. I get the error I posted about with one. It succeeds with a few others.
I've also seen
ValueError: Record's geometry type does not match collection schema's geometry type: 'Point' != 'MultiPoint'
with a different one.

@mkmitchell
Copy link

It was definitely the shapefile. It appears very small features were giving me the error.

@bekozi
Copy link
Contributor Author

bekozi commented Mar 14, 2019

Thanks for the update. Sorry for the slow reply - was taking some PTO.

Do you think this is a problem that needs to be fixed in ocgis? I could take a look at the shapefile if that would help.

@mkmitchell
Copy link

Take your much deserved PTO!

That's completely up to you. I ended up iterating through selections of my shapefile. If it worked I selected more and if it didn't I deselected a few I previously added.

It may be nice to have ocgis keep running the calculation and report a list of features that didn't process because of whatever exception.

@bekozi
Copy link
Contributor Author

bekozi commented Mar 15, 2019

Done! 😉 Your approach makes sense. When you get a chance, could you pass along the shp and netcdf (or just the spatial resolution of the grid if that's easier)? What you described would be a nice feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants