---
_field: &_field

  style:
    type: enum
    values:
    - [dissemination]

  class:
    category: data
    defaults:
      - vals: [od]
    flatten: false
    type: enum
    values:
      - [a5, ECMWF Atmospheric Composition reanalysis version 5]
      - [ai, operational aifs]
      - [at, austria]
      - [be, belgium]
      - [c3, c3s]
      - [ce, cems]
      - [ch, switzerland]
      - [ci, cerise]
      - [co, cosmo]
      - [cr, cams research]
      - [cs, ecsn]
      - [d1, destine]
      - [de, germany]
      - [dk, denmark]
      - [dm, demeter]
      - [dt, dts]
      - [e2, e20c]
      - [e4, reanalyse40]
      - [e6, era6]
      - [ea, era5, esat]
      - [ed, eerie]
      - [ef, efas]
      - [eh, c3s europe]
      - [ei, era interim]
      - [el, eldas]
      - [em, e20cm]
      - [en, ensembles]
      - [ep, cera-20c, cera20c]
      - [er, reanalyse]
      - [es, spain]
      - [et, cera-sat, cerasat]
      - [fi, finland]
      - [fr, france]
      - [gf, glofas]
      - [gg, greenhouse gases]
      - [gh, c3s global]
      - [gr, greece]
      - [gw, global wildfire information system]
      - [hr, croatia]
      - [hu, hungary]
      - [ie, ireland]
      - [is, iceland]
      - [it, italy]
      - [j5, jra55]
      - [l5, era5l]
      - [l6, era6l]
      - [la, aladin-laef, laef, lace]
      - [lr, WMO Lead Centre for Global Climate Re-Analyses]
      - [lw, WMO lead centre wave forecast verification]
      - [ma, metaps]
      - [mc, macc]
      - [me, mersea]
      - [ml, machine learning]
      - [ms, member states]
      - [ng, nextgems]
      - [nl, netherlands]
      - ['no', norway]
      - [nr, ncep 20cr, 20cr]
      - [o6, 'ocean 6 reanalysis']
      - [od, operations]
      - [pe, permanent experiment]
      - [pt, portugal]
      - [pv, provost]
      - [rd, research]
      - [rm, euro4m]
      - [rr, regional reanalysis]
      - [s2, s2s]
      - [se, sweden]
      - [si, slovenia]
      - [sr, sreps]
      - [te, test]
      - [ti, tigge]
      - [to, tost]
      - [tr, turkey]
      - [uk, united kingdom]
      - [ul, ulysses]
      - [ur, uerra]
      - [yp, yopp]
      - [yt, yotc]

  type:
    category: data
    defaults:
      - vals: [an]
    flatten: false
    type: enum
    values:
      - [3g, 3d variational gradients]
      - [3v, 3d variational analysis]
      - [4g, 4d variational gradients]
      - [4i, 4d variational increments]
      - [4v, 4d variational analysis]
      - [ab, analysis bias]
      - [af, analysis feedback]
      - [ai, analysis input]
      - [an, analysis]
      - [as, adjoint singular vector]
      - [bf, bias-corrected forecast]
      - [cd, climate distribution]
      - [cf, control forecast]
      - [ci, clustering information]
      - [cl, climatology]
      - [cm, cluster means]
      - [cpf, crossing-point forecast]
      - [cr, cluster representative]
      - [cs, cluster std deviations]
      - [cv, calibration validation forecast]
      - [ea, errors in analysis]
      - [ed, empirical distribution]
      - [ef, errors in first guess]
      - [efi, extreme forecast index]
      - [efic, extreme forecast index control]
      - [em, ensemble mean]
      - [emdn, ensemble median]
      - [eme, ensemble data assimilation model errors]
      - [emtm, ensemble mean of temporal mean]
      - [ep, event probability]
      - [es, ensemble standard deviation]
      - [est, ensemble statistics]
      - [estdtm, ensemble standard deviation of temporal mean]
      - [fa, forecast accumulation]
      - [fb, feedback]
      - [fc, forecast]
      - [fcdfb, forecast departures feedback]
      - [fcmax, forecast maximum]
      - [fcmean, forecast mean]
      - [fcmin, forecast minimum]
      - [fcstdev, forecast standard deviation]
      - [ff, flux forcing realtime]
      - [fg, first guess]
      - [fp, forecast probability]
      - [fsoifb, forecast sensitivity to observations impact feedback]
      - [fu, fill-up]
      - [fx, flux forcing]
      - [ga, gfas analysis]
      - [gbf, bias-corrected gridbox]
      - [gai, gridded analysis input]
      - [go, gridded observations]
      - [gsd, gridded satellite data]
      - [gwt, weather type gridbox]
      - [hcmean, hindcast mean]
      - [ia, init. analysis]
      - [icp, initial condition perturbation]
      - [mpp, model physics perturbation]
      - [if, interim forecast]
      - [im, images]
      - [me, model errors]
      - [mfb, mondb feedback]
      - [oai, odb analysis input]
      - [ob, observations]
      - [of, ocean forward]
      - [ofa, odb feedback from analysis]
      - [ofb, odb feedback]
      - [oi, oi analysis]
      - [oldim, old format images]
      - [or, ocean reanalysis]
      - [pa, perturbed analysis]
      - [pb, probability boundary]
      - [pd, probability distribution]
      - [pf, perturbed forecast]
      - [pfc, point values]
      - [ppm, point value metrics]
      - [s3, climate 30 days simulation]
      - [ses, scaled ensemble standard deviation]
      - [sf, sensitivity forecast]
      - [sfb, summary feedback]
      - [sfo, simulations with forcing]
      - [sg, sensitivity gradient]
      - [si, climate simulation]
      - [sim, simulated images]
      - [sot, shift of tails]
      - [ssd, simulated satellite data]
      - [sv, singular vector]
      - [svar, signal variance]
      - [taem, time average ensemble mean]
      - [taes, time average ensemble standard deviation]
      - [tpa, time processed analysis]
      - [tf, trajectory forecast]
      - [tu, tube]
      - [wem, weighted ensemble mean]
      - [wes, weighted ensemble standard deviation]
      - [wp, weather parameters]

  stream:
    category: data
    flatten: false
    type: enum
    values:
      - [amap, analysis for multianalysis project]
      - [ammc, melbourne]
      - [cher, ch, chernobyl]
      - [clte, climate, Climate run output]
      - [clmn, climate-monthly, Climate run monthly means output]
      - [cnrm, meteo france climate centre]
      - [cwao, montreal]
      - [dacl, daily climatology]
      - [dacw, daily climatology wave]
      - [dahc, daily archive hindcast]
      - [dame]
      - [dcda, atmospheric model (delayed cutoff)]
      - [dcwv, wave model (delayed cutoff)]
      - [edmm, ensemble data assimilation monthly means]
      - [edmo, ensemble data assimilation monthly means of daily means]
      - [edzw, offenbach]
      - [eefh, extended ensemble forecast hindcast]
      - [eefo, extended ensemble prediction system]
      - [eehs, extended ensemble forecast hindcast statistics]
      - [efas, european flood awareness system (efas)]
      - [efcl, european flood awareness system (efas) climatology]
      - [efhc, ensemble forecast hindcasts (obsolete)]
      - [efho, ensemble forecast hindcast overlap]
      - [efhs, ensemble forecast hindcast statistics]
      - [efov, ensemble forecast overlap]
      - [efrf, european flood awareness system (efas) reforecasts]
      - [efse, european flood awareness system (efas) seasonal forecasts]
      - [efsr, european flood awareness system (efas) seasonal reforecasts]
      - [egrr, exeter, bracknell]
      - [ehmm, combined multi-model hindcast monthly means]
      - [elda, ensemble long window data assimilation]
      - [enda, ensemble data assimilation]
      - [enfh, ensemble forecast hindcasts]
      - [enfo, ef, ensemble prediction system]
      - [enwh, ensemble forecast wave hindcasts]
      - [esmm, combined multi-model monthly means]
      - [espd, ensemble supplementary data]
      - [ewda, ensemble wave data assimilation]
      - [ewhc, wave ensemble forecast hindcast (obsolete)]
      - [ewho, ensemble forecast wave hindcast overlap]
      - [ewla, ensemble wave long window data assimilation]
      - [ewmm, ensemble wave data assimilation monthly means]
      - [ewmo, ensemble wave data assimilation monthly means of daily means]
      - [fgge, fg]
      - [fsob, forecast sensitivity to observations]
      - [fsow, forecast sensitivity to observations wave]
      - [gfas, global fire assimilation system]
      - [gfra, global fire assimilation system reanalysis]
      - [kwbc, washington]
      - [ldas, land data-assimilation system (near real time)]
      - [ldbt, land data-assimilation system behind real time]
      - [ldsb, land data-assimilation system statistics behind real time]
      - [ldst, land data-assimilation system statistics (near real time)]
      - [lfpw, paris, toulouse]
      - [lwda, long window daily archive]
      - [lwwv, long window wave]
      - [ma, means archive]
      - [maed, multianalysis ensemble data]
      - [mawm, wave anomaly means]
      - [mawv, multianalysis wave data]
      - [mdfa, monthly means of daily forecast accumulations]
      - [mfam, anomaly means]
      - [mfaw, wave anomalies]
      - [mfhm, hindcast means]
      - [mfhw, monthly forecast hindcasts wave]
      - [mfwm, wave real-time means]
      - [mhwm, wave hindcast means]
      - [mmaf, multi-model multi-annual forecast]
      - [mmam, multi-model multi-annual forecast means]
      - [mmaw, multi-model multi-annual forecast wave]
      - [mmsa, multi-model seasonal forecast monthly anomalies]
      - [mmsf, multi-model seasonal forecast]
      - [mmwm, multi-model multi-annual forecast wave means]
      - [mnfa, anomalies]
      - [mnfc, real-time]
      - [mnfh, hindcasts]
      - [mnfm, real-time means]
      - [mnfw, wave real-time]
      - [mnth, mo, monthly, monthly means]
      - [mnvr, monthly variance and covariance data using g. boer's step function]
      - [moda, monthly means of daily means]
      - [mofc, monthly forecast]
      - [mofm, monthly forecast means]
      - [monr, monthly means using g. boer's step function]
      - [mpic, max plank institute]
      - [msda, monthly standard deviation and covariance of daily means]
      - [msdc, mv, monthly standard deviation and covariance]
      - [msmm, multi-model seasonal forecast atmospheric monthly means]
      - [mswm, multi-model seasonal forecast wave monthly means]
      - [ocda, ocean data assimilation]
      - [ocea, ocean]
      - [olda, ocean Long window data assimilation]
      - [oper, da, daily archive, atmospheric model]
      - [rjtd, tokyo]
      - [rfsd, retrospective forcing and simulation data]
      - [scda, atmospheric model (short cutoff)]
      - [scwv, wave model (short cutoff)]
      - [seap, sensitive area prediction]
      - [seas, seasonal forecast]
      - [sens, sf, sensitivity forecast]
      - [sfdd, seasonal forecast daily and sub-daily data]
      - [sfdp, seasonal forecast derived products]
      - [sfmd, seasonal forecast monthly data]
      - [sfmm, seasonal forecast atmospheric monthly means]
      - [shdd, seasonal hindcast daily and sub-daily data]
      - [shdp, seasonal hindcast derived products]
      - [shmd, seasonal hindcast monthly data]
      - [smma, seasonal monthly means anomalies]
      - [sttd, Statistics of deterministic data]
      - [stte, Statistics of ensemble data]
      - [supd, sd, deterministic supplementary data]
      - [swmm, seasonal forecast wave monthly means]
      - [toga, tg]
      - [ukmo, ukmo climate centre]
      - [waef, we, wave ensemble forecast]
      - [wamd, wave monthly means of daily means]
      - [wamf, wave monthly forecast]
      - [wamo, wave monthly means]
      - [wams, multi-model seasonal forecast wave]
      - [wasf, wave seasonal forecast]
      - [wave, wv, wave model]
      - [wavm, wave model (standalone)]
      - [weef, wave extended ensemble forecast]
      - [weeh, wave extended ensemble forecast hindcast]
      - [wees, wave extended ensemble forecast hindcast statistics]
      - [wehs, wave ensemble forecast hindcast statistics]
      - [weov, wave ensemble forecast overlap]
      - [wfas, global flood awareness system (glofas)]
      - [wfcl, global flood awareness system (glofas) climatology]
      - [wfrf, global flood awareness system (glofas) reforecasts]
      - [wfse, global flood awareness system (glofas) seasonal forecasts]
      - [wfsr, global flood awareness system (glofas) seasonal reforecasts]
      - [wmfm, wave monthly forecast means]
      - [wvhc, wave hindcast]
      - [xwda, extended window data assimilation]

  product:
    category: data
    type: enum
    values:
      - [inst, instantaneous]
      - [tims, time-series]
      - [tavg, time-average]
      - [tacc, time-accumulation]

  section:
    category: data
    type: enum
    values:
      - [h, horizontal]
      - [v, vertical]
      - [z, zonal]
      - [m, meridional]

  range:
    category: data
    type: any

  use:
    flatten: false
    multiple: true
    type: enum
    values:
      - [frequent, f]
      - [infrequent, i]
      - [normal, n]
      - compare
      - [monthly run]
      - intent
      - disk
      # - [bc, boundary conditions]
      # - [monday, mon]
      # - [tuesday, tue]
      # - [wednesday, wed]
      # - [thursday, thu]
      # - [friday, fri]
      # - [saturday, sat]
      # - [sunday, sun]

  # product:
  # %if LEVTYPE = DP
  #       %and TYPE = OR
  #       %and (%not PRODUCT)
  #       %then
  #               %warning "Default PRODUCT for Ocean ReAnalysis set to Instantaneous"
  #               %set PRODUCT = INST


  expver:
    category: data
    flatten: false
    type: expver
    defaults:
      - vals: ['0001']

  dataset:
    category: data
    multiple: false
    type:
      - context:
          class: [d1]
        type: enum
        values:
        - [climate-dt, Climate change adaptation digital twin]
        - [extremes-dt, Weather and geophysical extremes digital twin]
        - [on-demand-climate-dt, On-demand climate change adaptation digital twin]
        - [on-demand-extremes-dt, On-demand weather and geophysical extremes digital twin]
      - type: lowercase

  model:
    category: data
    type:
      - context:
          class: [ms]
          country: [it]
        type: enum
        values:
          - [lm]
          - [hrm]
          - [wam]
      - context:
          class: [ti, lw, s2]
        type: enum
        values:
          - [lam]
          - [global, glob]
      - type: enum
        values:
          - [ecmf]
          - [edzw]
          - [egrr]
          - [lfpw]
          - [kwbc]
          - [none]
          - [hrm]
          - [ifs, IFS with no ocean model]
          - [ifs-nemo, IFS with NEMO ocean model]
          - [ifs-fesom, IFS with FESOM ocean model]
          - [icon, ICON-A with ICON-O ocean model]
          - [lisflood]
          - [lm]
          - [lam]
          - [aifs]
          - [aifs-single]
          - [aifs-single-mse]
          - [aifs-ens]
          - [aifs-ens-crps]
          - [aifs-ens-diff]
          - [aifs-subs]
          - [aifs-subs-crps]
          - [aifs-compo-single]
          - [aifs-compo-ens]
          - [aifs-compo-single-mse]
          - [aifs-compo-ens-crps]
          - [alaro]
          - [arome]
          - [harmonie-arome]
          - [global, glob]
          - [ecpoint]
          - [ecland]
          - [htessel-lisflood]
          - [hype]
          - [jules]
          - [mhm]
          - [pcr-globwb]
          - [vic-wur]

  forcing:
    category: data
    multiple: true
    type: enum
    values:
      - [ecmf-ifs]
      - [ecmf-aifs]
      - [ecmf-era5]
      - [ecmf-seas]
      - [edzw-icon]
      - [cosmo-cosmo]
      - [cmcc-sps]
      - [obs]

  configuration:
    category: data
    multiple: true
    type: enum
    values:
      - [v1.0]
      - [v1.0-catchment]
      - [v1.0-grid]
      - [v1.0-c3s]
      - [v2.0]
      - [v2.1]
      - [v3.0]
      - [v3.1]
      - [v3.5]
      - [v4.0]
      - [v5.0]
      - [v6.0]
      - [49r2-sfdd]
      - [50r1-oper]
      - [50r1-enfo]
      - [50r1-sfdd]
      - [50r2-oper]
      - [50r2-enfo]
      - [50r2-sfdd]

  georef:
    category: data
    type: lowercase

  repres:
    flatten: false
    multiple: false
    type: enum
    values:
      - [bu, 'bufr']
      - [sh, 'spherical harmonics']
      - [ll, 'lat long grid']
      - [gg, 'gaussian grid']
      - [sv, 'space view']
      - [og, 'ocean grid']
      - [np]
      - [rl]

  coeffindex:
    category: data
    multiple: true
    type: to-by-list
    by: 1
    unset:
      - context:
          type:
            op: '!'
            vals: [me, eme]

  obscutoff:
    category: data
    multiple: true
    type: time

  obsgroup:
    category: data
    multiple: true
    type: enum
    values:
      # - [conventional]
      - [sat, satellite]
      - [ers1]
      - [trmm]
      - [qscat]
      - [reo3] # reo3 needs to stay for compatibility
      # previously in "obsgroups.def"
      - [hirs, 1]
      - [amsua, 2]
      - [amsub, 3]
      - [mhs, 4]
      - [geos, 5]
      - [resat, 6]
      - [meris, 7]
      - [gpsro, 8]
      - [satob, 9]
      - [scatt, 10]
      - [ssmi_as, 11, SSMI ALL-SKY]
      - [iasi, 12]
      - [airs, 13]
      - [ssmis_as, 14, SSMIS ALL-SKY]
      - [tmi_as, 15, TMI ALL-SKY]
      - [amsre_as, 16, AMSRE ALL-SKY]
      - [conv, 17]
      - [smos, 19]
      - [windsat_as, 20, WINDSAT ALL-SKY]
      - [ssmi, 21]
      - [amsua_as, 22, AMSUA ALL-SKY]
      - [amsre, 23]
      - [tmi, 24]
      - [ssmis, 25]
      - [gbrad, 26]
      - [mwhs, 27]
      - [mwts, 28]
      - [mwri_as, 29, MWRI ALL-SKY]
      - [iras, 30]
      - [msu, 31]
      - [ssu, 32]
      - [vtpr1, 33]
      - [vtpr2, 34]
      - [atms, 35]
      - [resat_ak, 36, RESAT AVERAGING KERNELS]
      - [cris, 37]
      - [wave_ip, 38, WAVE INTEGRATED PARAMETERS]
      - [wave_sp, 39, WAVE SPECTRA]
      - [raingg, 40]
      - [sfc_ms, 41, SURFACE MULTISENSOR]
      - [amsr2_as, 42, AMSR-2 ALL-SKY]
      - [saphir_as, 43, SAPHIR ALL-SKY]
      - [amsub_as, 44, AMSUB ALL-SKY]
      - [mhs_as, 45, MHS ALL-SKY]
      - [dwl, 46, DOPPLER WIND LIDAR]
      - [iris, 47]
      - [alt, 48, Altimeter]
      - [aatsr, 49]
      - [atms_as, 50, ATMS ALL-SKY]
      - [gmi_as, 51, GMI ALL-SKY]
      - [godae_sst, 52, GODAE SEA SURFACE TEMPERATURES]
      - [atovs_ms, 53, ATOVS MULTISENSOR]
      - [atmospheric_composition, 54, ATMOSPHERIC COMPOSITION]
      - [non_sfc_ms, 55, NON-SURFACE MULTISENSOR]
      - [mwts2, 56]
      - [ssmi_1d, 57, SSMI 1DVAR TCWV CLOUDY-SKY]
      - [mwhs2_as, 58, MWHS2 ALL-SKY]
      - [ssmt2, 59]
      - [smap, 60]
      - [tovs_ms, 61, TOVS MULTISENSOR]
      - [cloud_r, 62, CLOUD REFLECTIVITY]
      - [cloud_l, 63, CLOUD LIDAR]
      - [satellite_lightning, 64, SATELLITE LIGHTNING]
      - [geos_vis, 65, GEOS VIS]
      - [oconv, 66]
      - [mwts3_as, 67, MWTS3 All-sky]
      - [giirs, 68]
      - [hiras, 69]
      - [tropics_as, 70, TROPICS All-sky]
      - [ssmt1, 71]
      - [ssmt1_as, 72, SSMT1 All-sky]
      - [mws_as, 73, MWS All-sky]
      - [mwiici_as, 74, MWIICI All-sky]
      - [aws_as, 75, AWS All-sky]
      - [leos_vis, 76, LEOS VIS]
      - [ssh, 77]
      - [sirs, 78]
      - [scr, 79]
      - [scams_as, 80, SCAMS All-sky]
      - [nems_as, 81, NEMS All-sky]
      - [amsr3_as, 82, AMSR-3 All-sky]
      - [irs, 83]
      - [iasi_ng, 84, IASI-NG]
      - [smap_as, 85, SMAP All-sky]
      - [ssmt2_as, 86, SSMT2 All-sky]
      - [test, 99]

  reportype:
    category: data
    type: any
    multiple: true

  # rdbprefix

  levtype:
    category: data
    aliases: [levtyp]
    defaults:
      - context:
          stream: ['!', dacw, dcwv, ewda, ewhc, ewla, ewmm, ewmo, lwwv, mawm, mawv, mfaw, mfhw, mfwm, mhwm, mnfw, mswm, scwv, swmm, waef, wamd, wamf, wamo, wams, wasf, wave, weef, weeh, wees, wehs, weov, wmfm, wvhc]
        vals: [pl]
      - context:
          stream: [dacw, dcwv, ewda, ewhc, ewla, ewmm, ewmo, lwwv, mawm, mawv, mfaw, mfhw, mfwm, mhwm, mnfw, mswm, scwv, swmm, waef, wamd, wamf, wamo, wams, wasf, wave, weef, weeh, wees, wehs, weov, wmfm, wvhc]
        vals: [sfc]
    flatten: false
    type: [enum, integer]
    values:
      - [cat, category]
      - [dp, depth]
      - [layer]
      - [al, abstract levels]
      - [ml, model levels]
      - [pl, pressure levels]
      - [fl, flight levels]
      - [hl, height levels]
      - [pt, potential temperature]
      - [pv, potential vorticity]
      - [sfc, surf, surface] # sl ??
      - [sol, surface other (multi)levels]
      - [wv, ocean wave]
      - [o2d, ocean surface]
      - [o3d, ocean model levels]


  levelist:
    category: data
    aliases: [leve,level,levellist]
    multiple: true
    type: to-by-list-float
    by: 1

  param:
    category: data
    aliases: [parameter,parameters]
    multiple: true
    type: param
    defaults:
      - vals: [129]

  chem:
    category: data
    multiple: true
    type: enum
    values: "chemids.yaml"

  wavelength:
    category: data
    multiple: true
    type: range 
    default: none

  timespan:
    category: data
    type: enum
    values:
    - [fs, from-start, fromstart]
    - [10m]
    - [15m]
    - [20m]
    - [30m]
    - [1h]
    - [3h]
    - [6h]
    - [12h]
    - [18h]
    - [24h]
    - [48h]
    - [72h]
    - [120h]
    - [168h]
    - [240h]
    - [360h]
    - [none, inst, instantaneous]
    default: none
    multiple: true

  stattype:
    category: data
    type: enum
    values:
    - [moav, monthly average]
    - [momn, monthly minimum]
    - [momx, monthly maximum]
    - [mosd, monthly standard-deviation]
    - [daac, daily accumulation]
    - [daav, daily average]
    - [damn, daily minimum]
    - [damx, daily maximum]
    - [dasd, daily standard-deviation]
    - [moav_daav, monthly average of daily average]
    - [moav_damn, monthly average of daily minimum]
    - [moav_damx, monthly average of daily maximum]
    - [moav_dasd, monthly average of daily standard-deviation]
    - [momn_daav, monthly minimum of daily average]
    - [momn_damn, monthly minimum of daily minimum]
    - [momn_damx, monthly minimum of daily maximum]
    - [momn_dasd, monthly minimum of daily standard-deviation]
    - [momx_daav, monthly maximum of daily average]
    - [momx_damn, monthly maximum of daily minimum]
    - [momx_damx, monthly maximum of daily maximum]
    - [momx_dasd, monthly maximum of daily standard-deviation]
    - [mosd_daav, monthly standard-deviation of daily average]
    - [mosd_damn, monthly standard-deviation of daily minimum]
    - [mosd_damx, monthly standard-deviation of daily maximum]
    - [mosd_dasd, monthly standard-deviation of daily standard-deviation]
    multiple: false

  tile:
    category: data
    type: enum
    values:
    # 1-1000 Reserved for intercomparison tile classes/groupings
    - [seoc, 1, 'Seas and oceans']
    - [inwb, 2, 'Inland water bodies']
    - [bare, 3, 'Bare areas']
    - [hiv, 4, 'High vegetation']
    - [lov, 5, 'Low vegetation']
    - [urban, 6]
    # 1001-1500 Reserved for tile class entries for tile models using the ECOCLIMAP-SG land cover survey
    - [seao, 1001, 'Sea and oceans']
    - [lake, 1002, 'Lakes']
    - [rive, 1003, 'Rivers']
    - [no, 1004, 'Bare land']
    - [rock, 1005, 'Bare rock']
    - [snow, 1006, 'Permanent snow']
    - [bobd, 1007, 'Boreal broadleaf deciduous']
    - [tebd, 1008, 'Temperate broadleaf deciduous']
    - [trbd, 1009, 'Tropical broadleaf deciduous']
    - [tebe, 1010, 'Temperate broadleaf evergreen']
    - [trbe, 1011, 'Tropical broadleaf evergreen']
    - [bone, 1012, 'Boreal needleleaf evergreen']
    - [tene, 1013, 'Temperate needleleaf evergreen']
    - [bond, 1014, 'Boreal needleleaf deciduous']
    - [shrb, 1015, 'Shrubs']
    - [bogr, 1016, 'Boreal grassland']
    - [gras, 1017, 'Temperate grassland']
    - [trog, 1018, 'Tropical grassland']
    - [c3w, 1019, 'Winter C3 crops']
    - [c3s, 1020, 'Summer C3 crops']
    - [c4, 1021, 'C4 crops']
    - [fltr, 1022, 'Flooded trees']
    - [flgr, 1023, 'Flooded grassland']
    - [lcz1, 1024, 'Local climate zone 1 - compact high-rise (buildings)']
    - [lcz2, 1025, 'Local climate zone 2 - compact midrise (buildings)']
    - [lcz3, 1026, 'Local climate zone 3 - compact low-rise (buildings)']
    - [lcz4, 1027, 'Local climate zone 4 - open high-rise (buildings)']
    - [lcz5, 1028, 'Local climate zone 5 - open midrise (buildings)']
    - [lcz6, 1029, 'Local climate zone 6 - open low-rise (buildings)']
    - [lcz7, 1030, 'Local climate zone 7 - lightweight low-rise (buildings)']
    - [lcz8, 1031, 'Local climate zone 8 - large low-rise (buildings)']
    - [lcz9, 1032, 'Local climate zone 9 - sparsely built (buildings)']
    - [lcz10, 1033, 'Local climate zone 10 - heavy industry (buildings)']
    - [tebdu, 1034, 'Urban temperate broadleaf deciduous']
    - [trbdu, 1035, 'Urban tropical broadleaf deciduous']
    - [tebeu, 1036, 'Urban temperate broadleaf evergreen']
    - [trbeu, 1037, 'Urban tropical broadleaf evergreen']
    - [boneu, 1038, 'Urban boreal needleleaf evergreen']
    - [teneu, 1039, 'Urban temperate needleleaf evergreen']
    - [bondu, 1040, 'Urban boreal needleleaf deciduous']
    # 1501-2000 Reserved for tile grouping entries for tile models using the ECOCLIMAP-SG land cover survey
    - [gnatu, 1501, 'Nature grouping (NO + ROCK + SNOW + BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB + BOGR + GRAS + TROG + C3W + C3S + C4 + FLTR + FLGR)']
    - [gnofo, 1502, 'Non-forest grouping (NO + ROCK + SNOW + BOGR + GRAS + TROG + C3W + C3S + C4 + FLTR + FLGR)']
    - [gfore, 1503, 'Forest grouping (BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB)']
    - [gnove, 1504, 'Non-vegetated grouping (NO + ROCK + SNOW)']
    - [gtree, 1505, 'Trees grouping (BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB + FLTR)']
    - [glveg, 1506, 'Low vegetation grouping (BOGR + GRAS + TROG + C3W + C3S + C4 + FLGR)']
    - [gnflv, 1507, 'Non-flooded low vegetation grouping (BOGR + GRAS + TROG + C3W + C3S + C4)']
    - [gcrop, 1508, 'Crops grouping (C3W + C3S + C4)']
    - [ggras, 1509, 'Grassland grouping (BOGR + GRAS + TROG)']
    - [gbaro, 1510, 'Bare and rock grouping (NO + ROCK)']
    - [gc3cr, 1511, 'C3 crops grouping (C3W + C3S)']
    - [gbfor, 1512, 'Broadleaf forest grouping (BOBD + TEBD + TRBD + TEBE + TRBE + SHRB)']
    - [gnfor, 1513, 'Needleleaf forest grouping (BONE + TENE + BOND)']
    - [gdbfo, 1514, 'Deciduous broadleaf forest grouping (BOBD + TEBD + TRBD + TEBE + SHRB)']
    - [gtgra, 1515, 'Temperate grassland grouping (BOGR + GRAS)']
    - [gnfnf, 1516, 'Non-forest (no FLTR) grouping (NO + ROCK + SNOW + BOGR + GRAS + TROG + C3W + C3S + C4 + FLGR)']
    - [gbfft, 1517, 'Broadleaf forest (with FLTR) grouping (BOBD + TEBD + TRBD + TEBE + TRBE + SHRB + FLTR)']
    - [gbtre, 1518, 'Broadleaf trees grouping (BOBD + TEBD + TRBD + TEBE + TRBE + FLTR)']
    - [gcgra, 1519, 'C3/C4 grasslands grouping (BOGR + GRAS + FLGR)']
    - [gbdtr, 1520, 'Broadleaf deciduous trees grouping (BOBD + TEBD + TRBD + FLTR)']
    - [gbetr, 1521, 'Broadleaf evergreen trees grouping (TEBE + TRBE)']
    - [gnetr, 1522, 'Needleleaf evergreen trees grouping (BONE + TENE)']
    - [glczu, 1523, 'LCZ or urban grouping (LCZ1 + LCZ2 + LCZ3 + LCZ4 + LCZ5 + LCZ6 + LCZ7 + LCZ8 + LCZ9 + LCZ10)']
    - [giwat, 1524, 'Inland water grouping (LAKE + RIVE)']
    - [gptebd, 1525, 'Urban parks and gardens TEBD grouping (NO + GRAS + TEBDU)']
    - [gptrbd, 1526, 'Urban parks and gardens TRBD grouping (NO + GRAS + TRBDU)']
    - [gptebe, 1527, 'Urban parks and gardens TEBE grouping (NO + GRAS + TEBEU)']
    - [gptrbe, 1528, 'Urban parks and gardens TRBE grouping (NO + GRAS + TRBEU)']
    - [gpbone, 1529, 'Urban parks and gardens BONE grouping (NO + GRAS + BONEU)']
    - [gptene, 1530, 'Urban parks and gardens TENE grouping (NO + GRAS + TENEU)']
    - [gpbond, 1531, 'Urban parks and gardens BOND grouping (NO + GRAS + BONDU)']
    # 2001-2500 Reserved for tile class entries for tile models using the GLCC v2.0 BATS Classification survey
    - [crmf, 2001, 'Crops, mixed farming']
    - [shgr, 2002, 'Short grass']
    - [evne, 2003, 'Evergreen needleleaf trees']
    - [dene, 2004, 'Deciduous needleleaf trees']
    - [debr, 2005, 'Deciduous broadleaf trees']
    - [evbr, 2006, 'Evergreen broadleaf trees']
    - [tagr, 2007, 'Tall grass']
    - [dese, 2008, 'Desert']
    - [tund, 2009, 'Tundra']
    - [ircr, 2010, 'Irrigated crops']
    - [sede, 2011, 'Semidesert']
    - [icgl, 2012, 'Ice caps and glaciers']
    - [boma, 2013, 'Bogs and marshes']
    - [inwa, 2014, 'Inland water']
    - [ocea, 2015, 'Ocean']
    - [evsh, 2016, 'Evergreen shrubs']
    - [desh, 2017, 'Deciduous shrubs']
    - [mfwo, 2018, 'Mixed forest/woodland']
    - [info, 2019, 'Interrupted forest']
    - [wlmi, 2020, 'Water and land mixtures']
    - [baso, 2021, 'Bare soil']
    - [urba, 2022, 'Urban (GLCC BATS)']
    - [lori, 2023, 'Low-rise building']
    - [hiri, 2024, 'High-rise building']
    # 2501-3000 Reserved for tile grouping entries for tile models using the GLCC v2.0 BATS Classification survey
    - [glve, 2501, 'Low vegetation grouping (CRMF + SHGR + TAGR + TUND + IRCR + SEDE + BOMA + EVSH + DESH + WLMI)']
    - [ghve, 2502, 'High vegetation grouping (EVNE + DENE + DEBR + EVBR + MFWO + INFO)']
    # 3001-3500 Reserved for tile class entries for tile models using the ESA-GlobCover GCV2009 survey
    - [pfic, 3001, 'Post-flooding or irrigated croplands']
    - [racr, 3002, 'Rainfed croplands']
    - [mcve, 3003, 'Mosaic cropland (50%-70%)/vegetation (grassland, shrubland, forest) (20-50%)']
    - [mvcr, 3004, 'Mosaic vegetation (grassland, shrubland, forest) (50%-70%)/cropland (20%-50%)']
    - [cobs, 3005, 'Closed to open (>15%) broadleaved evergreen and/or semi-deciduous forest (>5m)']
    - [clbd, 3006, 'Closed (>40%) broadleaved deciduous forest (>5m)']
    - [opbd, 3007, 'Open (15-40%) broadleaved deciduous forest (>5m)']
    - [clne, 3008, 'Closed (>40%) needleleaved evergreen forest (>5m)']
    - [onde, 3009, 'Open (15-40%) needleleaved deciduous or evergreen forest (>5m)']
    - [cobn, 3010, 'Closed to open (>15%) mixed broadleaved and needleleaved forest (>5m)']
    - [mfsg, 3011, 'Mosaic forest/shrubland (50%-70%)/grassland (20%-50%)']
    - [mgfs, 3012, 'Mosaic grassland (50%-70%)/forest/shrubland (20%-50%)']
    - [cosh, 3013, 'Closed to open (>15%) shrubland (<5m)']
    - [cohv, 3014, 'Closed to open (>15%) herbaceous vegetation']
    - [spve, 3015, 'Sparse (<15%) vegetation (woody vegetation, shrubs, grassland)']
    - [cobff, 3016, 'Closed to open (>15%) broadleaved forest regularly flooded (semi-permanently or temporarily) - fresh or brackish water']
    - [clbff, 3017, 'Closed (>40%) broadleaved forest or shrubland permanently flooded - saline or brackish water']
    - [covef, 3018, 'Closed to open (>15%) vegetation (grassland, shrubland, woody vegetation) on regularly flooded or waterlogged soil - fresh, brackish or saline water']
    - [asaa, 3019, 'Artificial surfaces and associated areas (urban areas >50%)']
    - [baar, 3020, 'Bare areas (GCV2009)']
    - [wabo, 3021, 'Water bodies']
    - [pesi, 3022, 'Permanent snow and ice']
    # 3501-4000 Reserved for tile grouping entries for tile models using the ESA-GlobCover GCV2009 survey
    - [grdt, 3501, 'Grouping using the dominant tiles approach (dominant tile varies per gridbox)']
    # 4001-4500 Reserved for tile class entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey
    - [tbeco, 4001, 'Tree cover, broadleaved evergreen, closed to open (>15%)']
    - [tbdc, 4002, 'Tree cover, broadleaved deciduous, closed (>40%)']
    - [tbdo, 4003, 'Tree cover, broadleaved deciduous, open (15-40%)']
    - [tneco, 4004, 'Tree cover, needleleaved evergreen, closed to open (>15%)']
    - [tndco, 4005, 'Tree cover, needleleaved deciduous, closed to open (>15%)']
    - [tmlco, 4006, 'Tree cover, mixed leaftype, closed to open (>15%)']
    - [tcoff, 4007, 'Tree cover, closed to open (>15%), regularly flooded, fresh or brackish water - swamp forests']
    - [tcofs, 4008, 'Tree cover, closed to open (>15%), regularly flooded, saline water - mangrove forests']
    - [mtvg, 4009, 'Mosaic of tree cover and other natural vegetation (crop component possible)']
    - [tburn, 4010, 'Tree cover, burnt (mainly boreal forests)']
    - [scoe, 4011, 'Shrubcover, closed to open (>15%), evergreen (broadleaved or needleleaved)']
    - [scod, 4012, 'Shrubcover, closed to open (>15%), deciduous (broadleaved)']
    - [hcco, 4013, 'Herbaceous cover, closed to open (>15%)']
    - [shsc, 4014, 'Sparse herbaceous or sparse shrub cover']
    - [fshco, 4015, 'Regularly flooded (>2 month) shrub or herbaceous cover, closed to open']
    - [crop, 4016, 'Cropland (upland crops or inundated/ flooded crops)']
    - [mctnv, 4017, 'Mosaic of cropland / tree cover/ other natural vegetation']
    - [mcsh, 4018, 'Mosaic of cropland / shrub or herbaceous cover']
    - [baare, 4019, 'Bare areas (GLC2000)']
    - [wbna, 4020, 'Water bodies (natural or artificial)']
    - [sina, 4021, 'Snow or ice (natural or artificial)']
    - [urar, 4022, 'Urban areas']
    # 4501-5000 Reserved for tile grouping entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey
    default: none
    multiple: true

  tileattribute:
    category: data
    type: enum
    values:
      - [undef, 0, Undefined]
      - [unmod, 1, Unmodified]
      - [snow, 2, Snow covered]
      - [flood, 3, Flooded]
      - [ice, 4, Ice covered]
      - [itcw, 5, With intercepted water]
      - [itcs, 6, With intercepted snow]
      - [agg, 7, Aggregated]
      - [snow_flood, Snow covered and flooded]
      - [snow_ice, Snow covered and ice covered]
      - [snow_itcw, Snow covered and with intercepted water]
      - [snow_itcs, Snow covered and with intercepted snow]
      - [flood_ice, Flooded and ice covered]
      - [flood_itcw, Flooded and with intercepted water]
      - [flood_itcs, Flooded and with intercepted snow]
      - [ice_itcw, Ice covered and with intercepted water]
      - [ice_itcs, Ice covered and with intercepted snow]
      - [itcw_itcs, With intercepted water and with intercepted snow]
      - [snow_flood_ice, Snow covered and flooded and ice covered]
      - [snow_flood_itcw, Snow covered and flooded and with intercepted water]
      - [snow_flood_itcs, Snow covered and flooded and with intercepted snow]
      - [snow_ice_itcw, Snow covered and ice covered and with intercepted water]
      - [snow_ice_itcs, Snow covered and ice covered and with intercepted snow]
      - [snow_itcw_itcs, Snow covered and with intercepted water and with intercepted snow]
      - [flood_ice_itcw, Flooded and ice covered and with intercepted water]
      - [flood_ice_itcs, Flooded and ice covered and with intercepted snow]
      - [flood_itcw_itcs, Flooded and with intercepted water and with intercepted snow]
      - [ice_itcw_itcs, Ice covered and with intercepted water and with intercepted snow]
      - [snow_flood_ice_itcw, Snow covered and flooded and ice covered and with intercepted water]
      - [snow_flood_ice_itcs, Snow covered and flooded and ice covered and with intercepted snow]
      - [snow_flood_itcw_itcs, Snow covered and flooded and with intercepted water and with intercepted snow]
      - [snow_ice_itcw_itcs, Snow covered and ice covered and with intercepted water and with intercepted snow]
      - [flood_ice_itcw_itcs, Flooded and ice covered and with intercepted water and with intercepted snow]
      - [snow_flood_ice_itcw_itcs, Snow covered and flooded and ice covered and with intercepted water and with intercepted snow]
    default: none
    multiple: true

  tilescheme:
    category: data
    type:
      - context:
          class: [d1]
          dataset: [on-demand-extremes-dt]
        type: enum
        values:
          - [unknown, 0]
          - [simple, 1, Simple tile scheme configuration with most-grouped tiles]
          - [granular, 2, Granular tile scheme configuration with most-separated tile groupings]
        default: none
        multiple: true

#################################################################

  # year
  # decade
  # month

  date:
    category: data
    multiple: true
    type: date
    by: 1
    defaults:
      - vals: [-1]

  year:
    category: data
    type: to-by-list
    multiple: true
    by: 1

  month:
    category: data
    flatten: true
    type: enum
    multiple: true
    values:
      - [1, jan, january]
      - [2, feb, february]
      - [3, mar, march]
      - [4, apr, april]
      - [5, may]
      - [6, jun, june]
      - [7, jul, july]
      - [8, aug, august]
      - [9, sep, september]
      - [10, oct, october]
      - [11, nov, november]
      - [12, dec, december]

  hdate:
    category: data
    multiple: true
    type: date

  offsetdate:
    category: data
    multiple: true
    type: date

  fcmonth:
    category: data
    multiple: true
    by: 1
    type: to-by-list

  fcperiod:
    category: data
    multiple: true
    type: any

  time:
    category: data
    multiple: true
    type: time
    by: 6h
    defaults:
      - vals: ['1200']

  offsettime:
    category: data
    multiple: true
    type: time

  leadtime:
    category: data
    multiple: true
    type: any

  opttime:
    category: data
    multiple: true
    type: any

  step:
    category: data
    multiple: true
    by: 12
    type: range
    defaults:
      - vals: [0]

  anoffset:
    category: data
    multiple: true
    type: integer

  reference:
    category: data
    multiple: true
    type: integer

#################################################################

  # cluster
  # probability

  number:
    category: data
    multiple: true
    type: to-by-list
    by: 1

  quantile:
    category: data
    multiple: true
    type: to-by-list-quantile
    denominators: [2,3,4,5,10,100,1000]
    by: 1

  domain:
    category: data
    type:
      - context:
          class: [ms]
          country: [it]
        type: enum
        values:
          - [italy]
          - [euroatl]
          - [europe]
          - [mediterranean]
      - type: enum
        flatten: false
        type: enum
        values:
          - [a, north west europe]
          - [b, north east europe, baltic and black sea]
          - [c, south west europe]
          - [d, south east europe]
          - [e, europe]
          - [f, fastex]
          - [g, globe, general european area]
          - [h]
          - [i]
          - [j]
          - [k]
          - [l]
          - [m, mediterranean]
          - ['n', northern hemisphere]
          - [o]
          - [p]
          - [q]
          - [r]
          - [s, southern hemisphere]
          - [t, tropics]
          - [u, tropics 2]
          - [v]
          - [w, western atlantic]
          - [x]
          - ['y']
          - [z]


  bcmodel:
    category: data
    type:
      - context:
          class: [ms]
          country: [it]
        type: enum
        values:
          - [gme]
          - [ifs]

  icmodel:
    category: data
    type:
      - context:
          class: [ms]
          country: [it]
        type: enum
        values:
          - [gme]
          - [ifs]
          - [mvoi]
          - [nudging]
          - [3dvar]

  country:
    category: data
    multiple: false
    type:
      - context:
          class: [ms]
        type: enum
        values:
          - [it]
          - [de]

  grib:
    category: data
    multiple: false
    type:
      - context:
          class: [ms]
          country: [it]
        type: enum
        values:
          - [original]
          - [ecmwf]

  frequency:
    category: data
    multiple: true
    by: 1
    type: to-by-list

  direction:
    category: data
    multiple: true
    by: 1
    type: to-by-list

  diagnostic:
    category: data
    type: integer
    multiple: true

  iteration:
    category: data
    type: integer
    multiple: true

  channel:
    category: data
    type: integer
    multiple: true
    # TODO : Migration from old images to new images

  ident:
    category: data
    type: integer
    multiple: true

  instrument:
    category: data
    type: integer
    multiple: true
  # TODO : Migration from old images to new images

  method:
    category: data
    type: integer

  origin:
    category: data
    multiple: true
    type: enum
    values:
      - [aladinhuneps-omsz-eu]
      - [aladinlaef-zamg-eu]
      - [ammc, 1, melbourne]
      - [anso]
      - [aromeeps-mf-eu]
      - [babj, 38, beijing]
      - [cmcc]
      - [cnmc, 80]
      - [consensus, 255]
      - [cosmo]
      - [cosmodeeps-dwd-eu]
      - [cosmoleps-arpasimc-eu]
      - [crfc, 239, cerfacs]
      - [cwao, 54, montreal]
      - [dems]
      - [ecmf, 98, ecmwf]
      - [ecmf_ea, ecmwf_ea]
      - [ecmf_od, ecmwf_od]
      - [edzw, dwd, 78, offenbach]
      - [egrr, 74, exeter, bracknell]
      - [ekmi]
      - [enmi, 88, oslo]
      - [eswi]
      - [fapr]
      - [fnmo, fnmoc, 58, fleet numerical]
      - [fr-ms-ec]
      - [glameps-hirlamcons-eu]
      - [hadc, 247, hadley centre]
      - [hirlam-dmi-eu]
      - [ifmk, 246]
      - [ingv, 235]
      - [isac]
      - [knmi, 245]
      - [kwbc, 7, washington]
      - [lemm, 214, madrid]
      - [lfpw, 84, 85, paris, toulouse]
      - [lops]
      - [mogreps-mo-eua]
      - [nasa]
      - [niwa]
      - [no-ar-ce]
      - [no-ar-cw]
      - [no-ar-pa]
      - [nzkl]
      - [pearp-mf-eu]
      - [rjtd, 34, tokyo]
      - [rksl, 40, seoul]
      - [rums]
      - [sabm]
      - [sbsj, 46, cptec]
      - [se-al-ec]
      - [sreps-aemet-eua]
      - [srnwppeps-dwd-eua]
      - [vabb]
      - [vuwien, 244, university of vienna]

  system:
    category: data
    type: integer

#######################################################################
# DestinE ClimateDT related keywords

  activity:
    category: data
    type: enum
    values:
      - [cmip6, Coupled Model Intercomparison Project Phase 6]
      - [scenariomip, Scenario Model Intercomparison Project]
      - [highresmip, High Resolution Model Intercomparison Project]
      - [story-nudging, Climate storylines by nudging to reanalysis]
      - [baseline, Baseline simulations for climate model evaluation]
      - [projections, Future climate projections]

  experiment:
    category: data
    type: enum
    values:
      - [hist, Historical]
      - [cont, Control]
      - [amip, Atmospheric Model Intercomparison Project]
      - [ssp1-1.9, Shared Socio-economic Pathways 1-1.9]
      - [ssp1-2.6, Shared Socio-economic Pathways 1-2.6]
      - [ssp2-4.5, Shared Socio-economic Pathways 2-4.5]
      - [ssp3-7.0, Shared Socio-economic Pathways 3-7.0]
      - [ssp5-8.5, Shared Socio-economic Pathways 5-8.5]
      - [tplus1.5k, Warmer world at 1.5 degrees K above pre-industrial temperatures]
      - [tplus2.0k, Warmer world at 2.0 degrees K above pre-industrial temperatures]
      - [tplus3.0k, Warmer world at 3.0 degrees K above pre-industrial temperatures]
      - [tplus4.0k, Warmer world at 4.0 degrees K above pre-industrial temperatures]
      - [abrupt4xco2, CO2 abruptly quadrupled and then held constant]

  generation:
    category: data
    type: integer

  realization:
    category: data
    multiple: true
    type: to-by-list
    by: 1 

  resolution:
    category: data
    type: enum
    values:
      - [standard, Standard resolution model output with longer availability]
      - [high, High resolution model output with limited availability]

    # - product
    # - section
    # - refdate
    # - latitude
    # - longitude
    # - range

#######################################################################

_observation: &_observation

  obstype:
    category: data
    multiple: true
    defaults:
      - context:
          _verb: [retrieve]
          type: [ob]
        vals: [1]
    type: enum
    values: "obstype.yaml"
    # TODO : Migration from old images to new images

  range:
    category: data
    type: any

  latitude:
    category: data
    type: any

  longitude:
    category: data
    type: any

# type: [im]
# obstype: [=0 %and (ident=52 %or ident=53 %or ident=54))  %then
#         %warning "replacing obstype=0 by channel=2, instrument=205"
#         %unset obstype
#         %set channel    = 2
#         %set instrument = 205

# %if (type=im %and obstype=10 %and (ident=52 %or ident=53 %or ident=54))  %then
#         %warning "replacing obstype=10 by channel=3, instrument=205"
#         %unset obstype
#         %set channel    = 3
#         %set instrument = 205

# %if (type=im %and obstype=20 %and (ident=52 %or ident=53 %or ident=54))  %then
#         %warning "replacing obstype=10 by channel=1, instrument=205"
#         %unset obstype
#         %set channel    = 1
#         %set instrument = 205

# # goes
# %if (type=im %and obstype=0 %and (ident=252 %or ident=253 %or ident=254 %or ident=255 %or ident=256)) %then
#         %warning "replacing obstype=0 by channel=4, instrument=615"
#         %unset obstype
#         %set channel    = 4
#         %set instrument = 615

# %if (type=im %and obstype=10 %and (ident=252 %or ident=253 %or ident=254 %or ident=255 %or ident=256)) %then
#         %warning "replacing obstype=10 by channel=1, instrument=615"
#         %unset obstype
#         %set channel    = 1
#         %set instrument = 615

# %if (type=im %and obstype=20 %and (ident=252 %or ident=253 %or ident=254 %or ident=255 %or ident=256)) %then
#         %warning "replacing obstype=20 by channel=3, instrument=615"
#         %unset obstype

#######################################################################

_postproc: &_postproc

  accuracy:
    category: postproc
    flatten: false
    type: [enum, integer]
    values:
      - [av, archived value]
      - ['n', normal, auto]
      - [r, reduced]
      - [l, low]

  bitmap:
    category: postproc
    flatten: false
    type: any

  format:
    category: postproc
    flatten: false
    type: enum
    values:
      - [grib1, grib, gb, grib edition 1]
      - [grib2, grib edition 2]
      - [bufr, bf]
      - [grid, gd]
      - [netcdf]
      - [odb]
      - [ascii]
      - [p, packed]
      - [u, unpacked]

  frame:
    category: postproc
    type: integer

  gaussian:
    category: postproc
    type: enum
    values:
      - reduced
      - regular

  area:
    category: postproc
    flatten: false
    multiple: true
    type: [float, enum]
    values:
      - [g, global]
      - [e, europe]

  grid:
    category: postproc
    flatten: false
    multiple: true
    type: [enum, regex, float]
    values:
      - auto
      - [av, archived value]
      - [F16, 16]
      - [F24, 24]
      - [F32, 32]
      - [F48, 48]
      - [F64, 64]
      - [F80, 80]
      - [F96, 96]
      - [F128, 128]
      - [F160, 160]
      - [F192, 192]
      - [F200, 200]
      - [F256, 256]
      - [F320, 320]
      - [F400, 400]
      - [F512, 512]
      - [F576, 576]
      - [F640, 640]
      - [F800, 800]
      - [F912, 912]
      - [F1024, 1024]
      - [F1280, 1280]
      - [F1600, 1600]
      - [F2000, 2000]
      - [F2560, 2560]
      - [F4000, 4000]
      - [F8000, 8000]
    regex:
      - '^[oOfF][1-9][0-9]*$'
      - '^[nN](32|48|64|80|96|128|160|200|256|320|400|512|640|800|1024|1280|8000)$'
      - '^[hH][rRnN]?(1|2|4|8|16|32|64|128|256|512|1024|2048|4096|8192)$'
    uppercase: true

  interpolation:
    category: postproc
    flatten: false
    type: enum
    values:
      - [linear]
      - [bilinear]
      - [nearest-lsm, nlsm, nearest lsm]
      - [nearest-neighbour, nn, nearest neighbour]
      - [grid-box-average, average]

  packing:
    category: postproc
    flatten: false
    type: enum
    values:
      - [so, second order]
      - [av]
      - [complex, co]
      - [simple, si]
      - [ccsds]

  resol:
    category: postproc
    flatten: false
    type: [enum, integer]
    values:
      - [av, archived value]
      - [auto, automatic resolution]
      - [N128, reduced gaussian 128]
      - [N200, reduced gaussian 200]

  rotation:
    category: postproc
    flatten: false
    multiple: true
    type: float

  intgrid:
    category: postproc
    flatten: false
    type: [enum, regex]
    values:
      - auto
      - none
      - source
      - N32
      - N48
      - N64
      - N80
      - N96
      - N128
      - N160
      - N192
      - N200
      - N256
      - N320
      - N400
      - N512
      - N640
      - N800
      - N912
      - N1024
      - N1280
    regex:
      - '^[oOfFhH][1-9][0-9]+$'

  truncation:
    category: postproc
    flatten: false
    type: [enum, integer]
    values:
      - auto
      - none

  process:
    category: postproc
    flatten: false
    type: enum
    values:
      - local
      - server

#######################################################################

_obspproc: &_obspproc

  filter:
    type: any
    category: postproc

  ident:
    type: any
    category: postproc

#######################################################################

disseminate:
  <<: *_field
  <<: *_postproc

  requirements:
    type: any

  resol:
    category: postproc
    type: any

  # repres:
  #   category: postproc
  #   type: any

  day:
    category: postproc
    multiple: true
    type: to-by-list
    by: 1
    range: [1, 31]

  use:
    category: sink
    flatten: false
    multiple: true
    type: enum
    values:
      # - [frequent, f]
      # - [infrequent, i]
      # - [normal, n]
      # - compare
      # - [monthly run]
      # - intent
      # - disk
      - [bc, boundary conditions]
      - [monday, mon]
      - [tuesday, tue]
      - [wednesday, wed]
      - [thursday, thu]
      - [friday, fri]
      - [saturday, sat]
      - [sunday, sun]

  option:
    category: sink
    default: normal
    flatten: false
    multiple: true
    type: enum
    values:
      - normal
      - delay
      - asap
      - gts
      - opendata

  compatibility:
    category: postproc
    flatten: false
    multiple: true
    type: enum
    values:
      - 'no-local-extension'
      - 'adjust-spectral-packing'

  priority:
    category: sink
    flatten: false
    type: integer

  target:
    category: sink
    flatten: false
    type: any

  filename:
    category: sink
    flatten: false
    type: any

##############################################################

archive:

  <<: *_field
  <<: *_observation

  resol:
    category: postproc
    type: any

  # repres:
  #   category: postproc
  #   type: any

  database:
    flatten: false
    multiple: true
    type: any
    # TODO set

  source:
    category: sink
    flatten: false
    multiple: true
    type: any

  sourcebase:
    category: sink
    flatten: false
    multiple: true
    type: any

  expect:
    category: sink
    flatten: false
    multiple: false
    type: [enum, integer]
    values:
    - any

  disp:
    category: sink
    flatten: false
    multiple: false
    type: enum
    values:
      - [n, new]
      - [old]
      - [remove]
      - [fail]

  _clear_defaults: [step]

##############################################################

retrieve:
  _aliases: [r, ret, retr]

  <<: *_field
  <<: *_observation
  <<: *_postproc
  <<: *_obspproc

  target:
    category: sink
    flatten: false
    multiple: true
    type: any

  source:
    category: sink
    flatten: false
    multiple: true
    type: any

  expect:
    category: sink
    flatten: false
    multiple: false
    type: [enum, integer]
    values:
    - any

  fieldset:
    category: sink
    aliases: [field]
    flatten: false
    multiple: false
    type: any

  database:
    category: sink
    flatten: false
    multiple: true
    aliases: [dbase]
    type: any

  optimise:
    category: sink
    type: enum
    values:
    - 'on'
    - 'off'
    defaults:
      - vals: ["off"]

  duplicates:
    category: sink
    defaults:
      - context:
          _verb: [retrieve]
          type: [ob]
        vals: [keep]
    type: enum
    values:
    - keep
    - remove

  padding:
    category: sink
    flatten: false
    type: enum
    defaults:
      - context:
          _verb: [retrieve]
          class: [ti]
        vals: [0]
    values:
      - [0, none, n]
      - [auto, automatic]

##############################################################

read:

  source:
    category: sink
    flatten: false
    multiple: true
    type: any

  <<: *_field
  <<: *_observation
  <<: *_postproc
  <<: *_obspproc

  target:
    category: sink
    flatten: false
    multiple: true
    type: any

  fieldset:
    category: sink
    aliases: [field]
    flatten: false
    multiple: false
    type: any

  _clear_defaults: [class, date, domain, expver, levelist, levtype, param, step, stream, time, type]

  _options:
    param:
      # expand_with:  # In case not type/stream/levtype is provided
      #   type: an
      #   stream: oper
      #   levtype: pl
      first_rule: true
##############################################################


flush:

  <<: *_field
  <<: *_observation
  <<: *_postproc
  <<: *_obspproc

  wait:
    flatten: false
    multiple: false
    type: enum
    values:
      - [true, yes, y, on, 1]
      - [false, no, n, off, 0]

  decache:
    flatten: false
    multiple: false
    type: enum
    values:
      - [true, yes, y, on, 1]
      - [false, no, n, off, 0]

  _clear_defaults: [class, date, domain, expver, levelist, levtype, param, step, stream, time, type]

##############################################################

get:

  tape:
    category: sink
    flatten: false
    multiple: false
    type: any

  database:
    category: sink
    flatten: false
    multiple: true
    type: any

  target:
    category: sink
    flatten: false
    multiple: true
    type: any

##############################################################

list:

  <<: *_field
  <<: *_observation

  database:
    category: sink
    flatten: false
    multiple: true
    type: any

  target:
    category: sink
    flatten: false
    multiple: true
    type: any

  pseudodate:
    flatten: false
    multiple: false
    type: enum
    values:
      - [latest]
      - [earliest]

  output:
    category: sink
    flatten: false
    multiple: false
    defaults:
      - vals: [table]
    type: enum
    values:
      - [table]
      - [browse]
      - [cost]
      - [search]
      - [tree]
      - [json]

  _clear_defaults: [date, domain, expver, levelist, levtype, param, step, stream, time, type]
  _multiple: [class, expver, stream, type]

##############################################################

compute:

  formula:
    flatten: false
    multiple: false
    type: any

  fieldset:
    category: sink
    aliases: [field]
    flatten: false
    multiple: false
    type: any

##############################################################

write:

  fieldset:
    category: sink
    aliases: [field]
    flatten: false
    multiple: false
    type: any

  target:
    category: sink
    flatten: false
    multiple: true
    type: any

##############################################################


pointdb:
  lat:
    multiple: false
    type: float

  lon:
    multiple: false
    type: float

  <<: *_field

  _clear_defaults: [class, date, domain, expver, levelist, levtype, param, step, stream, time, type]

  _options:
    param:
      # expand_with:  # In case not type/stream/levtype is provided
      #   type: an
      #   stream: oper
      #   levtype: pl
      first_rule: true

end: {}
