GithubHelp home page GithubHelp logo

dart's People

Contributors

s3818311 avatar tuyenhn avatar

Watchers

Marc Choisy avatar  avatar

dart's Issues

Using a "null sentinel" value might have been a bad idea

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.

writing style in dart_max_dist()

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)

Remove if test in dart_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.

is.data.frame(sf) in dart_process()

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?

Package installation

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.

dart_centroid()

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()
}

sf geographical unit id is currently hardcoded

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.