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

Extend grid26 to larger domain, but so that it the cells still overlap the existing ones #62

Closed
andrew-edwards opened this issue Oct 16, 2024 · 4 comments

Comments

@andrew-edwards
Copy link
Member

andrew-edwards commented Oct 16, 2024

Have to work out how a grid gets defined (see code in data-raw/grids/create-grid.R and others there), and work out which part of a polygon it starts calculating 2 km cells, and make it so that we have a larger grid for which grid26 is a subset.

Will really help for #49, #58, and #60, and standardize everything, especially for spatio-temporal analyses.

Basically, figure out how

grid2 <- st_make_grid(inshore_poly, cellsize = 2000) %>%
  st_as_sf()
grid2 <- grid2[inshore_poly,]

selects the corner (or whatever) of the polygon inshore_poly to start making cells of 2 km size. If anyone knows offhand that would be very helpful! (No, I haven't read the help for st_make_grid yet!).

@andrew-edwards
Copy link
Member Author

andrew-edwards commented Oct 17, 2024

Or maybe that's asking too much. And we just stick with the bccm output we already have for grid26.
Then, using _full to represent the full domain of BCCM model, naturally extending current variable names:

  • make inshore_poly_full and offshore_poly_full by adapting data-raw/make-mask-layer.R code, (to do things how Travis did we need the polygons not the grids) and use those for the following. Done - adapted the mask layer code, but saving one polygon bccm_hotssea_poly, and not doing inshore and offshore.

  • have processed one each of HOTSSea and BCCM to the same bccm_hotssea_poly using the same approach - need to check that the geometries (where they overlap) are the same, then can do these:

  • a) New Salish Sea model output, Add HOTSSea physical oceanographic model for the Salish Sea #58 - adapt data-raw/hotssea/hotssea-data-interpolation.R. Code mostly done, need to add parallelisation and churn through it all.

  • b) BCCM for full model domain (i.e. down further to the south), Include the BCCM output for its whole domain #49 - adapt data-raw/roms/roms-data-interpolation.R to ..roms-data-interpolation-full.R. Code mostly done, need to add parallelisation and churn through.

  • c) OISST data mapped to this new grid, Add HOTSSea physical oceanographic model for the Salish Sea #58. - see adapt (and then move) vignette/oisst_to_grid26.Rmd - no, just adapt the vignette into a function and then people can map onto whatever grid they want, especially given the oisst data saved in pacea are at the original resolution. Have already sent Philina the one from the vignette.

Then we still have the original variables, which will be fine for many purposes, plus these larger ones that will be equivalent for spatiotemporal analyses, and cover a larger domain. File sizes might get big but we can save outside of pacea like for existing bccm output.

@andrew-edwards
Copy link
Member Author

andrew-edwards commented Oct 17, 2024

So, if users just want:

  • OISST data on its original grid (unrelated to BCCM grid) over EEZ, and/or BCCM over EEZ, and don't want to do spatiotemporal modelling involve both of those or also involving HOTSSea output - use existing variables, else
  • if want anything else, like OISST or BCCM extended to larger domain, HOTSSea and/or OISST and/or BCCM on the same grid (especially for spatiotemporal analyses) - use new variables, maybe extending existing names with oisst_.._full and bccm_..._full. No need to add _full for HOTSsea as we'll just have one set of outputs.

@andrew-edwards
Copy link
Member Author

andrew-edwards commented Oct 29, 2024

Next:

  • check re-running of hotssea-data-interpolation.R
  • re-run test-hotssea-bccm-full-overlap.R - gives perfectly looking overlapping cells, as desired.
  • if good then can carry on above. If not then check with Andrea and Kelsey. Think the complex way Travis had it set up was necessary for various reasons, so may just have to live with nonoverlapping grid. Or create a grid (not just a polygon) that gets used.

@andrew-edwards
Copy link
Member Author

Summary: new grid was used for both bccm_full and hotssea. These cells overlap as requested, and can be used to map other spatiotemporal variables (such as OISST, which is not changed in pacea from its original values; not written function yet for that).

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