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

od_disaggregate() should avoid repeated use of sample points #35

Closed
Robinlovelace opened this issue Nov 28, 2021 · 2 comments
Closed

od_disaggregate() should avoid repeated use of sample points #35

Robinlovelace opened this issue Nov 28, 2021 · 2 comments

Comments

@Robinlovelace
Copy link
Member

Example highlighting the issue:

set.seed(2021)
disag = od::od_disaggregate(od::od_data_df[1:2, ], z = od::od_data_zones_min)
#> Creating randomly sampled origin and destination points.
coords_origin = lwgeom::st_startpoint(disag)
#> Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1
coords_destination = lwgeom::st_endpoint(disag)
summary(duplicated(coords_origin))
#>    Mode   FALSE    TRUE 
#> logical      26      17
summary(duplicated(coords_destination))
#>    Mode   FALSE    TRUE 
#> logical      29      14
plot(disag[0])

Created on 2021-11-28 by the reprex package (v2.0.1)

Robinlovelace added a commit that referenced this issue Nov 28, 2021
Robinlovelace added a commit that referenced this issue Nov 28, 2021
@Robinlovelace
Copy link
Member Author

Thought it was fixed by seems not with the commit above I get the following.

remotes::install_github("itsleeds/od", "disagrefactor")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'od' from a github remote, the SHA1 (e4c0a787) has not changed since last install.
#>   Use `force = TRUE` to force installation
set.seed(2021)
# set max per zone to previous value
disag = od::od_disaggregate(od::od_data_df[1:2, ], z = od::od_data_zones_min, max_per_od = 50)
#> Creating randomly sampled origin and destination points.
coords_origin = lwgeom::st_startpoint(disag)
#> Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1
coords_destination = lwgeom::st_endpoint(disag)
summary(duplicated(coords_origin))
#>    Mode   FALSE 
#> logical      43
summary(duplicated(coords_destination))
#>    Mode   FALSE    TRUE 
#> logical      35       8
plot(disag[0])

Created on 2021-11-28 by the reprex package (v2.0.1)

@Robinlovelace
Copy link
Member Author

This issue is now fixed on the disagrefactor branch 🎉

remotes::install_github("itsleeds/od", "disagrefactor")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'od' from a github remote, the SHA1 (dcae9c56) has not changed since last install.
#>   Use `force = TRUE` to force installation
set.seed(2021)
# set max per zone to previous value
disag = od::od_disaggregate(od::od_data_df[1:2, ], z = od::od_data_zones_min, max_per_od = 50)
#> Creating randomly sampled origin and destination points.
coords_origin = lwgeom::st_startpoint(disag)
#> Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1
coords_destination = lwgeom::st_endpoint(disag)
summary(duplicated(coords_origin))
#>    Mode   FALSE 
#> logical      43
summary(duplicated(coords_destination))
#>    Mode   FALSE 
#> logical      43
plot(disag[0])

Created on 2021-11-28 by the reprex package (v2.0.1)

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