Last updated: 2020-02-20

Checks: 7 0

Knit directory: MHWNWA/

This reproducible R Markdown analysis was created with workflowr (version 1.6.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20190513) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    LaTeX/SOM_node_summary.docx
    Ignored:    LaTeX/SOM_node_summary.pdf
    Ignored:    data/NAPA/NAPA_clim_U.Rda
    Ignored:    data/NAPA/NAPA_clim_V.Rda
    Ignored:    data/NAPA/NAPA_clim_W.Rda
    Ignored:    data/NAPA/NAPA_clim_emp_ice.Rda
    Ignored:    data/NAPA/NAPA_clim_emp_oce.Rda
    Ignored:    data/NAPA/NAPA_clim_fmmflx.Rda
    Ignored:    data/NAPA/NAPA_clim_mldkz5.Rda
    Ignored:    data/NAPA/NAPA_clim_mldr10_1.Rda
    Ignored:    data/NAPA/NAPA_clim_qemp_oce.Rda
    Ignored:    data/NAPA/NAPA_clim_qla_oce.Rda
    Ignored:    data/NAPA/NAPA_clim_qns.Rda
    Ignored:    data/NAPA/NAPA_clim_qsb_oce.Rda
    Ignored:    data/NAPA/NAPA_clim_qt.Rda
    Ignored:    data/NAPA/NAPA_clim_runoffs.Rda
    Ignored:    data/NAPA/NAPA_clim_ssh.Rda
    Ignored:    data/NAPA/NAPA_clim_sss.Rda
    Ignored:    data/NAPA/NAPA_clim_sst.Rda
    Ignored:    data/NAPA/NAPA_clim_taum.Rda
    Ignored:    data/NAPA/NAPA_clim_vars.Rda
    Ignored:    data/NAPA/NAPA_clim_vecs.Rda
    Ignored:    data/NAPA/synoptic_vec_states.Rda
    Ignored:    data/SOM/packet.Rda
    Ignored:    data/SOM/synoptic_states.Rda
    Ignored:    data/SOM/synoptic_states_other.Rda
    Ignored:    data/anom/ALL_anom.Rda
    Ignored:    data/anom/ALL_other.Rda
    Ignored:    data/anom/ERA5_mslp_anom.Rda
    Ignored:    data/anom/ERA5_qnet_anom.Rda
    Ignored:    data/anom/ERA5_t2m_anom.Rda
    Ignored:    data/anom/ERA5_u_anom.Rda
    Ignored:    data/anom/ERA5_v_anom.Rda
    Ignored:    data/anom/GLORYS_mld_anom.Rda
    Ignored:    data/anom/GLORYS_u_anom.Rda
    Ignored:    data/anom/GLORYS_v_anom.Rda
    Ignored:    data/anom/OISST_sst_anom.Rda
    Ignored:    data/base/ERA5_lhf.Rda
    Ignored:    data/base/ERA5_lwr.Rda
    Ignored:    data/base/ERA5_mslp.Rda
    Ignored:    data/base/ERA5_qnet.Rda
    Ignored:    data/base/ERA5_shf.Rda
    Ignored:    data/base/ERA5_swr.Rda
    Ignored:    data/base/ERA5_t2m.Rda
    Ignored:    data/base/ERA5_u.Rda
    Ignored:    data/base/ERA5_v.Rda
    Ignored:    data/base/GLORYS_mld.Rda
    Ignored:    data/base/GLORYS_u.Rda
    Ignored:    data/base/GLORYS_v.Rda
    Ignored:    data/base/OAFlux.Rda
    Ignored:    data/base/OISST_sst.Rda
    Ignored:    data/clim/ALL_clim.Rda
    Ignored:    data/clim/ERA5_mslp_clim.Rda
    Ignored:    data/clim/ERA5_qnet_clim.Rda
    Ignored:    data/clim/ERA5_t2m_clim.Rda
    Ignored:    data/clim/ERA5_u_clim.Rda
    Ignored:    data/clim/ERA5_v_clim.Rda
    Ignored:    data/clim/GLORYS_mld_clim.Rda
    Ignored:    data/clim/GLORYS_u_clim.Rda
    Ignored:    data/clim/GLORYS_v_clim.Rda
    Ignored:    data/clim/OISST_sst_clim.Rda
    Ignored:    data/comparison/node_mean_all_anom.Rda
    Ignored:    data/comparison/packet_all.Rda
    Ignored:    data/comparison/packet_all_anom.Rda
    Ignored:    data/comparison/packet_nolab.Rda
    Ignored:    data/comparison/packet_nolab14.Rda
    Ignored:    data/comparison/packet_nolabgsl.Rda
    Ignored:    data/comparison/packet_nolabmod.Rda
    Ignored:    data/comparison/som_all.Rda
    Ignored:    data/comparison/som_all_anom.Rda
    Ignored:    data/comparison/som_nolab.Rda
    Ignored:    data/comparison/som_nolab14.Rda
    Ignored:    data/comparison/som_nolab_16.Rda
    Ignored:    data/comparison/som_nolab_9.Rda
    Ignored:    data/comparison/som_nolabgsl.Rda
    Ignored:    data/comparison/som_nolabmod.Rda
    Ignored:    data/eddy_trajectory_2.0exp_19930101_20180118.nc
    Ignored:    talk/IMBeR_2019.html
    Ignored:    talk/MHWNWA.html

Unstaged changes:
    Modified:   code/functions.R
    Modified:   output/SOM/air_u_v_mslp_anom.pdf
    Modified:   output/SOM/air_u_v_mslp_real.pdf
    Modified:   output/SOM/cum_int_season.pdf
    Modified:   output/SOM/cum_int_season.png
    Modified:   output/SOM/duration_rate_onset.pdf
    Modified:   output/SOM/max_int_region.pdf
    Modified:   output/SOM/max_int_region.png
    Modified:   output/SOM/mld_anom_sd.pdf
    Modified:   output/SOM/msl_anom_sd.pdf
    Modified:   output/SOM/msl_sd.pdf
    Modified:   output/SOM/node_10_panels.pdf
    Modified:   output/SOM/node_10_panels.png
    Modified:   output/SOM/node_11_panels.pdf
    Modified:   output/SOM/node_11_panels.png
    Modified:   output/SOM/node_12_panels.pdf
    Modified:   output/SOM/node_12_panels.png
    Modified:   output/SOM/node_1_panels.pdf
    Modified:   output/SOM/node_1_panels.png
    Modified:   output/SOM/node_2_panels.pdf
    Modified:   output/SOM/node_2_panels.png
    Modified:   output/SOM/node_3_panels.pdf
    Modified:   output/SOM/node_3_panels.png
    Modified:   output/SOM/node_4_panels.pdf
    Modified:   output/SOM/node_4_panels.png
    Modified:   output/SOM/node_5_panels.pdf
    Modified:   output/SOM/node_5_panels.png
    Modified:   output/SOM/node_6_panels.pdf
    Modified:   output/SOM/node_6_panels.png
    Modified:   output/SOM/node_7_panels.pdf
    Modified:   output/SOM/node_7_panels.png
    Modified:   output/SOM/node_8_panels.pdf
    Modified:   output/SOM/node_8_panels.png
    Modified:   output/SOM/node_9_panels.pdf
    Modified:   output/SOM/node_9_panels.png
    Modified:   output/SOM/qnet_anom_sd.pdf
    Modified:   output/SOM/qnet_mld_anom.pdf
    Modified:   output/SOM/region_season.pdf
    Modified:   output/SOM/sst_anom_sd.pdf
    Modified:   output/SOM/sst_sd.pdf
    Modified:   output/SOM/sst_u_v_anom.pdf
    Modified:   output/SOM/sst_u_v_real.pdf
    Modified:   output/SOM/t2m_anom_sd.pdf
    Modified:   output/SOM/t2m_sd.pdf
    Modified:   output/SOM/u10_anom_sd.pdf
    Modified:   output/SOM/u10_sd.pdf
    Modified:   output/SOM/u_anom_sd.pdf
    Modified:   output/SOM/u_sd.pdf
    Modified:   output/SOM/v10_anom_sd.pdf
    Modified:   output/SOM/v10_sd.pdf
    Modified:   output/SOM/v_anom_sd.pdf
    Modified:   output/SOM/v_sd.pdf

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd a3b88a8 Robert William Schlegel 2020-02-12 Working through a full edit of the workflowr site. This will seque into a write up of the draft manuscript.
html a7fbd91 robwschlegel 2019-08-28 Build site.
Rmd 59cf771 robwschlegel 2019-08-22 Polished up the variable prep vignette
html 826c73d robwschlegel 2019-08-15 Build site.
html 143b1a6 robwschlegel 2019-08-15 Build site.
Rmd 78f4977 robwschlegel 2019-08-15 Re-publish entire site.
html 20ae166 robwschlegel 2019-08-11 Build site.
html 19bea26 robwschlegel 2019-08-11 Build site.
html 2652a3a robwschlegel 2019-08-11 Build site.
Rmd adc762b robwschlegel 2019-08-08 Re-worked the GLORYS data and propogated update through to SOM analysis figures for all experiments
html f0d2efb robwschlegel 2019-08-07 Build site.
Rmd ed626bf robwschlegel 2019-08-07 Ran a bunch of figures and had a meeting with Eric. More changes coming to GLORYS data tomorrow before settling on one of the experimental SOMs
Rmd f27c261 robwschlegel 2019-08-06 Working towards pipeline optimised for testing different SOM inputs
Rmd 9a9fa7d robwschlegel 2019-08-01 A more in depth dive into the potential criteria to meet for the SOM model
html aa82e6e robwschlegel 2019-07-31 Build site.
Rmd 498909b robwschlegel 2019-07-31 Re-publish entire site.
Rmd 256a7f1 robwschlegel 2019-07-31 Completed re-run on ERA 5 data. Working on combining anomalies.
Rmd 3b805e4 robwschlegel 2019-07-30 Completed anomaly runs on GLORYS variables
Rmd bd987b4 robwschlegel 2019-07-29 Completed run on anomalies with the exception of the three in the GLORYS product
Rmd 51ed681 robwschlegel 2019-07-25 Completed anoms for OISST
Rmd 0b6f065 robwschlegel 2019-07-25 Push before beginning to write code for loading entire obs/reanalysis products into memory for clim calculations
Rmd 04a6bf3 robwschlegel 2019-07-24 Creating new download script for obs/reanalysis products
html 81e961d robwschlegel 2019-07-09 Build site.
Rmd 7ff9b8b robwschlegel 2019-06-17 More work on the talk
html c23c50b robwschlegel 2019-06-10 Build site.
html 028d3cc robwschlegel 2019-06-10 Build site.
html c61a15f robwschlegel 2019-06-06 Build site.
Rmd 49c6105 robwschlegel 2019-06-06 Finished vector data packet pipeline
Rmd 44ac335 robwschlegel 2019-06-06 Working on inclusion of vectors into SOM pipeline
html 6dd6da8 robwschlegel 2019-06-06 Build site.
Rmd 07137d9 robwschlegel 2019-06-06 Site wide update, including newly functioning SOM pipeline.
Rmd 990693a robwschlegel 2019-06-05 First SOM result visuals
Rmd 4838cc8 robwschlegel 2019-06-04 Working on SOM functions
Rmd 94ce8f6 robwschlegel 2019-06-04 Functions for creating data packets are up and running
Rmd 65301ed robwschlegel 2019-05-30 Push before getting rid of some testing structure
Rmd 0717c84 robwschlegel 2019-05-29 Working towards getting the variable climatologies in order
Rmd 2c3f68c robwschlegel 2019-05-28 Working on the variable prep vignette
html c09b4f7 robwschlegel 2019-05-24 Build site.
Rmd 5dc8bd9 robwschlegel 2019-05-24 Finished initial creation of SST prep vignette.

Introduction

This vignette walks through the steps needed to create mean synoptic states during all of the MHWs detected in the previous vignette. These synoptic states consist of the variables in the ocean heat budget equation.

After first going through this entire process with the NAPA model output it became clear that this analysis should actually be run with obs/reanalysis data, and the NAPA model results may be compared against this as desired. To this end we will use the following variables as found in the following data products:

  • NOAA: (optimally interpolated) SST
  • GLORYS: Mixed layer depth (metres), U & V current vectors (~0.5m)
  • ERA 5: U & V wind vectors (10m), air temperature (2m), net heat flux:
    • latent & sensible heat flux, shortwave & longwave radiation

All of these products and variables have a shared daily resolution period from 1993 – 2018. The spatial resolutions for NOAA and ERA 5 are 1/4 degrees and the GLORYS data are 1/12 degree. The coordinates are slightly off between OISST and ERA 5 & GLORYS, with the coordinate system for NOAA being centred per pixel while the other two products have their coordinate system based on the northwest corner. In order to compare the OISST dataset to the other 1/4 degree products the lat values for OISST will have 0.125 added to them, and the longitude values will have 0.125 subtracted from them. The ERA5 data are hourly, so will need to be binned into mean daily values. In order to trade between efficiency and accuracy we will be converting everything to the 1/4 degree grid of the GLORYS/ERA 5 data at a daily temporal resolution.

Base datasets

Rather than go about performing all of the calculations below on piecemeal bits of data, we will load each variable into memory at once. The following code chunk shows how we create functions that load each of the variables from the different data products. We will then create and save this complete dataset for ease of use later on.

# The code used for this step may be seen in the 'code/workflow.R':
# https://github.com/robwschlegel/MHWNWA/blob/master/code/workflow.R

# The sections of the script used are:
# OISST processing, GLORYS processing, and ERA 5 processing

Net heat flux

This is the one variable I was not able to source. The OAFlux product does have a net heat flux layer, but it ends in 2009. This is not long enough so we are going to create our own net heat flux layer by adding together the latent & sensible heat flux layers with the shortwave & longwave radiation layers from the ERA 5 product. When doing so we must ensure that the directions of the terms are matched correctly (i.e. that they all represent positive downward flux). Reading through the available meta-data I was not able to verify this, but it appears as though these area all positive downward flux terms.

# The code used to perform these steps may be seen in 'code/workflow.R' sction:
# ERA 5 processing

Climatologies

In the data packets we need to create for the SOM we will need to include anomaly values. In order to do this we need to first create daily climatologies for each variable for each pixel. To do so we will need to load all of the files and then pixel-wise go about getting the seasonal (mean daily) climatologies. This will be done with the same function (ts2clm()) that is used for the MHW climatologies. One-by-one we will load an entire dataset (created above) into memory so that we can perform the necessary calculations. Hold on to your hats, this is going to be RAM heavy…

# The code used to perform these steps may be seen in 'code/workflow.R' sction:
# OISST processing, GLORYS processing, and ERA 5 processing

Anomalies

The last step before we can begin creating our data packets is to subtract our climatology data from our base data for each of the variables used in this study. We then save these large anomaly cubes to allow for easier synoptic state creation later on.

# The code used to perform these steps may be seen in 'code/workflow.R' sction:
# OISST processing, GLORYS processing, and ERA 5 processing

Synoptic states

The next step is to create mean synoptic states for each variable during each of the MHWs detected in each region. To do this we simply load the combined anomaly dataset of all of our chosen variables and slice off only the bits we need during each of the observed MHWs. These slices are then meaned, pixel-wise, to create the synoptic states during each event.

# The code used to perform these steps may be seen in 'code/workflow.R' sction:
# OISST processing, GLORYS processing, and ERA 5 processing

With all of our mean synoptic states created it is now time to feed them to the Self-organising map (SOM).


sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] workflowr_1.6.0 Rcpp_1.0.3      rprojroot_1.3-2 digest_0.6.23  
 [5] later_1.0.0     R6_2.4.1        backports_1.1.5 git2r_0.26.1   
 [9] magrittr_1.5    evaluate_0.14   stringi_1.4.5   rlang_0.4.4    
[13] fs_1.3.1        promises_1.1.0  whisker_0.4     rmarkdown_2.0  
[17] tools_3.6.2     stringr_1.4.0   glue_1.3.1      httpuv_1.5.2   
[21] xfun_0.12       yaml_2.2.1      compiler_3.6.2  htmltools_0.4.0
[25] knitr_1.27