Extracting 2d fields

It’s possible to extract 2d fields from PGD.txt (covers, orography, etc.) and from PREP.txt (initial prognostic variables like soil temperature profile, soil water content profile, etc.). For that purpose you need to run SXPOST tool (located at the same place as PGD, PREP and OFFLINE: $SURFEX_EXPORT/src/exe/). Input files for SXPOST are PGD.txt or PREP.txt if exists, and a namelist containing the number of fields to be extracted, the name and a flag indicating if the variable depends on patches or not. The name of a given field is the name written in PGD.txt or PREP.txt file where characters " SPMamp;" have been removed. For example, to extract orography, the name of the field is ZS in SURFEX, the mask over which it’s defined can be FULL (total gridbox). To extract surface temperature over vegetation, the name will be TG1 and the mask NATURE. (grep "&" PGD.txt returns all variables of this file). To distinguish variables defined or not over patches, a flag is used: if the variable is patch dependant, the flag must be set to ’+’, in the contrary, it should be ’-’. For example orography (ZS) doesn’t depend on patches, but surface temperature (TG1) does. If the simulation uses patches and the flag is ’-’ then only the first patch will be treated (bare ground).
The namelist SXPOST.nam looks like:

    - FULL   ZS
    + NATURE TG1

Running SXPOST will return a file per variable, which will contain the longitude, the latitude and the value of the field for each gridbox over which the field is defined (For example, TG1 which is known only over nature won’t have a value for each gridbox of the domain).