-
Notifications
You must be signed in to change notification settings - Fork 360
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
Structured COG band subsetting #2706
Comments
I personally don't like the first option of returning missing bands with Regardless of what we decided to return, though, I feel that this feature should just be temporary to the 2.0 release. In my opinion, it doesn't make sense to have two separate read methods for the |
The main issue Because this code reaches out into the world and does stuff, exceptions aren't really avoidable. Because we need to call out such exceptional cases as well as represent successful computations which return |
@jbouffard so you think that Separate methods were done 1. because of a different signature 2. different semantics. I can see that probably it makes sense just to call a I also want to add that I'm very happy to see and agree with @moradology suggestion about exceptions handle via I think that exactly in this method, it looks like potentially not having a band is a correct behaviour. We're selecting some random bands from a tiff and we can get a band (Some) or can get nothing (None), all other exceptions would be thrown (or catched via An alternative example to support |
@pomadchin Yeah, I think they should be but not right now. I was thinking that once we decide on the new I'm still of the opinion that an error should just be thrown when attempting to read a band that doesn't exist. That way the user will know the data they want to work with is different from what they're expecting, and they can decide how they want to handle the error. |
@jbouffard yea, your idea would work only if this method would fail on any incorrect bands. I don't buy your love to |
Here's how you get/deal with val someIO: IO[A] = ???
someIO.attempt map {
case Right(success) => success // what do we do with success?
case Left(ElementNotFoundException) => ??? // what do we do if the element is not found?
case Left(_) => ??? // what do we do when there's some error we don't have a special case for?
} |
@pomadchin I wouldn't say that I have a love for |
For those poor, confused souls, this might be OK: val someIO: IO[A] = ???
try {
someIO map { result => ??? }.unsafeRunSync
} catch {
case MyException(_) => ???
} |
@jbouffard also from the last @moradology example it's clear how we can get async api for free (we wanted to investigate it #2306). It's a big question what is better to For sure every time i mention |
@pomadchin Should we close this issue and move the discussion elsewhere? |
@jbouffard not sure yet, will figure it out! |
Closed here #2775 |
Current multiband COG readers still produce all of the bands from the GeoTiff.
However, its possible that the user knows that useful information exists only in subset of the bands and wishes to read exclusively those layers. GeoTiffs that use band-interleave naturally lend themselves to this optimization.
The main concerns is how to deal with invalid band selection. Currently you get "all the bands", whatever that is, so there is no opportunity for errors. Given band subset of [1,2,100] its not desirable to fail the whole query if some of the tiffs do not have band 100. Two choices are fill missing bands with
NODATA
tiles or returnArray[Option[Tile]]
. The latter is more explicit and more efficient because avoids needing to call.isNoDataTile
to verify query results. However its not consistent with current API. Part of the issue here is to think through the implications and possibly establish a new convention for when we querying for band subsets.Although we are already in 2.0.0-RC1 this should be developed with intent to back-port the addition to 2.1 branch.
The text was updated successfully, but these errors were encountered: