# ESMValTool
# recipe_ocean_multimap.yml
---
documentation:
  description: |
    Recipe to evaluate multiple model bias against a reference dataset
    Written by Tomas Lovato, CMCC, tomas.lovato@cmcc.it

  authors:
    - lovato_tomas
  
  maintainer:
    - lovato_tomas

  references:
    - acknow_project

  projects:
    - crescendo

# --------------------------------------------------
# Datasets
# --------------------------------------------------
DATASET_ANCHOR_SO: &datasets_so
   - {dataset: NorESM2-LM, project: CMIP6, exp: historical, ensemble: "r1i1p1f1", grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: NorESM2-MM, project: CMIP6, exp: historical, ensemble: "r1i1p1f1", grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: NorESM2-MM, project: KeyCLIM, exp: hist-piAerOxid, ensemble: r1i1p1f1, grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: NorESM2-MM, project: KeyCLIM, exp: hist-snow, ensemble: r1i1p1f1, grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: NorESM2-MM, project: KeyCLIM, exp: hist-iceSheet, ensemble: r1i1p1f1, grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: NorESM2-MM, project: KeyCLIM, exp: hist-cloud, ensemble: r1i1p1f1, grid: gr, start_year: 1995, end_year: 2014}
   - {dataset: WOA,  project: OBS6,  type: clim, version: 2018,  start_year: 2000,  end_year: 2000,  tier: 2}

#SELECT_REGION: &select_region 
   #- { start_longitude: -95., end_longitude: -70., start_latitude:  -45., end_latitude: 12. } # South east Pacific
   #- { start_longitude: 324., end_longitude: 357., start_latitude:  30., end_latitude: 57. } # EU Atlantic
   #- { start_longitude: -12., end_longitude:  38., start_latitude: 29.5, end_latitude: 48. } # Mediterranean
   #- { start_longitude:   0., end_longitude: 360., start_latitude:  60., end_latitude: 90. } # Arctic

# Climatological time window selection
# --------------------------------------------------
SELECT_CLIMA: &select_clima
   - { start_year: 1995, start_month: 1, start_day: 1, end_year: 2014, end_month: 12, end_day: 31 }

# Select level for 3D variable
# --------------------------------------------------
SELECT_LEVEL: &select_level
   - {levels:  [0.,100.,500.,1000.,1500.] , scheme: linear_horizontal_extrapolate_vertical}

# --------------------------------------------------
# Preprocessors
# --------------------------------------------------
preprocessors:
  # --------------------------------------------------
  # MAP preprocessors
  # --------------------------------------------------
  prep_map_2D:
    custom_order: true
    extract_time:
      <<: *select_clima
    climate_statistics:
      operator: mean
    regrid:
      target_grid: 1x1
      scheme: linear
#    extract_region:
#      <<: *select_region

  prep_map_3D:
    custom_order: true
    extract_time:
      <<: *select_clima
    extract_levels:
      <<: *select_level
    climate_statistics:
      operator: mean
    regrid:
      target_grid: 1x1
      scheme: linear
#    extract_region:
#      <<: *select_region

# --------------------------------------------------
# Diagnostics
# --------------------------------------------------
diagnostics:

  maps_WOA_so:
    description: Ocean maps vs OBS
    additional_datasets: *datasets_so
    variables:
      so:
        preprocessor: prep_map_3D
        mip: Omon
        plot_ccrs: PlateCarree
        layout_rowcol: [2, 3]
        diff_range: [-2.5, 2.5]
#        exclude_datasets: ['MIROC-ES2L']
    scripts:
      model_vs_obs:
        script: ocean/diagnostic_maps_multimodel_KeyCLIM.py
        observational_dataset: {dataset: WOA, project: OBS6}



