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

Future removal of greatLakesPoly will break tests for transmit_along_path #203

Open
mhpob opened this issue Jan 14, 2024 · 0 comments
Open

Comments

@mhpob
Copy link
Contributor

mhpob commented Jan 14, 2024

transmit_along_path is tested against an object created by crw_in_polygon using the to-be-deprecated SpatialPointsDataFrame greatLakesPoly (inst/testdata/test-transmit_along_path-tr_spin_spout.rds). Unfortunately, using the sf great_lakes_polygon will not be a drop-in replacement for the test as it creates different CRS output at the crw_in_polygon level (see below).

library(glatos)

original_object <- readRDS("inst/testtdata/test-crw_in_polygon-path_spin_spout.rds")

sp_in <- {
  set.seed(30)
  
  crw_in_polygon(
    greatLakesPoly,
    theta = c(0, 25), stepLen = 10000,
    initPos = c(-87.49017, 48.42314), initHeading = 0,
    nsteps = 5,
    cartesianCRS = 3175, show_progress = FALSE
  )
}

identical(original_object, sp_in)
[1] TRUE

sf_in <- {
  set.seed(30)
  
  crw_in_polygon(
    great_lakes_polygon,
    theta = c(0, 25), stepLen = 10000,
    initPos = c(-87.49017, 48.42314), initHeading = 0,
    nsteps = 5,
    cartesianCRS = 3175, show_progress = FALSE
  )
}

identical(sf_in, original_object)
[1] FALSE

testthat::expect_equal(
  sp_in,
  sf_in
)
Error: `sp_in` (`actual`) not equal to `sf_in` (`expected`).

attr(actual$geometry, 'crs')$input vs attr(expected$geometry, 'crs')$input
- "WGS 84 (with axis order normalized for visualization)"
+ "EPSG:4326"

lines(attr(actual$geometry, 'crs')$wkt) vs lines(attr(expected$geometry, 'crs')$wkt)
- "GEOGCRS[\"WGS 84 (with axis order normalized for visualization)\","
+ "GEOGCRS[\"WGS 84\","
  "    DATUM[\"World Geodetic System 1984\","
  "        ELLIPSOID[\"WGS 84\",6378137,298.257223563,"
- "            LENGTHUNIT[\"metre\",1]],"
+ "            LENGTHUNIT[\"metre\",1]]],"
- "        ID[\"EPSG\",6326]],"
+ "    PRIMEM[\"Greenwich\",0,"
- "    PRIMEM[\"Greenwich\",0,"
+ "        ANGLEUNIT[\"degree\",0.0174532925199433]],"
- "        ANGLEUNIT[\"degree\",0.0174532925199433],"
+ "    CS[ellipsoidal,2],"
- "        ID[\"EPSG\",8901]],"
+ " 
@mhpob mhpob changed the title Deprecation of greatLakesPoly will break tests for transmit_along_path Future removal of greatLakesPoly will break tests for transmit_along_path Jan 14, 2024
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

No branches or pull requests

1 participant