tuyenhn / dart Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
If pixel(s) with the null sentinel value (e.g. -9999 for CHIRPS) inside the buffer around communes/wards, this will greatly affect the weighted average.
We may need to eliminate these nulls out of the buffer before calculate the weighted average. This is not implemented at the moment.
Why not writing
geo_feature %>%
sf::st_cast("POINT", warn = FALSE) %>%
sf::st_distance(.$centroid) %>%
max()
instead of
dist <- geo_feature %>%
sf::st_cast("POINT", warn = FALSE) %>%
sf::st_distance(.$centroid)
max(dist)
I would remove the if test in the dart_max_dist()
function has it has a huge computational cost. Furthermore I would replace the argument with_centroid = FALSE
by centroid
forcing the user to specify a column name of the geographical feature that contains centroid data.
I don't think we want sf::st_transform(sf::st_crs(4326))
at the end of dart_centroid()
I don't think we need sf::st_geometry()
before calling sf::st_centroid()
.
Why not simply
if (!class(sf)[1] == "sf") {
instead of
if (!(is.data.frame(sf) && class(sf)[1] == "sf")) {
Isn't sf
necessarily a data frame anyway?
The projection 9210 in
centroids <- dart_centroid(sf, 9210)
shouldn't be hard coded but passed as an argument instead.
remotes::install_github("s3818311/dart")
typed locally failed. I supposed it's because the repository is private. Which bring the question: maybe we don't want to keep it private actually. To be discussed.
I think that a function like dart_centroid()
should contain only the following code:
dart_centroid <- function(sf, target_crs = 4326) {
sf %>%
sf::st_transform(sf::st_crs(target_crs)) %>%
sf::st_centroid()
}
Should be a parameter where the user can specify their id column.
Case in point:
buffers_sf <- buffers %>% sf::st_as_sf() %>% mutate(centroid = sf$centroid) %>% mutate(id = sf$ID_3)
Other sf might not have ID_3 as their chosen id column
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.