DrylandEcology / rSFSW2

rSFSW2: A R package to create soil water balance simulation experiment
GNU General Public License v3.0
8 stars 7 forks source link

Add climate scenario support for data from multiple Ensemble member (r<N>i<M>p<L>) #177

Open dschlaep opened 7 years ago

dschlaep commented 7 years ago

Taylor KE, Balaji V, Hankin S, Juckes M, Lawrence B, Pascoe S (2012) CMIP5 Data Reference Syntax (DRS) and Controlled Vocabularies. Version 1.3.1 (13 June 2012).

dschlaep commented 7 years ago

Current behavior as of commit a25e1d5f1fbaf95bdedff8fa504486c04819e9a2:

The function get_GCMdata_netCDF calls extract_variable_netCDF with the argument

filepath = dots[["ncFiles"]][temp1][1]

This means that data from the alphabetically sorted first ensemble member is extracted if multiple members' data are available, e.g.,

[1] "pr_Amon_CSIRO-Mk3L-1-2_historical_r1i1p1_185101-200012.nc" [2] "pr_Amon_CSIRO-Mk3L-1-2_historical_r1i2p1_185101-200512.nc" [3] "pr_Amon_CSIRO-Mk3L-1-2_historical_r2i2p1_185101-200512.nc" [4] "pr_Amon_CSIRO-Mk3L-1-2_historical_r3i2p1_185101-200512.nc"

The sorting is because of the command list.files:

The files are sorted in alphabetical order, on the full path if full.names = TRUE.

This means also that if we had two files of the same ensemble member but with different time periods, then the alphabetically first one would be selected -- even if it contains the shorter time period, e.g.,

[1] "pr_Amon_CSIRO-Mk3L-1-2_historical_r1i1p1_185101-200012.nc" [2] "pr_Amon_CSIRO-Mk3L-1-2_historical_r1i1p1_185101-200512.nc"