Skip to content

Array workflow #113

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

schwarzmeyer
Copy link
Collaborator

Workflow to implement the exposure analyses using arrays

@carlosgjs carlosgjs self-requested a review June 13, 2025 21:45
@carlosgjs carlosgjs self-assigned this Jun 13, 2025
#' @export
#'

exposure_fast <- function(species.names, species.data, climate.data, niche.data, monthly = TRUE){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of a boolean monthly, it could be useful to have a mode argument that can be set to "monthly" or "extreme", which allows for additional calculations to be added without changing the interface

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually R/exposure_fast.R should be replaced by array_workflow/exposure.R. I’ve added the mode argument in the latter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Then this file will get removed?

@@ -0,0 +1,122 @@
#' Transform climate data in array format to tibble format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a duplicate of R/array_to_tibble.R? can it be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, R/array_to_tibble.R can be removed. Please keep the code from the array_workflow/code folder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok great. In that case please remove it from your branch so it doesn't get merged upon completion of your PR


# here I will convert the array into a tibble

lons <- climate$lon + 0.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could source R/array_to_tibble.R instead right? Using the common functions would shorten and simplify this script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, how's is this different from scripts/array_workflow.R?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/array_workflow.R is an updated, cleaner version of the array_workflow/code/array_to_tibble_workflow.R. It basically shows how all the functions work together. That pdf document I shared on slack is based on the scripts/array_workflow.R. Is this script useful for you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous comment, please remove array_workflow/code/array_to_tibble_workflow.R from your branch so it doesn't get merged upon completion of your PR

Basically the aim is to not have duplicate code merged into the main branch.

@@ -143,3 +143,7 @@ version.py
# pixi environments
.pixi
*.egg-info
.Rproj.user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a conflict with the main branch because additional lines were also added there. Looks like what you want is to keep both sets of changes. Here are general instructions on resolving conflicts. But basically you want to keep both changes, i.e.

From this:

.pixi
*.egg-info
<<<<<<< array_workflow
.Rproj.user

# tier_1 file that exceedes 25Mb
tier_1/data/climate/historical_array.rds
=======

outputs/

*.DS_Store

# Ignore processed species files
data-raw/bien_ranges/processed/
>>>>>>> main

Just remove the conflict markers to get to this:

.pixi
*.egg-info

.Rproj.user
# tier_1 file that exceedes 25Mb
tier_1/data/climate/historical_array.rds

outputs/
*.DS_Store
# Ignore processed species files
data-raw/bien_ranges/processed/

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

Successfully merging this pull request may close these issues.

2 participants