๐ด downshape is an R research compendium exposing functions to search, download, preprocess and bias-adjust CMIP6 data discovered via the ESGF Search RESTful API. Major preprocess step made with CDO swofware. This compendium allow to download observed data come from Copernicus website or other website with URL of variable. We can choose to download bathymetry variable come from CDO.
graph LR
subgraph Graph
direction LR
xb5a86a9ebe0b7b97(["ano_vars"]):::uptodate --> x9b87618f04cad4de(["anomaly"]):::outdated
xd2707862cf793d3a(["connectPip_copernicus"]):::outdated --> x9b87618f04cad4de(["anomaly"]):::outdated
xd2707862cf793d3a(["connectPip_copernicus"]):::outdated --> x37179b61a203cbd3(["grad_copernicus"]):::outdated
xb5817e1daca13dcc(["bathy_vars"]):::uptodate --> xe44467b2b079fc18(["renameVar_copernicus"]):::outdated
x35b468daf9281b76(["http_data"]):::uptodate --> xe44467b2b079fc18(["renameVar_copernicus"]):::outdated
xd7bca5ba4e5f539d(["obs_data"]):::outdated --> xe44467b2b079fc18(["renameVar_copernicus"]):::outdated
xd15c82dcb79a7c2e(["renameVar"]):::uptodate --> xe44467b2b079fc18(["renameVar_copernicus"]):::outdated
xec6283d15a25ed08(["remapCDO_copernicus"]):::outdated --> xd2707862cf793d3a(["connectPip_copernicus"]):::outdated
x9289bfb53112cf3b(["concatenate_copernicus"]):::outdated --> xec6283d15a25ed08(["remapCDO_copernicus"]):::outdated
xd15c82dcb79a7c2e(["renameVar"]):::uptodate --> xec6283d15a25ed08(["remapCDO_copernicus"]):::outdated
xfc6ed28680e5db72(["speedCompo_copernicus"]):::outdated --> xec6283d15a25ed08(["remapCDO_copernicus"]):::outdated
xca459201a27e8460(["vars_speed"]):::uptodate --> xec6283d15a25ed08(["remapCDO_copernicus"]):::outdated
x9289bfb53112cf3b(["concatenate_copernicus"]):::outdated --> xfc6ed28680e5db72(["speedCompo_copernicus"]):::outdated
xca459201a27e8460(["vars_speed"]):::uptodate --> xfc6ed28680e5db72(["speedCompo_copernicus"]):::outdated
xe44467b2b079fc18(["renameVar_copernicus"]):::outdated --> x9289bfb53112cf3b(["concatenate_copernicus"]):::outdated
x4301c707c2ab0cdc(["tab_parameters"]):::uptodate --> xd7bca5ba4e5f539d(["obs_data"]):::outdated
x9b87618f04cad4de(["anomaly"]):::outdated --> x86e690a15fc5d647(["regrid_copernicus"]):::outdated
x37179b61a203cbd3(["grad_copernicus"]):::outdated --> x86e690a15fc5d647(["regrid_copernicus"]):::outdated
x71e926299248ce3f(["http_vars"]):::uptodate --> x35b468daf9281b76(["http_data"]):::uptodate
xf5c6fd225c377a3d(["bathy_CDO"]):::uptodate --> xb5817e1daca13dcc(["bathy_vars"]):::uptodate
x21b09bf88a2ff147(["baseline_period"]):::uptodate --> x21b09bf88a2ff147(["baseline_period"]):::uptodate
x084994fb0e480676(["current_period"]):::uptodate --> x084994fb0e480676(["current_period"]):::uptodate
x625f066a5f205ec8(["deep_level"]):::uptodate --> x625f066a5f205ec8(["deep_level"]):::uptodate
xac02e5e58926353b(["experiments"]):::uptodate --> xac02e5e58926353b(["experiments"]):::uptodate
x55a14a7f5821bbec(["resotempo"]):::uptodate --> x55a14a7f5821bbec(["resotempo"]):::uptodate
xe73cbbcc20086ecd(["spat_reso"]):::uptodate --> xe73cbbcc20086ecd(["spat_reso"]):::uptodate
end
- 1๏ธโฃ Import files necessary into data folder (information bellow)
- 2๏ธโฃ Edit targets of *_targets.R* file into project parameters part and check if all โskipโ argument into targets function are โFALSEโ (or โTRUEโ if you want skip some targets).
- 3๏ธโฃ Select the part the part of *_targets.R* script you want run. Commit all targets of the part not used. Itโs impossible to run the two parts in same time.
- 4๏ธโฃ Run pipeline launching make.R script
| Columns database | Description |
|---|---|
| my_variable_name | Your variable name (outside api command). Each name must be unique |
| dataset_id | Check on Copernicus website |
| dataset_version | Check API request on Copernicus website |
| longitude_min | Extend of map downloaded |
| longitude_max | Extend of map downloaded |
| latitude_min | Extend of map downloaded |
| latitude_max | Extend of map downloaded |
| date_min | Date. Format Year-Month-Day hours:minutes:seconds (2017-11-25 12:20:00) |
| date_max | Date. Format Year-Month-Day hours:minutes:seconds (2017-11-25 12:20:00) |
| depth_min | Numeric. Depth in meters. If you want to download one depth layer, same value for โdepth_minโ and โdepth_maxโ. If itโs a 3D variable (with depth dimension) the depth must be provided otherwise leave the cell empty |
| depth_max | Numeric. Depth in meters. If you want to download one depth layer, same value for โdepth_minโ and โdepth_maxโ. If itโs a 3D variable (with depth dimension) the depth must be provided otherwise leave the cell empty |
| variable | Short name of variable downloaded. If several variable by product create one line by variable in the table |
| DOI | Check on Copernicus website |
heavy_check_mark: [copernicus_parameters.csv]: CSV file. Parameters of the data we wish to download, with one row per variable to be downloaded. Please refer to the table structure requirements below. If a variable is large, the Copernicus API may not be able to download it, and it will be necessary to divide the variable into several smaller time periods (use the โdivideโ, โsubvarโ, and โseptimeโ arguments of the copernicus_download_api() function). If a parameter in this table does not exist for your product (for example: depth), simply leave the cell empty. Columns โdate_minโ and โdate_maxโ must be equal to or later than the current_period target (in the _targets.R file). To create a baseline for applying the change factor method to a CMIP variable, there must be an overlap between โdate_minโ-โdate_maxโ and the historical_period target.
โ๏ธ [Mask_PA_variable.shp] : Shapefile. Mask of study area to crop environmental rasters with CDO. This shapefile will be convert to NETCDF file with gdal before being used by CDO.
โ๏ธ [experiments] : To select ssp scenario downloaded (check on esgf website menu)
โ๏ธ [vars] : To select cmip6 variables want to download (check on esgf website menu). Add component and speed variables (the both) there are into โvars_speed_cmipโ target.
โ๏ธ [freq] : To select frequence of cmip6 variables want to download (check on esgf website menu).
โ๏ธ [historical_period] : List start and end time. To define min and max time borns of cmip6 data historical period (cdo format: โYYYY-MM-DDThh:mm:ssโ). Complet ssp โhistoricalโ period would you like. It must existe a time overlap with time_span target. Into CMIP6 ssp โhistoricalโ stop at 2014 years, but to match baseline and ssp โhistoricalโ periods itโs necessary to merge historical and a short ssp periods (itโs the goal of mergeHistorical_cmip function).
โ๏ธ [future_period] : List start and end time. To define min and max time borns of cmip6 data future period (cdo format: โYYYY-MM-DDThh:mm:ssโ). Complet ssp period would you like (without ssp โhistoricalโ). It must existe a time overlap with time_span target (period downloaded) and entire overlap with baseline_period target (to create same period between baseline and historical). โstartโ vector correspond at โendโ vector of historical_period target +1 day.
โ๏ธ [time_span] : To select min and max time of cmip6 variables downloaded (format example:โ1982-01-01T00:00:00Zโ). It must existe a time overlap with historical_period and future_period targets. If you want to apply change factor method, min born correspond to min born of historical_period target and max born corespond to max born of future_period target.
โ๏ธ [vars_speed_cmip] : Same informations of vars_speed target but for cmip6 variables. All vectors of this target list can to be empty.
โ๏ธ [climato_period] : List of vectors. Allow to name and define climatology periods use to apply change factor method (climatology on cmip6 ssp). โnameโ vector is how will be called climatology period and correspond to โstartโ and โendโ vector define time bornes of climatology period (cdo format: โYYYY-MM-DDThh:mm:ssโ). โmonth_chooseโ vector allow to choose month conserved into the climatology mean calcul (used into mean_month() function). It must existe a time overlap with future_period target.
โ๏ธ [resotempo] : Give temporal resolution of all variable (copernicus or cmip or both) you want to mean by week with remapCDO(โฆ, monthWeek = โweekโ). Complete โresoโ list with โweekโ (if variable have one layer by week), โdayโ (if variable have one layer by day), โmonthโ (one by month), โhour1โ (one by one hour), โhour6โ (one by 6 hours), โFIXEโ one layer for all NetCDF file. Into โvarsโ list given variable name into โmy_variable_nameโ column of parameters_copernicus.csv (same of โtabnameโ into [renameVar]). For speed variables give the output variable names inside [vars_speed] (called โnameโ). If BATHY variable are create with [bathy_CDO], add โBATHYโ with โFIXEโ in this target.
โ๏ธ [http_vars] : List. List of download path (NetCDF file) and variable names. First (or n) element of โhttpโ vector correspond to first (or n) element of โnameโ vector. โNameโ vector will be the name used to rename file name of variable. To download variables outsite copernicus website. Leave empty if not used.
โ๏ธ [current_period] : List start and end time. To define min and max time of copernicus data current period (cdo format: โYYYY-MM-DDThh:mm:ssโ). Allow to calibrate model (weekly temporal resolution) and create current projection (monthly temporal resolution). This period must overlap all variable periods downloaded into copernicus_parameters.csv.
โ๏ธ [baseline_period] : List start and end time. Complet this target if you want create a baseline to apply change factor method, otherwise write โNULLโ into โstartโ and โendโ arguments. It allow to define min and max time borns of baseline period (cdo format: โYYYY-MM-DDThh:mm:ssโ).
โ๏ธ [match_name] : List of two vectors. Allow to correspondance between โcopernicusโ and โcmipโ variables during calcul of delta in change factor method. List uniquelly variables you want bias-corrected. These vectors must to contain all variables name create during process (variable processed by speed_vars and deep_level targets).
โ๏ธ [spat_reso] : List of number. Spatial resolution of initial variables is degraded to โresoโ degrees resolution (resolution must be higher than all initial resolutions). All variables are interpolated because their grids must match, so you must specify the number of rows and columns of the new grid, โgrid_nrowโ and โgrid_ncolโ respectively.
โ๏ธ [deep_level] : List start and end deep level by file created. To split variable to several files by deep level. First (or n) element of โstartโ vector correspond to first (or n) element of โendโ vector. vectors of the list can be empty.
โ๏ธ [renameVar] : List of โmy_variable_nameโ column value into โcopernicus_parameters.csvโ table and new name you want inside netcdf file. First (or n) element of โtabnameโ vector correspond to first (or n) element of โnewnameโ vector. Allow to rename into NETCDF file the variable juste after downloading step. This vectors gathers all variable names used to rename cmip6 and copernicus data just after download step. In others words, it allows to change name of โvariableโ column into parameters_copernicus.csv and โVariable_idโ column into selected_datasets.csv for cmip6 data. If variable name have a name with โ_โ,โ-โ,โ#โ,โ โ, use this target to rename with one word without specials characters (otherwise CDO command doesnโt work). All vectors of this target list can to be empty. If bathymetry is downloaded by downloadCDO_bathy() it will be calledโBATHYโ and variable name inside the NetCDF file will be not rename (called โtopoโ).
โ๏ธ [vars_speed] : List first, second components and output variable name to calcul copernicus variables speed with two components. First (or n) element of โcompo1โ vector correspond to first (or n) element of โcompo2โ vector. All variables must have unique component names. The first and second vector give the variable names into โmy_variable_nameโ column of parameters_copernicus.csv (same of โtabnameโ into [renameVar]). The last vector (โnameโ) give the new name of speed variable created.
โ๏ธ [bathy_CDO] : Logical. If โTRUEโ bathymetry variable from CDO are downloaded into โdata_copernicusโ folder. The name of variable is โtopo_cdo_NOAA_ETOPO2_2006_brut.ncโ. If โFALSEโ bathymetry doesnโt downloaded.
โ๏ธ [ano_vars] : character. Name of the variable with which you want to calculate the anomaly. This calculation utilizes the climatology data for the same variable (create manually into data folder), and the filename of the climatology file must match the variable name in the output folder according to the following format. Monthly and weekly climatology must to be availables: โSST0x100_climatology_XX_XXX_week.ncโ and โSST0x100_climatology_XX_XXX_month.ncโ. NetCDF and GRD extension are supported.
๐ฉ If you want skip copernicus_download_api() function : You can put variables (.nc) into folder โoutput/data_copernicusโ with file called โcopernicus_parameters_modifiedโ create during downloading data. Variable want to be named NameVar_XXXX_XXX_XXX_XXXX_DateBegining-DateFinal.nc..
๐ฉ If you want skip download_cmip_data() function : You can put variables (.nc) into folder โoutput/data_cmip6โ with subfolders by model and experiment. Variable want to be named NameVar_XXXX_model_experiment_XXXX_XXX_DateBegining-DateFinal.nc.
โน๏ธ Variable with โ1x100โ, โ0x1โ, etcโฆ into file name are integrated (depth mean) between values before and after the โxโ. Variable file without โxโ pattern into number are integrated on all depth available (if depth are available for the variable).
- ๐ output โ[make.r]โ
- ๐ dataset_found_before_filter.csv โ[select_dataset()]โ
- ๐ selected_datasets.csv โ[select_dataset()]โ
- ๐ data_cmip6 โ[download_cmip_data()]โ
- ๐ Model_name_download
โ[download_cmip_data()]โ
- ๐ Experiment_name_download
โ[download_cmip_data()]โ
- ๐ ModelName_ExperimentName_VarsName.sh โ[download_cmip_data()]โ
- ๐ Vars1.nc โ[download_cmip_data()]โ
- ๐ Vars2.nc โ[download_cmip_data()]โ
- ๐ VarsX.nc โฆ โ[download_cmip_data()]โ
- ๐ Experiment_name_download
โ[download_cmip_data()]โ
- ๐ Model_name_download
โ[download_cmip_data()]โ
- ๐ data_cmip6_change_factor โ[climato_cmip()]โ
- ๐ climatology โ[climato_cmip()]โ
- ๐ Name_climatology (ex : 2030)
- ๐ Model_name_download
- ๐ Experiment_name_download
- ๐ Vars1.grd
- ๐ Vars2.grd
- ๐ VarsX.grd โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.grd
- ๐ Experiment_name_download
- ๐ Model_name_download
- ๐ Name_climatology (ex : 2030)
- ๐ historical_ssp_merged
โ[mergeHistorical_cmip()]โ
- ๐ Model_name_download
- ๐ Experiment_name_download
- ๐ Vars1.grd
- ๐ Vars2.grd
- ๐ VarsX.grd โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.grd
- ๐ Experiment_name_download
- ๐ Model_name_download
- ๐ variables_bias-corrected โ[deltaCF()]โ
- ๐ Name_climatology (ex : 2030)
- ๐ Model_name_download
- ๐ Experiment_name_download
- ๐ Vars1.grd
- ๐ Vars2.grd
- ๐ VarsX.grd โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.grd
- ๐ Experiment_name_download
- ๐ Model_name_download
- ๐ Name_climatology (ex : 2030)
- ๐ variables_bias-corrected_mean โ[meanMod()]โ
- ๐ Name_climatology (ex : 2030)
- ๐ Experiment_name_download
- ๐ Gradient โ[grad_cmip()]โ
- ๐ Vars1.grd
- ๐ Vars2.grd
- ๐ VarsX.grd โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.grd
- ๐ Experiment_name_download
- ๐ Name_climatology (ex : 2030)
- ๐ climatology โ[climato_cmip()]โ
- ๐ data_cmip6_remapped โ[remapCDO_cmip()]โ
- ๐ Model_name_download โ[remapCDO_cmip()]โ
- ๐ Experiment_name_download
โ[remapCDO_cmip()]โ
- ๐ Vars1.nc โ[remapCDO_cmip()]โ
- ๐ Vars2.nc โ[remapCDO_cmip()]โ
- ๐ VarsX.nc โฆโ[remapCDO_cmip()]โ
- ๐ VarsDepth1x100.nc โฆโ[remapCDO_cmip()]โ
- ๐ Vars_speed.nc โ[speedCompo_cmip()]โ
- ๐ Experiment_name_download
โ[remapCDO_cmip()]โ
- ๐ Model_name_download โ[remapCDO_cmip()]โ
- ๐ data_copernicus โ[copernicus_download_api()]โ
- ๐ copernicus_parameters_modified.csv โ[copernicus_download_api()]โ
- ๐ Vars1.nc โ[copernicus_download_api()]โ
- ๐ Vars2.nc โ[copernicus_download_api()]โ
- ๐ VarsX.nc โฆ โ[copernicus_download_api()]โ
- ๐ data_copernicus_remapped
โ[remapCDO_copernicus()]โ
- ๐ month
- ๐ Vars1.nc โ[remapCDO_copernicus()]โ
- ๐ Vars2.nc โ[remapCDO_copernicus()]โ
- ๐ VarsX.nc โฆโ[remapCDO_copernicus()]โ
- ๐ VarsDepth1x100.nc โ[remapCDO_copernicus()]โ
- ๐ Vars_speed.nc โ[speedCompo_copernicus()]โ
- ๐ GRD โ[connectPip()]โ
- ๐ Vars1.nc
- ๐ Vars2.nc
- ๐ VarsX.nc โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.nc
- ๐ Gradient โ[grad_copernicus()]โ
- ๐ GVars1.nc
- ๐ GVars2.nc
- ๐ GVarsX.nc โฆ
- ๐ GVarsDepth1x100.nc
- ๐ GVars_speed.nc
- ๐ week
- ๐ Vars1.nc โ[remapCDO_copernicus()]โ
- ๐ Vars2.nc โ[remapCDO_copernicus()]โ
- ๐ VarsX.nc โฆ โ[remapCDO_copernicus()]โ
- ๐ VarsDepth1x100.nc โ[remapCDO_copernicus()]โ
- ๐ Vars_speed.nc โ[speedCompo_copernicus()]โ
- ๐ GRD โ[connectPip()]โ
- ๐ Vars1.nc
- ๐ Vars2.nc
- ๐ VarsX.nc โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.nc
- ๐ Gradient โ[grad_copernicus()]โ
- ๐ GVars1.nc
- ๐ GVars2.nc
- ๐ GVarsX.nc โฆ
- ๐ GVarsDepth1x100.nc
- ๐ GVars_speed.nc
- ๐ baseline
- ๐ Vars1.nc โ[remapCDO_copernicus()]โ
- ๐ Vars2.nc โ[remapCDO_copernicus()]โ
- ๐ VarsX.nc โฆ โ[remapCDO_copernicus()]โ
- ๐ VarsDepth1x100.nc โ[remapCDO_copernicus()]โ
- ๐ Vars_speed.nc โ[speedCompo_copernicus()]โ
- ๐ GRD โ[connectPip()]โ
- ๐ Vars1.nc
- ๐ Vars2.nc
- ๐ VarsX.nc โฆ
- ๐ VarsDepth1x100.nc
- ๐ Vars_speed.nc
- ๐ Gradient โ[grad_copernicus()]โ
- ๐ GVars1.nc
- ๐ GVars2.nc
- ๐ GVarsX.nc โฆ
- ๐ GVarsDepth1x100.nc
- ๐ GVars_speed.nc
- ๐ month
- ๐ data_copernicus_final (Same sub-folder as data_copernicus_remapped) โ[regrid_copernicus()]โ
- ๐ data_copernicus_final (Same sub-folder as data_cmip6_remapped) โ[regrid_cmpi()]โ
