Annex A Using CGMS in batch mode
To start CGMS in batch mode use the parameter /batch. For example: C:\Data\cgms_food\cgms.exe /batch
Instead of opening the UI an ini-file is read with the choices that are normally made in the UI. This file is called “cgms.ini” and should be located at the same directory as the executable “cgms.exe”. The content of the file looks like this:
[Database]
DSN= CGMS_92
User=
Password=
CalplatDSN=CGMS_92_CALPLAT
CalplatUsername=
CalplatPassword=
RunMode= OPERATIONAL
ShowBatchInfo=1
[Calculations]
WeatherCalculation=0
CropSimulation=1
Aggregation=1
PreperationForecast=0
Import=0
Export=0
[Weather]
WeatherAdd=1
WeatherAvail=1
weatherGrid=0
WeatherStartDate=01\01\1994
WeatherEndDate=31\12\1994
GlobalRadiationModel=0
[Simulation]
SimCroOutputYield=1
SimCroRunPot=1
SimCroRunWL=0
SimCroStartMonth=1
SimCroStartYear=1993
SimCroCampaignYears=1
SimCroWeatherData=1
simcroOutputStartDecade=19
simcroOutputEndDecade=19
StartEndMode=1
InitWaterBalance=0
GWInfluence=0
Winterkill=0
Crop=1,1,spring wheat,0
Crop=7,2,potato,0
SimCroAdminLevel1=All available
SimCroAdminLevel2=All available
SimCroAdminLevel3=All available
[Aggregation]
Schematization=1
SpatialLevel=1
AggIndicator=4
AggStartYear=1994
AggEndYear=1994
[Preparation]
Analyse=1
PrepAdminLevel1=All available
PrepAdminLevel2=All available
PrepAdminLevel3=All available
PrepStartYear=1993
PrepEndYear=1993
StatCrop=soft wheat,2,spring wheat,1
StatCrop=potato,11,potato,7
Indicator=1,TMax,ABS,1,16,SUM,NoThreshold,ground
Indicator=1,TMin,REL,1,150,AVG,0.5,model1
Indicator=1,PET,REL,1,150,AVG,0.5,model1
Indicator=2,PYB,ABS,10
EquationCoefs=1,2,3,4
[Import]
DataType=1
HeaderLines=0
ImpFileName=C:\Data\projecten\MARSCGMS\CGMS_Food\Data\FAO_WIM.txt
[Export]
ExpYear=1993
ExpDecade=0
ExpCropNr=2
Empty lines are skipped. Also lines with the words in brackets are skipped or lines starting with semicolon (;). CGMS just looks for the keywords like DSN, User, Password etc. The search is case-insensitive.
If the file is read correct and a connection with a database could be made the selected calculations start. The program opens a DOS-box and reports the progression. When all calculations are finished the box is closed automatically.
[Database]
For test purpose an MS-Access database is used. If User and Password are empty the program assumes that an MS-Access database is used. To insert in an Oracle database all the fields under [Database] should have a value.
In case CGMS is used for CALPLAT a different database can be used to provide weather data (grid_weather). Therefore one should use CalplatDSN, CalplatUsername and CalplatPassword.
Runmode indicates the mode: CALPLAT or the OPERATIONAL mode (default).
ShowBatchInfo:
1 = Show the cgms-window when run in batch mode (default)
0 = Minimize the window
[Calculations]
At this part indicate with “1” the calculations that should be performed.
| - WeatherCalculation | : Weather data calculation |
| - CropSimulation | : Crop simulation |
| - Aggregation | : Aggregate data |
| - PreperationForecast | : Preparation of data for yield forecast calculation |
| - Import | : Import external data to database |
| - Export | : Export data |
[Weather]
This section includes the settings for the weather data calculations.
First 3 items indicate whether the calculation should be performed.
| - WeatherAdd | : Additional Weather Parameters |
| - WeatherAvail | : Weather Data Availability |
| - WeatherGrid | : Grid Weather |
Period of the calculations: WeatherStartDate and WeatherEndDate
For the dates instead of the slash (“\”) it is allowed to use another date-separator. Always use 2 digits for the day and month, and 4 for the year.
Select Global radiation model: 0 = Supit/Hargreaves, 2 = Choisnel
[Simulation]
This section includes the settings for the crop simulation. Select first the period of the simulation. Start month, start year and the number of campaigns (years) to simulate: SimCroStartMonth, SimCroStartYear, SimCroCampaignYears. For the current year select the period to produce output to database: SimcroOutputStartDecade and SimcroOutputEndDecade.
Because of the CALPLAT mode it is possible to save results per day in stead of decade. Therefore use the variable SimCroOutputYield:
0 = Decade
1 = Daily
Independent you can run the Potential and/or Waterlimited run.
SimCroRunPot: Run Potential simulation
SimCroRunWL: Run Water limited simulation
Select weather data to use for simulation: SimCroWeatherData
1 = Ground Weather
2 = Model Weather daily
3 = Model Weather 10-daily
4 = Model Weather monthly
Select Start/stop mode: StartEndMode
1 = Normal simulation
2 = Intermediate stop at specific date
3 = Intermediate stop at Crop parameter
4 = Intermediate start at Specific date
5 = Intermediate start at Crop parameter
Initialisation of water balance: InitWaterBalance
0 = No initialisation
1 = Automatic, use all weather available prior to emergence
-x = Fixed number of days (x) prior to emergence
2 = Fixed date available in table INITIAL_SOIL_WATER
Simulate with or without ground water influence GWInfluence:
0 = without ground water influence
1 = with ground water influence
Simulate with or without winterkill: Winterkill
0 = without winterkill
1 = with winterkill
Select all crops to simulate: Crop
Enter in this order: CropNo, CropgroupNo, CropName, CropModel
Select Administrative region of interest. All available or a specific selected area. In the latter case enter NUTS_NAME from the NUTS table for the specific NUTS level: SimCroAdminLevel1, SimCroAdminLevel2, SimCroAdminLevel3
[Aggregation]
This section includes the settings for the data aggregation.
First select schematization to use: Schematization
1 = Landcover (climate grid cell/SMU/land cover/admin. region)
2 = soil suitability (climate grid cell/SMU/admin. region)
Select Spatial level: SpatialLevel
1 = Administrative region
2 = Climate grid cells
Select indicator: AggIndicator
1 = Simulated crop yield
2 = FAO
3 = NDVI
4 = Ground weather
5 = Daily
6 = 10-Daily
Select Period in years: AggStartYear and AggEndYear
[Preparation]
This section includes the settings for the preparation of data for yield forecast calculation.
Select yield forecast analysis: Analyse
1 = Linear regression
2 = Scenario analyses
3 = User specified equation
Select Administrative region of interest. All available or a specific selected area. In the latter case enter NUTS_NAME from the NUTS table for the specific NUTS level: PrepAdminLevel1, PrepAdminLevel2, PrepAdminLevel3
Select Period: PrepStartYear and PrepEndYear
Select all crops to prepare: StatCrop
Enter in this order: StatCropName, StatCropNo, SimCropName, SimCropNo
Select the indicators. The number of indicators depends on the analysis:
Linear regression 4 indicators,
Scenario analyses max 10 indicators,
User specified equation 2 indicators.
For the category meteo enter is this order:
category, indicator name, period, begin, end, formula, threshold, weather
Category:
1 = Meteo
2 = Simulated crop
3 = Other
Indicator Name:
Group Meteo:
Tmin (minimum temperature)
Tmax (maximum temperature)
Tmean (mean temperature)
Precipitation (rainfall)
PET (potential evapotranspiration, ET0)
CWB (climatic water balance = rainfall minus potential evapotranspiration) Radiation (radiation)
Group simulated crop:
PYB (potential dry weight biomass)
WLYB (water limited dry weight biomass)
PYS (potential dry weight storage organs)
WLYS (water limited dry weight storage organs)
PLAI (potential leaf area index: leaf area divided by surface area)
WLAI (water limited leaf area index: leaf area divided by surface area)
Group other:
WSI (FAO Water Satisfaction Index)
NDVI (Normalised Difference Vegetation Index)
CNDVI (Corine-NDVI)
Period:
ABS = Absolute (decade) [1-36]
REL = Relative to development stage [0-200]Begin and End indicate period as indicated before. It means decade or development stage.
Formula:
SUM = Sum
AVG = Average
Threshold: NoThreshold if no threshold value or else enter double value.
Weather:
Ground = Ground Weather
Model1 = Model Weather daily
Model10 = Model Weather 10-daily
For the categories Simulated crop and others just enter
category, indicator name, period, end (DVS value or decade)
In case of user specified analysis also enter the equation coefficients of the equation:
Y = a*X1^d + b*X2 + c
Enter EquationCoefs in this order: a, b, c, d
[Import]
This section includes the settings for the import of external data.
Select data type: DataType
1 = FAO, Water Index Model
2 = NDVI remote sensing indicators
3 = CNDVI remote sensing indicators
4 = Initial hydrologic conditions
5 = “Start” and “Stop” days
6 = Model weather daily
7 = Model weather 10-daily
8 = Model weather montly
9 = Crop Calendar
Enter number of lines of header (lines are skipped): HeaderLines
Enter name (full path) of the data file: ImpFileName
[Export]
This section includes the settings for the export of external data.
Select table to export. To select the table FORECASTED_NUTS_YIELD set ExpDecade to 0. To export table CROP_YIELD ExpDecade is decade to export.
Select year to export: ExpYear
Select crop to export: ExpCropNr. Enter Crop Number for export of CROP_YIELD or StatCropNumbers for the export of FORECASTED_NUTS_YIELD.
