Downlaod available forecasts from stac api

This commit is contained in:
Guntis Smaukstelis
2025-02-08 22:31:23 +02:00
parent af9debbb2e
commit e203b4c01b
2 changed files with 74 additions and 5 deletions
+18 -1
View File
@@ -7,6 +7,23 @@ import java.time.{ZoneOffset, ZonedDateTime}
object FetchServiceTest {
def main(args: Array[String]): Unit = {
// fetchFromTimeList().unsafeRunSync()
fetchAvailableForecasts.unsafeRunSync()
}
private def fetchAvailableForecasts(): IO[Unit] = {
val program = for {
fetch <- FetchService.of
result <- fetch.fetchAvailableForecasts()
(modelRun, forecastTimes) = result
_ <- IO.println(modelRun)
_ <- IO.println(forecastTimes)
} yield ()
program
}
private def fetchFromTimeList(): IO[Unit] = {
val program = for {
nowUTC <- IO(ZonedDateTime.now(ZoneOffset.UTC))
referenceTime = FileName.getClosestReferenceTime(nowUTC)
@@ -16,6 +33,6 @@ object FetchServiceTest {
_ <- IO.println(nameList)
} yield ()
program.unsafeRunSync()
program
}
}