Previous Page Table of Contents Next Page


Chapter 3
Program AEZCCS02

Program AEZCCS02 generates tables of expected primary yield by crop for all admissible combinations of pattern codes and length of growing period zone codes. Individual pattern component LGP yields are added up using pattern distribution probability weights to arrive at expected average annual yields under single cropping. In addition to average yields, expected output under best and worst climatic conditions is calculated. This information is written out to an unformatted random access file, RND02, for later use in land productivity assessment, program AEZCCS03.

3.1 Program Logic and Overview

After reading the program control data file CTRL02, some global data buffers are cleared (subroutine CLRALL) and relevant crop productivity data tables are extracted from random access files (subroutine TBGETO).

The main body of the program consists of a four-fold nested loop: over two broad soil unit types (IFLV LOOP), a range of pattern codes (IPTN LOOP), and a range of length of growing period codes (ILGP LOOP). After clearing some required yield data buffers (subroutine CLRLNV), the inner-most loop runs over a range of crop codes (ICRP LOOP). Then, the crop type specific dominant pattern component LGP is determined (function DLGP) and crop cycle requirements are tested against the number of days available for plant growth (function FITSIN). Expected yield by individual pattern component LGP is computed (subroutine YLDPTN) and weighted by the probability of occurrence of each pattern, to arrive at average yields for given climatic conditions (subroutine YLDAVG). Minimum, maximum and average yields are saved to random access file RND02 for use in land productivity assessment, program AEZCCS03. When all crop yields have been evaluated for a specific set of climatic conditions the LGP and/or pattern code is incremented and the yield calculations are repeated.

The information flow in program AEZCCS02 is summarized in Figure 3.1.

FIGURE 3.1
Program structure AEZCCS02

Figure 3.1

3.2 Input/Output File Sizes and Connections

Unit NrFile NameFileb) TypeRecord Length (bytes)Number of Recordsa) File Size (bytes)I/Oc) Mode
5CTRL02FS80151200R
6PRINTERFS132V-W
11RND01UR1921800345600R
12RND02d)UR98634046213592W

a) ‘V’ indicates a variable, district or country specific number of records.

b) FS = formatted sequential, UR = unformatted random access.

c) R = input, W = output.

d) Since yield information is saved only for crops which exceed the productivity threshold level, the actual number of records and size of file RND02 is significantly less than the indicated maximum file size (about 2Mb in the Kenya Case Study).

3.3 Subprogram Description :

Name :AEZCCS02
Type:Main program
Purpose :Executive program structure for yield table calculation.
Called by :none
Calls to :CLRALL, CLRLNV, CLR4BI, DLGP, ERROR, FITSIN, TBGETO, YLDPTN, YLDAVG
Arguments :none
Box Ref. :1.2
  
Name :CLRALL
Type:subroutine
Arguments :none
Purpose :At start-up of program clear data buffers for ‘in-core’ tables.
Called by :MAIN
Calls to :CLR2BI, CLR4BR
Box Ref. :2.1
  
Name :CLRLNV
Type:subroutine
Arguments :none
Purpose :Clear yield table data buffers before processing next pair of pattern / LGP code combination.
Called by :MAIN
Calls to :CLRCH1, CLR4BR
Box Ref. :2.3
  
Name :CLRCH1(buf, n, val)
Type:subroutine
Arguments :character*10, integer, character*l
 buf : data buffer to be initialized
 n : number of elements to be initialized
 val : value to be assigned to data buffer elements
Purpose :Initialize a specified number of elements of a one byte character array to a given value.
Called by :CLRLNV
Calls to :none
Box Ref. :none
  
Name :CLR2BI (buf, n, val)
Type:subroutine
Arguments :integer*20, integer, integer
 buf : data buffer to be initialized
 n. : number of elements to be initialized
 val : value to be assigned to data buffer elements
Purpose :Initialize a specified number of elements of a two byte integer array to a given value.
Called by :CLRALL
Calls to :none
Box Ref. :none
  
Name :CLR4BI (buf, n, val)
Type:subroutine
Arguments :integer*40, integer, integer
 buf : data buffer to be initialized
 n : number of elements to be initialized
 val : value to be assigned to data buffer elements
Purpose :Initialize a specified number of elements of a four byte integer array to a given value.
Called by :MAIN
Calls to :none
Box Ref. :none
  
Name :CLR4BR (buf, n, val)
Type:subroutine
Arguments :real*40, integer, real*4
 buf : data buffer to be initialized
 n. : number of elements to be initialized
 val : value to be assigned to data buffer elements
Purpose :Initialize a specified number of elements of a four byte real array to a given value.
Called by :CLRALL, CLRLNV
Calls to :none
Box Ref. :none
  
Name :DLGP (iptn, ilgp, msk)
Type:integer*2 function
Arguments :integer*2, integer*2, integer*2
 iptn : pattern code
 ilgp : LGP code
 msk : crop mask type
Purpose :Find longest component length of growing period in dominant pattern for given pattern code, LGP code, and mask-type of crop.
Called by :MAIN
Calls to :none
Box Ref. :2.4
  
Name :ERROR (ityp, ifatal)
Type:subroutine
Arguments :integer, integer
 ityp : error code
 ifatal. : error level
Purpose :Display an error message.
Called by :MAIN, TBGETO
Calls to :none
Box Ref. :none
  
Name :FITSIN (icrp, ilgp, length)
Type:logical function
Arguments :integer, integer*2, integer*2
 icrp : sequential crop number
 ilgp : LGP code
 length. : days available for plant growth
Purpose :Check average crop cycle requirements of a particular crop against days available for plant growth.
Called by :MAIN
Calls to :ISWLR
Box Ref. :2.5
  
Name :ISWLR (icrp)
Type:logical function
Arguments :integer
icrp : sequential crop number
Purpose :Is crop of type wet-land rice ?.
Called by :FITSIN
Calls to :none
Box Ref. :2.8
  
Name :TBGETO
Type:subroutine
Arguments :none
Purpose :Set up ‘in core’ tables of productivity assessment rules which are independent of land inventory parameters related to mapping unit.
Called by :MAIN
Calls to :none
Box Ref. :2.2
  
Name :WSTRF (icrp, iptn, ilgp, ptg)
Type:real*4 function
 icrp : sequential crop number
 iptn : rainfall pattern code
 ilgp : LGP code
 ptg : pattern group indicator
Arguments :integer, integer*2, integer*2, integer*2
Purpose :Determine water stress yield multiplier for permanent crops under L2, L3, and L4 conditions.
Called by :YLDPTN
Calls to :none
Box Ref. :2.10
  
Name :YLDAVG (icrp)
Type:subroutine
Arguments :integer
 icrp : sequential crop number
Purpose :Calculate minimum, average and maximum primary yield of a particular crop for a given Pattern / LGP code combination as weighted sum over relevant pattern component LGP yields.
Called by :MAIN
Calls to :none
Box Ref. :2.7
  
Name :YLDPTN (icrp, iflv)
Type :subroutine
Arguments ;integer, integer
 icrp : sequential crop number
 iflv : fluvisol indicator
Purpose :Determine primary yield of particular crop for individual pattern component LGPs, i.e. H, LI, L2, L21, L22, L3, L31, L32, L33, L4, L41, L42, L43, L44, D.
Called by :MAIN
Calls to :WSTRF
Box Ref. :2.6

3.4 Program Control Data, File

TABLE 3.1 CTRL02 Control input data for program AEZCCS02

Each AEZ-CCS program is controlled by a short input data file which is usually read from standard input. Table 3.1 shows an example used to run program AEZCCS02 generating yield table information for intermediate level of input.

For testing purposes the output to the unformatted random access file specified by variable FNRND2, file RND02I in the example below, can be suppressed. The control file can also beset up to selectively specify climatic conditions and ranges of crops, where

Card Nr.Variable nameData file contentsFormat specification
01FNDBGDBG02I(A50)
02FNRND1RND01I(A50)
03FNRND2RND02I(A50)
04ITECH2(12)
05IDEBUG1(12)
06IRAND1(12)
07LBFLV0(12)
08UBFLV1(12)
09LBPTN102)
10UBFTN22(12)
11LBLGP1(12)
12UBLGP15(12)
13LBCRP1(12)
14UBCRP65(12)
15YLIMIT0.20(F4.2)

FNRND1=name of unformatted random access file (including full path) containing converted productivity assessment rules.
FNRND2=name of unformatted random access file (including full path) to contain generated primary crop yield tables for use in programs AEZCCS03.
ITECH=1-digit input level designator :
1 = low input level, 2 = intermediate input level, 3 = high input level
IDEBUG=debug level; controlling level of detail of information to be written out to debug file FNDBG during program execution.
IRAND=random access write flag : 1 = do not create file FNRND2 2 = generate yield tables and write to file FNRND2
LBFLV=lower limit of loop over soil types; (0 = all except fluvisols, 1 = fluvi-sols).
UBFLV=upper limit of loop over soil types; (0 = all except fluvisols, 1 = fluvisols).
LBPTN=lower limit of loop over pattern codes.
UBPTN=upper limit of loop over pattern codes.
LBLGP=lower limit of loop over LGP codes.
UBLGP=upper limit of loop over LGP codes.
LBCRP=lower limit of loop over crop codes.
UBCRP=upper limit of loop over crop codes.
YLIMIT=primary productivity threshold level relative to maximum attainabla yield out must be exceeded for considering crops in assessment.

Previous Page Top of Page Next Page