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

STAC 1.0.0-beta.1 support #116

Merged
merged 2 commits into from
Jun 30, 2020
Merged

Conversation

pomadchin
Copy link
Collaborator

@pomadchin pomadchin commented Jun 26, 2020

Overview

This PR updates the codebase to support STAC 1.0

Checklist

  • New tests have been added or existing tests have been modified
  • Changelog updated

Notes

This PR also updates the test catalog (wich was incredibly useful for testing purposes but took some time). I'll remove them in a follow up PR (anyway I had to update and validate them somehow to support the STAC Layer extension description) and it will be done in terms of https://github.com/azavea/geotrellis/issues/260 later this sprint.

Closes #114

@@ -13,10 +13,10 @@ object AssetCollectionExtension {

implicit val encAssetCollectionExtension: Encoder.AsObject[AssetCollectionExtension] = Encoder
.AsObject[Map[String, Json]]
.contramapObject((extensionFields: AssetCollectionExtension) => Map("assets" -> extensionFields.assets.asJson))
.contramapObject((extensionFields: AssetCollectionExtension) => Map("item_assets" -> extensionFields.assets.asJson))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #1 assets => item_assets

Comment on lines +13 to +14
centerWavelength: Option[PosDouble],
fullWidthHalfMax: Option[PosDouble]
Copy link
Collaborator Author

@pomadchin pomadchin Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #2: wavelengths are Doubles

@@ -8,7 +8,6 @@ import io.circe.syntax._
import com.azavea.stac4s.extensions.ItemExtension

case class EOItemExtension(
gsd: Double,
Copy link
Collaborator Author

@pomadchin pomadchin Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #3: gsd is no longer a part of the extension, it is a part of item.properties

type Percentage = Int Refined Interval.Closed[W.`0`.T, W.`100`.T]
object Percentage extends RefinedTypeOps[Percentage, Int]

type BandRange = PosInt
Copy link
Collaborator Author

@pomadchin pomadchin Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #4: we don't need BadRange in assets anymore, it is a List[Band] now.

import io.circe.syntax._

case class EOAssetExtension(
bands: NonEmptyList[BandRange]
bands: NonEmptyList[Band]
Copy link
Collaborator Author

@pomadchin pomadchin Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #4 (2): we don't need BadRange in assets anymore, it is a List[Band] now.

@pomadchin pomadchin changed the title STAC 1.0.0-b1 support STAC 1.0.0-beta.1 support Jun 26, 2020
@notthatbreezy
Copy link

This looks good to me.

One follow up I think is that maybe we need to get rid of properties: JsonObject and actually type that. I thought of this because some of the changes move attributes into properties but we have no way of verifying the data in there is what should be in there. We might need to use a strategy like we do for extensions and assets since extensions can modify properties quite a bit (example is the gsd change here). @jisantuc and @pomadchin do you think we should open an issue for that?

@pomadchin
Copy link
Collaborator Author

pomadchin commented Jun 30, 2020

@notthatbreezy tbh I thought about it during this refactor. There is common metadata spec so we can at least cover extraction and validation of fields that are described here. Definitely sounds like a separate issue for me.

@pomadchin
Copy link
Collaborator Author

@notthatbreezy @jisantuc I created an issue to discuss it so we won't loose it.

@pomadchin pomadchin merged commit 26c01d7 into stac-utils:master Jun 30, 2020
@pomadchin pomadchin deleted the feature/1.0.0-b1 branch June 30, 2020 14:20
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.

Support STAC 1.0
2 participants