country specific_input_files - PIK-LPJmL/LPJmL GitHub Wiki

Country-specific input files

To establish a new grid for Mexico, log in to the cluster

  • First you have to compile the utilities via make all
  • then you need to set the PATH to the binaries of LPJmL. If lpjml is, e.g. located in /home/username/lpjml/trunk/bin, then set export PATH=$PATH:/home/username/lpjml/trunk/bin
  • and go to the directory /your/data/directory

which contains input data.
If you have a country file for managed lands here (e.g. cow_mg_2006.bin) and the global grid file grid.bin, you can use these two files to “cut out” the grid for Mexico.

You can print the header of the binary country file cow_mg_2006.bin with the command
printclm cow_mg_2006.bin (if you are working with the new soil data set, you may want to use cow_mg_2006_full.bin in which all grid cells have a valid country and region code (the cow_mg_2006.bin) only has valid values for the 59199 pixels with valid (old) soil data plus some additional random ones.

It says that the file contains nbands = 2 which means the number of columns in this data file. In this case, the country file has two bands because for each grid cell ID, there are two entries for the countrycode and regioncode (sub-national) (see input). In the model, there are 67420 grid cells in total for the entire globe.

which printclm shows the location of printclm

  • The next step is to get the country ID and the coordinates for Mexico and create a new grid file specific for Mexico from the global files.

To do this, go to your LPJ root directory.

Enter the folder $LPJROOT/include
Within the file managepar.h, you find the country IDs for each country on the planet.
The country ID 106 is for Mexico.

Now enter the folder $LPJROOT/bin/
which contains utility functions for LPJmL. Among these files, you first need to call the routine getcountry on the global country and grid files. The function takes 2 input files, the filename for the new grid, and the country number as arguments. The command is getcountry /p/projects/lpjml/input/historical/input_VERSION2/cow_mg_2006.bin /p/projects/lpjml/input/historical/input_VERSION2/grid.bin grid_mexico.clm 106

The newly created grid_mexico.clm should contain a subset of cell IDs from 0,…803 with entries for latitudes and longitudes (view with printclm).

Well done! Now you have the grid for Mexico.

Apart from this grid, you also need climate and soil data to run your simulation. In the default setup, these are the files

tmp.clm //temperature  
drainclass.bin //currently unused, but still required by LPJmL  
wet.clm //number of wet days (important for weather generator)  
pre.clm //precipitation  
cld.clm //cloudiness  
soil.bin //soil type

To create Mexico-specific files, you need the utility functions regridclm and regridsoil. These take both the global grid file and your new Mexico-specific grid and re-sample e.g. the global temperature file to a Mexico-specific temperature file. To do this, run the command regridclm -same /p/projects/lpjml/input/historical/input_VERSION2/grid.bin grid_mexico.clm /p/projects/lpjml/input/historical/input_VERSION2/tmp.clm tmp_mexico.clm

Note that you would have to include the path to your grid_mexico.clm, if you have not created it within the current directory ($LPJROOT/src/utils).

Run the corresponding command for the other input files wet.clm, pre.clm, and cld.clm.

For soil.bin and drainclass.bin (scalar data), use the command

regridsoil -same /path/to/data/grid.bin grid_mexico.clm /path/to/data/soil.bin soil_mexico.bin

Last but not least, you need landuse data if you run a simulation including landuse and crop functional types in LPJmL. The default files are

/path/to/data/cow_mg_2006.bin  
/path/to/data/cft1700_2005_16cfts_SR.bin

To “cut out” the Mexico-specific data, you need again the same utility functional as for the climate data. Run the commands

regridclm -same /path/to/data/grid.bin grid_mexico.clm /path/to/data/cow_mg_2006.bin cow_mg_2006_mexico.bin
regridclm -same /path/to/data/grid.bin grid_mexico.clm /path/to/data/cft1700_2005_16cfts_SR.bin cft1700_2005_16cfts_SR_mexico.bin

and you’re done.

You can now use all your newly established input files:

grid_mexico.clm  
tmp_mexico.clm  
drainclass_mexico.bin  
wet_mexico.clm  
pre_mexico.clm  
cld_mexico.clm  
soil_mexico.clm  
cow_mg_2006_mexico.clm  
cft1700_2005_16cfts_SR_mexico.clm

in the input.conf for your LPJmL simulation.

⚠️ **GitHub.com Fallback** ⚠️