input_header - PIK-LPJmL/LPJmL GitHub Wiki

All input files of the CLM format come with a header, there are 3 versions of this. LPJmL source code can read all versions, but older code revisions can only read header versions existent by then (downward compatible). Higher spatial resolution input requires files with header version 3.

version 1

a non-uniform string length for the file type, e.g. 'LPJGRID'

typedef struct
{
  int order;       /* order of data items , either CELLYEAR or YEARCELL */
  int firstyear;   /* first year for data */
  int nyear;       /* number of years */
  int firstcell;   /* index of first data item */
  int ncell;       /* number of data item per year */
  int nbands;      /* number of data elements per cell */
} Header_old;

version 2

a uniform 7-character string for file type, only first 3 letters are considered

typedef struct
{
  int order;       /* order of data items , either CELLYEAR or YEARCELL */
  int firstyear;   /* first year for data */
  int nyear;       /* number of years */
  int firstcell;   /* index of first data item */
  int ncell;       /* number of data item per year */
  int nbands;      /* number of data elements per cell */
  float cellsize;  /* cellsize in deg */
  float scalar;    /* conversion factor*/
 } Header;

version 3

a uniform 7-character string for file type, only first 3 letters are considered

typedef struct
{
  int order;       /* order of data items , either CELLYEAR,YEARCELL */
  int firstyear;   /* first year for data */
  int nyear;       /* number of years */
  int firstcell;   /* index of first data item */
  int ncell;       /* number of data item per year */
  int nbands;      /* number of data elements per cell */
  float cellsize_lon;  /* latitude cellsize in deg */
  float scalar;    /* conversion factor*/
  float cellsize_lat; /* longitude cellsize in deg */
  Type datatype;   /* data type in file */
} Header;