LCOV - code coverage report
Current view: top level - frmts/grib/degrib/g2clib - pdstemplates.c (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 54 243 22.2 %
Date: 2024-11-21 22:18:42 Functions: 4 4 100.0 %

          Line data    Source code
       1             : #include <stdlib.h>
       2             : #include "grib2.h"
       3             : #include "pdstemplates.h"
       4             : 
       5             : /* GDAL: in original g2clib, this is in pdstemplates.h */
       6             : static const struct pdstemplate templatespds[MAXPDSTEMP] = {
       7             :              // 4.0: Analysis or Forecast at Horizontal Level/Layer
       8             :              //      at a point in time
       9             :          {0,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
      10             :              // 4.1: Individual Ensemble Forecast at Horizontal Level/Layer
      11             :              //      at a point in time
      12             :          {1,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} },
      13             :              // 4.2: Derived Fcst based on whole Ensemble at Horiz Level/Layer
      14             :              //      at a point in time
      15             :          {2,17,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1} },
      16             :              // 4.3: Derived Fcst based on Ensemble cluster over rectangular
      17             :              //      area at Horiz Level/Layer at a point in time
      18             :          {3,31,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,-4,4,4,1,-1,4,-1,4} },
      19             :              // 4.4: Derived Fcst based on Ensemble cluster over circular
      20             :              //      area at Horiz Level/Layer at a point in time
      21             :          {4,30,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,4,4,1,-1,4,-1,4} },
      22             :              // 4.5: Probablility Forecast at Horiz Level/Layer
      23             :              //      at a point in time
      24             :          {5,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,-1,-4,-1,-4} },
      25             :              // 4.6: Percentile Forecast at Horiz Level/Layer
      26             :              //      at a point in time
      27             :          {6,16,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} },
      28             :              // 4.7: Analysis or Forecast Error at Horizontal Level/Layer
      29             :              //      at a point in time
      30             :          {7,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
      31             :              // 4.8: Ave/Accum/etc... at Horiz Level/Layer
      32             :              //      in a time interval
      33             :          {8,29,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      34             :              // 4.9: Probablility Forecast at Horiz Level/Layer
      35             :              //      in a time interval
      36             :          {9,36,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,-1,-4,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      37             :              // 4.10: Percentile Forecast at Horiz Level/Layer
      38             :              //       in a time interval
      39             :          {10,30,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      40             :              // 4.11: Individual Ensemble Forecast at Horizontal Level/Layer
      41             :              //       in a time interval
      42             :          {11,32,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      43             :              // 4.12: Derived Fcst based on whole Ensemble at Horiz Level/Layer
      44             :              //       in a time interval
      45             :          {12,31,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      46             :              // 4.13: Derived Fcst based on Ensemble cluster over rectangular
      47             :              //       area at Horiz Level/Layer in a time interval
      48             :          {13,45,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,-4,4,4,1,-1,4,-1,4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      49             :              // 4.14: Derived Fcst based on Ensemble cluster over circular
      50             :              //       area at Horiz Level/Layer in a time interval
      51             :          {14,44,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,4,4,1,-1,4,-1,4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      52             :              // 4.15: Average, accumulation, extreme values or other statistically-processed values over a
      53             :              // spatial area at a horizontal level or in a horizontal layer at a point in time
      54             :          {15,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} },
      55             :              // 4.20: Radar Product
      56             :          {20,19,0, {1,1,1,1,1,-4,4,2,4,2,1,1,1,1,1,2,1,3,2} },
      57             :              // 4.30: Satellite Product
      58             :          {30,5,1, {1,1,1,1,1} },
      59             :              // 4.31: Satellite Product
      60             :          {31,5,1, {1,1,1,1,1} },
      61             :              // 4.40: Analysis or forecast at a horizontal level or in a horizontal layer
      62             :              // at a point in time for atmospheric chemical constituents
      63             :          {40,16,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
      64             :              // 4.41: Individual ensemble forecast, control and perturbed, at a horizontal level or
      65             :              // in a horizontal layer at a point in time for atmospheric chemical constituents
      66             :          {41,19,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} },
      67             :              // 4.42: Average, accumulation, and/or extreme values or other statistically-processed values
      68             :              // at a horizontal level or in a horizontal layer in a continuous or non-continuous
      69             :              // time interval for atmospheric chemical constituents
      70             :          {42,30,1, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      71             :              // 4.43: Individual ensemble forecast, control and perturbed, at a horizontal level
      72             :              // or in a horizontal layer in a continuous or non-continuous
      73             :              // time interval for atmospheric chemical constituents
      74             :          {43,33,1, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
      75             :              // 4.254: CCITT IA5 Character String
      76             :          {254,3,0, {1,1,4} },
      77             :              // 4.1000: Cross section of analysis or forecast
      78             :              //         at a point in time
      79             :          {1000,9,0, {1,1,1,1,1,2,1,1,-4} },
      80             :              // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast
      81             :              //         in a time interval
      82             :          {1001,16,0, {1,1,1,1,1,2,1,1,4,4,1,1,1,4,1,4} },
      83             :              // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast
      84             :              //         over latitude or longitude
      85             :          {1002,15,0, {1,1,1,1,1,2,1,1,-4,1,1,1,4,4,2} },
      86             :              // 4.1100: Hovmoller-type grid w/ no averaging or other
      87             :              //         statistical processing
      88             :          {1100,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
      89             :              // 4.1100: Hovmoller-type grid with averaging or other
      90             :              //         statistical processing
      91             :          {1101,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,4,1,1,1,4,1,4} },
      92             :              // 4.32:Simulate (synthetic) Satellite Product
      93             :          {32,10,1, {1,1,1,1,1,2,1,1,-4,1} }, // (last-1)th coefficient corrected from - 2 to -4 by ERO
      94             :              // 4.44: Analysis or forecast at a horizontal level or in a horizontal layer
      95             :              // at a point in time for Aerosol
      96             :          {44,21,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-2,1,-1,-4,1,-1,-4} },
      97             :              // 4.45: Individual ensemble forecast, control and 
      98             :              // perturbed,  at a horizontal level or in a horizontal layer
      99             :              // at a point in time for Aerosol
     100             :          {45,24,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} },
     101             :              // 4.46: Ave or Accum or Extreme value at level/layer
     102             :              // at horizontal level or in a horizontal in a continuous or
     103             :              // non-continuous time interval for Aerosol
     104             :          {46,35,1, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
     105             :              // 4.47: Individual ensemble forecast, control and 
     106             :              // perturbed, at horizontal level or in a horizontal
     107             :              // in a continuous or non-continuous time interval for Aerosol
     108             :          {47,38,1, {1,1,1,2,1,-1,-4,-1,-4,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
     109             : 
     110             :              //             PDT 4.48
     111             :              // 4.48: Analysis or forecast at a horizontal level or in a horizontal layer
     112             :              // at a point in time for Optical Properties of Aerosol
     113             :          {48,26,0, {1,1,2,1,-1,-4,-1,-4,1,-1,-4,-1,-4,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
     114             : 
     115             :              //             VALIDATION --- PDT 4.50
     116             :              // 4.50: Analysis or forecast of multi component parameter or
     117             :              // matrix element at a point in time
     118             :          {50,21,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,4,4,4,4} },
     119             : 
     120             :              //             VALIDATION --- PDT 4.52
     121             :              // 4.52: Analysis or forecast of Wave parameters
     122             :              // at the Sea surface at a point in time
     123             :          {52,15,0, {1,1,1,1,1,1,1,1,2,1,1,-4,1,-1,-4} },
     124             : 
     125             :              // 4.51: Categorical forecasts at a horizontal level or
     126             :              // in a horizontal layer at a point in time
     127             :          {51,16,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} },
     128             : 
     129             :              // 4.91: Categorical forecasts at a horizontal level or
     130             :              // in a horizontal layer at a point in time
     131             :              // in a continuous or non-continuous time interval
     132             :          {91,36,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,-1,-4,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
     133             : // PDT 4.33  (07/29/2013)
     134             :              // 4.33: Individual ensemble forecast, control, perturbed,
     135             :              // at a horizontal level or in a  horizontal layer
     136             :              // at a point in time for simulated (synthetic) Satellite data
     137             :          {33,18,1, {1,1,1,1,1,2,1,1,-4,1,2,2,2,-1,-4,1,1,1} },
     138             : // PDT 4.34  (07/29/2013)
     139             :              // 4.34: Individual ensemble forecast, control, perturbed,
     140             :              // at a horizontal level or in a  horizontal layer,in a continuous or
     141             :              // non-continuous interval for simulated (synthetic) Satellite data
     142             :          {34,32,1, {1,1,1,1,1,2,1,1,-4,1,2,2,2,-1,-4,1,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
     143             : // PDT 4.53  (07/29/2013)
     144             :              // 4.53:  Partitioned parameters at
     145             :              // horizontal level or horizontal layer
     146             :              // at a point in time
     147             :          {53,19,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} },
     148             : // PDT 4.54  (07/29/2013)
     149             :              // 4.54: Individual ensemble forecast, control, perturbed,
     150             :              // at a horizontal level or in a  horizontal layer
     151             :              // at a point in time for partitioned parameters
     152             :          {54,22,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} },
     153             : // PDT 4.57  (10/07/2015)
     154             :              // 4.57: Analysis or Forecast at a horizontal or in a
     155             :              // horizontal layer at a point in time for
     156             :              // atmospheric chemical constituents based on 
     157             :              // a distribution function
     158             :          {57,7,1, {1,1,2,2,2,2,1} },
     159             : // PDT 4.60  (10/07/2015)
     160             :              // 4.60: Individual ensemble reforecast, control and perturbed,
     161             :              // at a horizontal level or in a horizontal layer
     162             :              // at a point in time
     163             :          {60,24,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1} },
     164             : // PDT 4.61  (10/07/2015)
     165             :              // 4.61: Individual ensemble reforecast, control and perturbed,
     166             :              // at a horizontal level or in a  horizontal layer
     167             :              // in a continuous or non-continuous time interval
     168             :          {61,38,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,4,1,1,1,4,1,4} },
     169             : //             VALIDATION --- PDT 4.35
     170             : // PDT 4.35  (10/07/2015)
     171             :              // 4.35: Individual ensemble reforecast, control and perturbed,
     172             :              // at a horizontal level or in a  horizontal layer
     173             :              // in a continuous or non-continuous time interval
     174             :          {35,6,1, {1,1,1,1,1,1} }
     175             : 
     176             :       } ;
     177             : 
     178        7779 : const struct pdstemplate *get_templatespds()
     179             : {
     180        7779 :     return templatespds;
     181             : }
     182             : 
     183        2547 : g2int getpdsindex(g2int number)
     184             : ///$$$  SUBPROGRAM DOCUMENTATION BLOCK
     185             : //                .      .    .                                       .
     186             : // SUBPROGRAM:    getpdsindex
     187             : //   PRGMMR: Gilbert         ORG: W/NP11    DATE: 2001-06-28
     188             : //
     189             : // ABSTRACT: This function returns the index of specified Product
     190             : //   Definition Template 4.NN (NN=number) in array templates.
     191             : //
     192             : // PROGRAM HISTORY LOG:
     193             : // 2001-06-28  Gilbert
     194             : // 2009-01-14  Vuong     Changed structure name template to gtemplate
     195             : // 2009-12-15  Vuong     Added Product Definition Template 4.31
     196             : //                       Added Product Definition Template 4.15
     197             : // 2010-08-03  Vuong     Added Product Definition Template 4.42 and 4.43
     198             : // 2010-12-08  Vuong     Corrected Product Definition Template 4.42 and 4.43
     199             : // 2012-03-29  Vuong     Added Templates 4.44,4.45,4.46,4.47,4.48,4.50,
     200             : //                       4.51,4.91,4.32 and 4.52
     201             : // 2013-08-05  Vuong     Corrected 4.91 and added Templates 4.33,4.34,4.53,4.54
     202             : // 2015-10-07  Vuong     Added Templates 4.57, 4.60, 4.61 and
     203             : //                       allow a forecast time to be negative
     204             : // USAGE:    index=getpdsindex(number)
     205             : //   INPUT ARGUMENT LIST:
     206             : //     number   - NN, indicating the number of the Product Definition
     207             : //                Template 4.NN that is being requested.
     208             : //
     209             : // RETURNS:  Index of PDT 4.NN in array templates, if template exists.
     210             : //           = -1, otherwise.
     211             : //
     212             : // REMARKS: None
     213             : //
     214             : // ATTRIBUTES:
     215             : //   LANGUAGE: C
     216             : //   MACHINE:  IBM SP
     217             : //
     218             : //$$$/
     219             : {
     220        2547 :            g2int j,l_getpdsindex=-1;
     221             : 
     222       11071 :            for (j=0;j<MAXPDSTEMP;j++) {
     223       11060 :               if (number == templatespds[j].template_num) {
     224        2536 :                  l_getpdsindex=j;
     225        2536 :                  return(l_getpdsindex);
     226             :               }
     227             :            }
     228             : 
     229          11 :            return(l_getpdsindex);
     230             : }
     231             : 
     232             : 
     233        1292 : gtemplate *getpdstemplate(g2int number)
     234             : ///$$$  SUBPROGRAM DOCUMENTATION BLOCK
     235             : //                .      .    .                                       .
     236             : // SUBPROGRAM:    getpdstemplate
     237             : //   PRGMMR: Gilbert         ORG: W/NP11    DATE: 2000-05-11
     238             : //
     239             : // ABSTRACT: This subroutine returns PDS template information for a
     240             : //   specified Product Definition Template 4.NN.
     241             : //   The number of entries in the template is returned along with a map
     242             : //   of the number of octets occupied by each entry.  Also, a flag is
     243             : //   returned to indicate whether the template would need to be extended.
     244             : //
     245             : // PROGRAM HISTORY LOG:
     246             : // 2000-05-11  Gilbert
     247             : // 2009-01-14  Vuong     Changed structure name template to gtemplate
     248             : // 2009-08-05  Vuong     Added Product Definition Template 4.31
     249             : // 2010-08-03  Vuong     Added Product Definition Template 4.42 and 4.43
     250             : // 2010-12-08  Vuong     Corrected Product Definition Template 4.42 and 4.43
     251             : // 2012-02-15  Vuong     Added Templates 4.44,4.45,4.46,4.47,4.48,4.50,
     252             : //                       4.51,4.91,4.32 and 4.52
     253             : // 2013-08-05  Vuong     Corrected 4.91 and added Templates 4.33,4.34,4.53,4.54
     254             : // 2015-10-07  Vuong     Added Templates 4.57, 4.60, 4.61 and
     255             : //                       allow a forecast time to be negative
     256             : //
     257             : // USAGE:    CALL getpdstemplate(number)
     258             : //   INPUT ARGUMENT LIST:
     259             : //     number   - NN, indicating the number of the Product Definition
     260             : //                Template 4.NN that is being requested.
     261             : //
     262             : //   RETURN VALUE:
     263             : //        - Pointer to the returned template struct.
     264             : //          Returns NULL pointer, if template not found.
     265             : //
     266             : // REMARKS: None
     267             : //
     268             : // ATTRIBUTES:
     269             : //   LANGUAGE: C
     270             : //   MACHINE:  IBM SP
     271             : //
     272             : //$$$/
     273             : {
     274             :            g2int l_index;
     275             :            gtemplate *new;
     276             : 
     277        1292 :            l_index=getpdsindex(number);
     278             : 
     279        1292 :            if (l_index != -1) {
     280        1287 :               new=(gtemplate *)malloc(sizeof(gtemplate));
     281        1287 :               new->type=4;
     282        1287 :               new->num=templatespds[l_index].template_num;
     283        1287 :               new->maplen=templatespds[l_index].mappdslen;
     284        1287 :               new->needext=templatespds[l_index].needext;
     285        1287 :               new->map=(g2int *)templatespds[l_index].mappds;
     286        1287 :               new->extlen=0;
     287        1287 :               new->ext=0;        //NULL
     288        1287 :               return(new);
     289             :            }
     290             :            else {
     291             :              //printf("getpdstemplate: PDS Template 4.%d not defined.\n",(int)number);
     292           5 :              return(0);        //NULL
     293             :            }
     294             : 
     295             :          return(0);        //NULL
     296             : }
     297             : 
     298             : 
     299         458 : gtemplate *extpdstemplate(g2int number,g2int *list)
     300             : ///$$$  SUBPROGRAM DOCUMENTATION BLOCK
     301             : //                .      .    .                                       .
     302             : // SUBPROGRAM:    extpdstemplate
     303             : //   PRGMMR: Gilbert         ORG: W/NP11    DATE: 2000-05-11
     304             : //
     305             : // ABSTRACT: This subroutine generates the remaining octet map for a
     306             : //   given Product Definition Template, if required.  Some Templates can
     307             : //   vary depending on data values given in an earlier part of the
     308             : //   Template, and it is necessary to know some of the earlier entry
     309             : //   values to generate the full octet map of the Template.
     310             : //
     311             : // PROGRAM HISTORY LOG:
     312             : // 2000-05-11  Gilbert
     313             : // 2009-01-14  Vuong     Changed structure name template to gtemplate
     314             : // 2009-08-05  Vuong     Added Product Definition Template 4.31
     315             : // 2010-08-03  Vuong     Added Product Definition Template 4.42 and 4.43
     316             : // 2010-12-08  Vuong     Corrected Product Definition Template 4.42 and 4.43
     317             : // 2012-02-15  Vuong     Added Templates 4.44,4.45,4.46,4.47,4.48,4.50,
     318             : //                       4.51,4.91,4.32 and 4.52
     319             : // 2013-08-05  Vuong     Corrected 4.91 and added Templates 4.33,4.34,4.53,4.54
     320             : // 2015-10-07  Vuong     Added Templates 4.57, 4.60, 4.61 and
     321             : //                       allow a forecast time to be negative
     322             : //
     323             : // USAGE:    CALL extpdstemplate(number,list)
     324             : //   INPUT ARGUMENT LIST:
     325             : //     number   - NN, indicating the number of the Product Definition
     326             : //                Template 4.NN that is being requested.
     327             : //     list()   - The list of values for each entry in the
     328             : //                the Product Definition Template 4.NN.
     329             : //
     330             : //   RETURN VALUE:
     331             : //        - Pointer to the returned template struct.
     332             : //          Returns NULL pointer, if template not found.
     333             : //
     334             : // ATTRIBUTES:
     335             : //   LANGUAGE: C
     336             : //   MACHINE:  IBM SP
     337             : //
     338             : //$$$
     339             : {
     340             :            gtemplate *new;
     341             :            g2int l_index,i,j,k,l;
     342             : 
     343         458 :            l_index=getpdsindex(number);
     344         458 :            if (l_index == -1) return(0);
     345             : 
     346         458 :            new=getpdstemplate(number);
     347         458 :            if (new == NULL) return NULL;
     348             : 
     349         458 :            if ( ! new->needext ) return(new);
     350             : 
     351         152 :            if ( number == 3 ) {
     352           0 :               new->extlen=list[26];
     353           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     354           0 :               for (i=0;i<new->extlen;i++) {
     355           0 :                  new->ext[i]=1;
     356             :               }
     357             :            }
     358         152 :            else if ( number == 4 ) {
     359           0 :               new->extlen=list[25];
     360           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     361           0 :               for (i=0;i<new->extlen;i++) {
     362           0 :                  new->ext[i]=1;
     363             :               }
     364             :            }
     365         152 :            else if ( number == 8 ) {
     366         115 :               if ( list[21] > 1 ) {
     367           0 :                  new->extlen=(list[21]-1)*6;
     368           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     369           0 :                  for (j=2;j<=list[21];j++) {
     370           0 :                     l=(j-2)*6;
     371           0 :                     for (k=0;k<6;k++) {
     372           0 :                        new->ext[l+k]=new->map[23+k];
     373             :                     }
     374             :                  }
     375             :               }
     376             :            }
     377          37 :            else if ( number == 9 ) {
     378           0 :               if ( list[28] > 1 ) {
     379           0 :                  new->extlen=(list[28]-1)*6;
     380           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     381           0 :                  for (j=2;j<=list[28];j++) {
     382           0 :                     l=(j-2)*6;
     383           0 :                     for (k=0;k<6;k++) {
     384           0 :                        new->ext[l+k]=new->map[30+k];
     385             :                     }
     386             :                  }
     387             :               }
     388             :            }
     389          37 :            else if ( number == 10 ) {
     390           0 :               if ( list[22] > 1 ) {
     391           0 :                  new->extlen=(list[22]-1)*6;
     392           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     393           0 :                  for (j=2;j<=list[22];j++) {
     394           0 :                     l=(j-2)*6;
     395           0 :                     for (k=0;k<6;k++) {
     396           0 :                        new->ext[l+k]=new->map[24+k];
     397             :                     }
     398             :                  }
     399             :               }
     400             :            }
     401          37 :            else if ( number == 11 ) {
     402           0 :               if ( list[24] > 1 ) {
     403           0 :                  new->extlen=(list[24]-1)*6;
     404           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     405           0 :                  for (j=2;j<=list[24];j++) {
     406           0 :                     l=(j-2)*6;
     407           0 :                     for (k=0;k<6;k++) {
     408           0 :                        new->ext[l+k]=new->map[26+k];
     409             :                     }
     410             :                  }
     411             :               }
     412             :            }
     413          37 :            else if ( number == 12 ) {
     414          10 :               if ( list[23] > 1 ) {
     415           0 :                  new->extlen=(list[23]-1)*6;
     416           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     417           0 :                  for (j=2;j<=list[23];j++) {
     418           0 :                     l=(j-2)*6;
     419           0 :                     for (k=0;k<6;k++) {
     420           0 :                        new->ext[l+k]=new->map[25+k];
     421             :                     }
     422             :                  }
     423             :               }
     424             :            }
     425          27 :            else if ( number == 13 ) {
     426           0 :               new->extlen=(list[37] > 1 ? ((list[37]-1)*6) : 0)+list[26];
     427           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     428           0 :               if ( list[37] > 1 ) {
     429           0 :                  for (j=2;j<=list[37];j++) {
     430           0 :                     l=(j-2)*6;
     431           0 :                     for (k=0;k<6;k++) {
     432           0 :                        new->ext[l+k]=new->map[39+k];
     433             :                     }
     434             :                  }
     435             :               }
     436           0 :               l=(list[37]-1)*6;
     437           0 :               if ( l<0 ) l=0;
     438           0 :               for (i=0;i<list[26];i++) {
     439           0 :                 new->ext[l+i]=1;
     440             :               }
     441             :            }
     442          27 :            else if ( number == 14 ) {
     443           0 :               new->extlen=(list[36] > 1 ? ((list[36]-1)*6) : 0) +list[25];
     444           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     445           0 :               if ( list[36] > 1 ) {
     446           0 :                  for (j=2;j<=list[36];j++) {
     447           0 :                     l=(j-2)*6;
     448           0 :                     for (k=0;k<6;k++) {
     449           0 :                        new->ext[l+k]=new->map[38+k];
     450             :                     }
     451             :                  }
     452             :               }
     453           0 :               l=(list[36]-1)*6;
     454           0 :               if ( l<0 ) l=0;
     455           0 :               for (i=0;i<list[25];i++) {
     456           0 :                 new->ext[l+i]=1;
     457             :               }
     458             :            }
     459          27 :            else if ( number == 30 ) {
     460           0 :               new->extlen=list[4]*5;
     461           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     462           0 :               for (i=0;i<list[4];i++) {
     463           0 :                  l=i*5;
     464           0 :                  new->ext[l]=2;
     465           0 :                  new->ext[l+1]=2;
     466           0 :                  new->ext[l+2]=1;
     467           0 :                  new->ext[l+3]=1;
     468           0 :                  new->ext[l+4]=4;
     469             :               }
     470             :            }
     471          27 :            else if ( number == 31 ) {
     472           0 :               new->extlen=list[4]*5;
     473           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     474           0 :               for (i=0;i<list[4];i++) {
     475           0 :                  l=i*5;
     476           0 :                  new->ext[l]=2;
     477           0 :                  new->ext[l+1]=2;
     478           0 :                  new->ext[l+2]=2;
     479           0 :                  new->ext[l+3]=1;
     480           0 :                  new->ext[l+4]=4;
     481             :               }
     482             :            }
     483          27 :            else if ( number == 42 ) {
     484           0 :               if ( list[22] > 1 ) {
     485           0 :                  new->extlen=(list[22]-1)*6;
     486           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     487           0 :                  for (j=2;j<=list[22];j++) {
     488           0 :                     l=(j-2)*6;
     489           0 :                     for (k=0;k<6;k++) {
     490           0 :                        new->ext[l+k]=new->map[24+k];
     491             :                     }
     492             :                  }
     493             :               }
     494             :            }
     495          27 :            else if ( number == 43 ) {
     496           0 :               if ( list[25] > 1 ) {
     497           0 :                  new->extlen=(list[25]-1)*6;
     498           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     499           0 :                  for (j=2;j<=list[25];j++) {
     500           0 :                     l=(j-2)*6;
     501           0 :                     for (k=0;k<6;k++) {
     502           0 :                        new->ext[l+k]=new->map[27+k];
     503             :                     }
     504             :                  }
     505             :               }
     506             :            }
     507          27 :            else if ( number == 32 ) {
     508          27 :               new->extlen=list[9]*5; /* ERO: was 10, but wrong given the below loop */
     509          27 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     510          77 :               for (i=0;i<list[9];i++) {
     511          50 :                  l=i*5;
     512          50 :                  new->ext[l]=2;
     513          50 :                  new->ext[l+1]=2;
     514          50 :                  new->ext[l+2]=2;
     515          50 :                  new->ext[l+3]=-1;
     516          50 :                  new->ext[l+4]=-4;
     517             :               }
     518             :            }
     519           0 :            else if ( number == 46 ) {
     520           0 :               if ( list[27] > 1 ) {
     521           0 :                  new->extlen=(list[27]-1)*6;
     522           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     523           0 :                  for (j=2;j<=list[27];j++) {
     524           0 :                     l=(j-2)*6;
     525           0 :                     for (k=0;k<6;k++) {
     526           0 :                        new->ext[l+k]=new->map[29+k];
     527             :                     }
     528             :                  }
     529             :               }
     530             :            }
     531           0 :            else if ( number == 47 ) {
     532           0 :               if ( list[30] > 1 ) {
     533           0 :                  new->extlen=(list[30]-1)*6;
     534           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     535           0 :                  for (j=2;j<=list[30];j++) {
     536           0 :                     l=(j-2)*6;
     537           0 :                     for (k=0;k<6;k++) {
     538           0 :                        new->ext[l+k]=new->map[32+k];
     539             :                     }
     540             :                  }
     541             :               }
     542             :            }
     543           0 :            else if ( number == 51 ) {
     544           0 :               new->extlen=list[15]*6; /* GDAL fix */
     545           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     546           0 :               for (i=0;i<list[15];i++) {
     547           0 :                  l=i*6;
     548           0 :                  new->ext[l]=1;
     549           0 :                  new->ext[l+1]=1;
     550           0 :                  new->ext[l+2]=-1;
     551           0 :                  new->ext[l+3]=-4;
     552           0 :                  new->ext[l+4]=-1;
     553           0 :                  new->ext[l+5]=-4;
     554             :               }
     555             :            }
     556           0 :            else if ( number == 33 ) {
     557           0 :               new->extlen=list[9];
     558           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     559           0 :               for (i=0;i<new->extlen;i++) {
     560           0 :                  new->ext[i]=1;
     561             :               }
     562             :            }
     563           0 :            else if ( number == 34 ) {
     564           0 :               new->extlen=(list[24] > 1 ? ((list[24]-1)*6) : 0)+list[9];
     565           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     566           0 :               if ( list[24] > 1 ) {
     567           0 :                  for (j=2;j<=list[24];j++) {
     568           0 :                     l=(j-2)*6;
     569           0 :                     for (k=0;k<6;k++) {
     570           0 :                        new->ext[l+k]=new->map[26+k];
     571             :                     }
     572             :                  }
     573             :               }
     574           0 :               l=(list[24]-1)*6;
     575           0 :               if ( l<0 ) l=0;
     576           0 :               for (i=0;i<list[9];i++) {
     577           0 :                 new->ext[l+i]=1;
     578             :               }
     579             :            }
     580           0 :            else if ( number == 53 ) {
     581           0 :               new->extlen=list[3];
     582           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     583           0 :               for (i=0;i<new->extlen;i++) {
     584           0 :                  new->ext[i]=1;
     585             :               }
     586             :            }
     587           0 :            else if ( number == 54 ) {
     588           0 :               new->extlen=list[3];
     589           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     590           0 :               for (i=0;i<new->extlen;i++) {
     591           0 :                  new->ext[i]=1;
     592             :               }
     593             :            }
     594           0 :            else if ( number == 91 ) {
     595           0 :               new->extlen=(list[28] > 1 ? ((list[28]-1)*6) : 0)+list[15];
     596           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     597           0 :               if ( list[28] > 1 ) {
     598           0 :                  for (j=2;j<=list[28];j++) {
     599           0 :                     l=(j-2)*6;
     600           0 :                     for (k=0;k<6;k++) {
     601           0 :                        new->ext[l+k]=new->map[30+k];
     602             :                     }
     603             :                  }
     604             :               }
     605           0 :               l=(list[28]-1)*6; /* GDAL fix */
     606           0 :               if ( l<0 ) l=0;
     607           0 :               for (i=0;i<list[15];i++) {
     608           0 :                 new->ext[l+i]=1;
     609             :               }
     610             :              }
     611             : // PDT 4.57  (10/07/2015)
     612           0 :            else if ( number == 57 ) {
     613           0 :               new->extlen=list[6]*15;
     614           0 :               new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     615           0 :               for (i=0;i<list[6];i++) {
     616           0 :                  l=i*15;
     617           0 :                  new->ext[l]=1;
     618           0 :                  new->ext[l+1]=-4;
     619           0 :                  new->ext[l+2]=1;
     620           0 :                  new->ext[l+3]=1;
     621           0 :                  new->ext[l+4]=1;
     622           0 :                  new->ext[l+5]=2;
     623           0 :                  new->ext[l+6]=1;
     624           0 :                  new->ext[l+7]=1;
     625           0 :                  new->ext[l+8]=-4;
     626           0 :                  new->ext[l+9]=1;
     627           0 :                  new->ext[l+10]=-1;
     628           0 :                  new->ext[l+11]=-4;
     629           0 :                  new->ext[l+12]=1;
     630           0 :                  new->ext[l+13]=-1;
     631           0 :                  new->ext[l+14]=-4;
     632             :               }
     633             :            }
     634             : // PDT 4.61  (10/07/2015)
     635           0 :            else if ( number == 61 ) {
     636           0 :               if ( list[30] > 1 ) {
     637           0 :                  new->extlen=(list[30]-1)*6;
     638           0 :                  new->ext=(g2int *)malloc(sizeof(g2int)*new->extlen);
     639           0 :                  for (j=2;j<=list[30];j++) {
     640           0 :                     l=(j-2)*6;
     641           0 :                     for (k=0;k<6;k++) {
     642           0 :                        new->ext[l+k]=new->map[32+k];
     643             :                     }
     644             :                  }
     645             :               }
     646             :            }
     647             : 
     648         152 :            return(new);
     649             : 
     650             : }
     651             : 

Generated by: LCOV version 1.14