Skip to content

Opera ord - #205

Merged
bart1 merged 29 commits into
mainfrom
opera_ord
Sep 18, 2026
Merged

bart1 merged 29 commits into
mainfrom
opera_ord

Conversation

@bart1

@bart1 bart1 commented Jun 29, 2026 •

Copy link
Copy Markdown
Collaborator
  • add coverage in vignette

@bart1 bart1 linked an issue Jun 29, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.38158% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (6fd2d91) to head (e886d11).

Files with missing lines Patch % Lines
R/get_pvol_ord.R 95.83% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
- Coverage   92.55%   92.25%   -0.31%     
==========================================
  Files          32       32              
  Lines        2647     2568      -79     
==========================================
- Hits         2450     2369      -81     
- Misses        197      199       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bart1

bart1 commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Here is a quick example of a max composite ppi of the lowest scan, using local data if available and opera ord data when there is no national data.

devtools::load_all("~/getRad")
require(dplyr)
require(sf)
require(raster)
require(bioRad)
get_weather_radars() |> filter(status == 1) -> radars
time <- Sys.Date() |> as.POSIXct()
base_raster <- radars |>
  st_buffer(units::set_units(100, 'km')) |>
  raster(resolution = .025)

require(purrr)
require(mirai)
mirai::daemons(6)

grds <- purrr::map(
  radars$radar,
  in_parallel(
    \(radar) {
      pvol <- try(getRad::get_pvol(radar, time))
      if (!inherits(pvol, "try-error")) {
        pvol <- pvol |>
          dplyr::select(any_of(c("DBZH", "dbzh", "dbz")))
        pvol$scans <- pvol$scans[purrr::map_lgl(
          pvol$scans,
          ~ length(.x$params)
        )]
        scn <- bioRad::get_scan(pvol, 0)
        base_raster_cropped <- raster::crop(
          base_raster,
          raster::extent(sf::st_bbox(sf::st_buffer(
            radars$geometry[radars$radar == radar],
            units::set_units(300, 'km')
          )))
        )
        raster::raster(
          bioRad::project_as_ppi(scn, raster = base_raster_cropped)$data
        )
      } else {
        NULL
      }
    },
    time = time,
    radars = radars,
    base_raster = base_raster
  )
)
dbz_map <- calc(
  stack(purrr::map(grds[!purrr::map_lgl(grds, is.null)], extend, base_raster)),
  max,
  na.rm = T
)
#> Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
#> Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
#> Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
#> Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
#> Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
plot(dbz_map)
plot(
  rnaturalearth::ne_countries(scale = 50) |>
    st_cast("MULTILINESTRING") |>
    st_geometry(),
  add = T
)

Created on 2026-06-30 with reprex v2.1.1

Standard output and standard error
-- nothing to show --

@bart1

bart1 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

This is the opera map from roughly the same time
image

Bart and others added 7 commits June 30, 2026 13:49
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Removed unused code related to the 'opera' data source and cleaned up the included countries data.
@bart1

bart1 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

It seems the Essen radar is down causing the tests to fail (unrelated to pull request). The coverage is not complete as some tests might not be hit but are there so some sanity checking in the merging process.

Data from the ORD is far from perfect, for Spain the range start is for example strange and conflicting in the meta data. bejab seems sometimes to give conflicts. Poland has conflicting meta data (two differing nyquist velocities for one scan). And Ireland I do not know how to merge. But in general some data for exploration can be loaded.

@bart1
bart1 marked this pull request as ready for review June 30, 2026 13:05
@bart1
bart1 requested review from PietrH and peterdesmet June 30, 2026 13:05
Comment thread R/get_pvol_ord.R
Comment thread R/get_pvol.R Outdated
@bart1

bart1 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

@YohanSassi , @barthoekstra or @CeciliaNilsson709 would one of you mind to have a look at this pull request as I think you work more with pvols .

@bart1

bart1 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Note the lines of code that are note tested are mainly there to confirm validity at they end. I think they should not be hit in normal use cases

@CeciliaNilsson709

Copy link
Copy Markdown
Contributor

Thanks @bart1 !

I played around a bit with get_pvol() with use_opera_ord=TRUE, and it seems to work quite well for most of the combinations I tried. For example for Sweden and Norway it doesn't work to make VP's, I guess because not all the required information is there?

Could maybe be good to add in the documentation that the opera ord data is only available for the last 24h (I think?).

Do you want me to test/review something else? Haven't dugg through all the code, just played around with the function a bit, so let me know if you want a deeper dive!

@bart1

bart1 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @CeciliaNilsson709, I think I can fix Sweden, Norway only has vrad values every other pvol and then not even for each scan. So every 10 minutes you can calculate a vp

@bart1
bart1 merged commit 38b4386 into main Sep 18, 2026
9 of 11 checks passed
@bart1
bart1 deleted the opera_ord branch September 18, 2026 17:50
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.

Open radar data from Opera

3 participants