esm-tools / esm_tools

Simple Infrastructure for Earth System Simulations
https://esm-tools.github.io/
GNU General Public License v2.0
25 stars 12 forks source link

Dynveg Sanity Checks #142

Closed pgierz closed 2 years ago

pgierz commented 4 years ago

Dynamic Vegetation Checks

This feature request will incorporate sanity checks on JSBACH input files, specifically jsbach.nc

Problem

Due to the disorganized nature of the pools on the supercomputers, it is quite easy to accidentally run a simulation without dynamic vegetation in JSBACH, yet use input files intended for dynamic vegetation.

@chrisdane recently ran into this problem with his CMIP6 simulations.

Proposed Solution

Since JSBACH does not check this internally, and there is still no clearly defined convention for the what the file names should be, I recommend we include some sort of sanity check on the jsbach file itself. Luckily, the file metadata describes for which setup the file is intended, e.g.:

For dynamic vegetation

$ ncdump -h /work/ab0995/a270046/meshes_default/core/tarfilesT63/input/jsbach/jsbach_T63CORE2_11tiles_5layers_1850.nc
// global attributes:
        :title = "initial surface data for JSBACH" ;
        :institution = "Max Planck Institute for Meteorology, Hamburg, Germany" ;
        :Conventions = "CF-1.0" ;
        :refyear_for_cover_types = 1850 ;
        :refyear_for_cover_fractions = 1850 ;
        :spherical_truncation = "T63" ;
        :nlct = 21 ;
        :configuration = "T63CORE2 11tiles" ;
        :comment = "setup for an experiment with ocean model: grid CORE2\n",
            "setup for runs with dynamic vegetation\n",
            "C3 and C4 crops distinguished\n",
            "pastures distinguished from crops\n",
            "pasture maps from historical landuse harmonization maps\n",
            "data for 5 layer soil included\n",
            "maximum soil moisture from LSP3 (Stacke 2013)" ;

For fixed vegetation

$ ncdump -h /pool/data/AWICM/FESOM1/MESHES/core/tarfilesT63/input/jsbach/jsbach_T63CORE2_11tiles_5layers_1850_no-dynveg.nc

// global attributes:
        :comment = "setup for an experiment with ocean model: grid CORE2\n",
            "setup for runs without dynamic vegetation\n",
            "C3 and C4 crops distinguished\n",
            "pastures distinguished from crops\n",
            "crop and pasture fractions calculated from LUH2 v2h Release (10/14/16)\n",
            "crop cover types calculated from 1961 to 2005 average of FAO data\n",
            "pasture rule applied\n",
            "maximum soil moisture from LSP3 (Stacke 2013)" ;

When assembling the initial file lists, we could do an ncdump check to see if the strings "setup for runs without dynamic vegetation" (or accordingly, for the dynveg version) are present, and match to the jsbach namelist.

Other Alternatives

While having some sort of programmatic ncdump based check for any particular file might be a useful feature to have in general, for right now, I think a quick hack is better, and we can keep in mind how to move this to YAML instead of python. Ideally, something like:

# in jsbach.yaml
sanity_checks:
    # A dictionary of things to check. Keys correspond to file names as in the other file dictionaries with outdata_files, etc
    jsbach:
          # Next dictionary is how to actually check this
         method: ncdump
         must_contain: "some string" 
chrisdane commented 4 years ago

Just adding background info: this was the original issue back then: https://gitlab.dkrz.de/esm-tools-old-stuff/esm-runscripts/-/issues/187

JanStreffing commented 2 years ago

This was on release 5.0 todo, but was not completed. It did not get revived for release 6.0. Interest does not seem too high. We are trying to sort which issues are still relevant @chrisdane @pgierz I would suggest to implement of close. You decide.

JanStreffing commented 2 years ago

I found multiple issues with similar topics, keeping only #148 open.