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

Delete climate_match function once it is completely up and running in its own package ClimateCastR #122

Open
soriadelva opened this issue May 7, 2024 · 4 comments
Labels

Comments

@soriadelva
Copy link
Collaborator

As discussed with Tim, the functionality currently available in the climate_match function would better be stored in its own package (called ClimateCastR) and divided into multiple, smaller functions, instead of one big function. We are therefore planning to construct this package during the coming months and move the functionality there. @damianooldoni once everything is up and running we would remove this function from the trias package to avoid confusion. What would you need from our side to make this work fluently?

@damianooldoni
Copy link
Collaborator

Nice to hear that! 👍
From the trias side, not really much is needed. Once the climate match functionality built in trias can be reproduced using ClimateCastR, please let me know in this issue. I need to:

  1. make the trias function deprecated. It's not really nice for users to have a function suddenly removed 😄
  2. Refactor the function so that it actually wraps the code in ClimateCastR
  3. After six months or so, remove deprecation but arise error. Something like: "The function 'climate_match()' has been removed. Use climateCastR function x() instead. For more documentation, check the package documentation 'https://x'".

Just a note: IMO I would name the new package climateCastR instead of ClimateCastR.

@soriadelva
Copy link
Collaborator Author

Nice to hear that! 👍 From the trias side, not really much is needed. Once the climate match functionality built in trias can be reproduced using ClimateCastR, please let me know in this issue. I need to:

  1. make the trias function deprecated. It's not really nice for users to have a function suddenly removed 😄
  2. Refactor the function so that it actually wraps the code in ClimateCastR
  3. After six months or so, remove deprecation but arise error. Something like: "The function 'climate_match()' has been removed. Use climateCastR function x() instead. For more documentation, check the package documentation 'https://x'".

Just a note: IMO I would name the new package climateCastR instead of ClimateCastR.

Great, we'll keep you posted! 👍 and we'll think about the name 😉

@PietrH
Copy link
Member

PietrH commented Jul 3, 2024

There are dutch words in objects in climate_match.R, that should be avoided as it hinders outside contributions.

eg. n_totaal

@PietrH
Copy link
Member

PietrH commented Jul 3, 2024

There are a few magical objects in climate_match.R, such as b, when skimming code this makes it more difficult to follow. I'd also add as a minor note, that two letter or 3 letter object symbols are difficult to interpret when skimming, if at all possible, it would be great if you could rename these objects in scope to be more descriptive.

As a general rule, the further away an object is used from it's initialisation, the longer it's name should be.

example:

  cm <- data.frame()
  
  for (b in unique(future_climate$scenario)) {
    future_scenario <- future_climate %>% 
      dplyr::filter(.data$scenario == b)
    
    cm_int <- data_overlay_unfiltered %>% 
      dplyr::filter(
        .data$Classification %in% future_scenario$Classification
      ) %>% 
      dplyr::mutate(scenario = b)
    
    if (nrow(cm) == 0) {
      cm <- cm_int
    } else {
      cm <- rbind(cm, cm_int)
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants