Changeset 33613


Ignore:
Timestamp:
Sep 30, 2008, 3:19:18 AM (16 years ago)
Author:
martinl
Message:

i.vi: follow GRASS coding style

Please update missing vi description...

Location:
grass/trunk/imagery/i.vi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/imagery/i.vi/i.vi.html

    r33581 r33613  
    11<H2>DESCRIPTION</H2>
    22
    3 <EM>i.vi</EM> calculates vegetation indices based on biophysical parameters.
     3<EM>i.vi</EM> calculates vegetation indices based on biophysical
     4parameters.
    45
    5 1. RVI: ratio vegetation index:
    6 2. NDVI: Normalized Difference Vegetation Index
    7 3: IPVI: Infrared Percentage Vegetation Index
    8 4: DVI: Difference Vegetation Index
    9 5: PVI: Perpendicular Vegetation Index
    10 6: WDVI: Weighted Difference Vegetation Index
    11 7: SAVI: Soil Adjusted Vegetation Index
    12 8: GARI: Green atmospherically resistant vegetation index
    13 9: MSAVI: Modified Soil Adjusted Vegetation Index
    14 10:MSAVI2: second Modified Soil Adjusted Vegetation Index
    15 11:GEMI: Global Environmental Monitoring Index
    16 12:ARVI: atmospherically resistant vegetation indices
    17 13:GVI: Green Vegetation Index
     6<ul>
     7  <li>RVI: ratio vegetation index</li>
     8  <li>NDVI: Normalized Difference Vegetation Index</li>
     9  <li>IPVI: Infrared Percentage Vegetation Index</li>
     10  <li>DVI: Difference Vegetation Index</li>
     11  <li>PVI: Perpendicular Vegetation Index</li>
     12  <li>WDVI: Weighted Difference Vegetation Index</li>
     13  <li>SAVI: Soil Adjusted Vegetation Index</li>
     14  <li>GARI: Green atmospherically resistant vegetation index</li>
     15  <li>MSAVI: Modified Soil Adjusted Vegetation Index</li>
     16  <li>MSAVI2: second Modified Soil Adjusted Vegetation Index</li>
     17  <li>GEMI: Global Environmental Monitoring Index</li>
     18  <li>ARVI: atmospherically resistant vegetation indices</li>
     19  <li>GVI: Green Vegetation Index</li>
     20</ul>
    1821
     22<pre>
    1923NDVI
    2024Data Type Band Numbers ([IR, Red])
     
    2731
    2832(AVHRR) NDVI = (channel 2 - channel 1) / (channel 2 + channel 1)
    29 
     33</pre>
    3034
    3135<H2>NOTES</H2>
     36
     37<pre>
    3238Originally from kepler.gps.caltech.edu
    3339A FAQ on Vegetation in Remote Sensing
     
    4147             Mail Code 170-25
    4248             Pasadena, CA  91125
    43 
    44 <H2>TODO</H2>
    45 
     49</pre>
    4650
    4751<H2>SEE ALSO</H2>
    4852
    4953<em>
    50 <A HREF="i.albedo.html">i.albedo</A><br>
     54  <a href="i.albedo.html">i.albedo</a>
    5155</em>
    5256
    5357
    5458<H2>AUTHORS</H2>
    55 Baburao Kamble, Asian Institute of Technology, Thailand<BR>
    56 Yann Chemin, Asian Institute of Technology, Thailand<BR>
    57 
     59Baburao Kamble, Asian Institute of Technology, Thailand<br>
     60Yann Chemin, Asian Institute of Technology, Thailand<br>
    5861
    5962<p>
  • grass/trunk/imagery/i.vi/main.c

    r33586 r33613  
    7373
    7474    module = G_define_module();
    75     module->keywords = _("vegetation index, biophysical parameters");
    76     module->description =
    77         _("14 types of vegetation indices from red and nir, and only some requiring additional bands");
    78 
     75    module->keywords = _("imagery, vegetation index, biophysical parameters");
     76    module->label =
     77        _("Calculates different types of vegetation indices.");
     78    module->description = _("Uses red and nir, "
     79                            "and only some requiring additional bands.");
     80   
    7981    /* Define the different options */
    8082    input1 = G_define_option();
     
    8284    input1->type = TYPE_STRING;
    8385    input1->required = YES;
    84     input1->gisprompt = _("Name of VI");
    85     input1->description =
    86         _("Name of VI: sr,ndvi,ipvi,dvi,evi,pvi,wdvi,savi,msavi,msavi2,gemi,arvi,gvi,gari.");
    87 
    88     input1->answer = _("ndvi");
     86    input1->description = _("Name of vegetation index");
     87    input1->descriptions =_("sr;???"
     88                            "ndvi;Normalized Difference Vegetation Index;"
     89                            "ipvi;Infrared Percentage Vegetation Index;"
     90                            "dvi;Difference Vegetation Index;"
     91                            "evi;???"
     92                            "pvi;Perpendicular Vegetation Index;"
     93                            "wdvi;Weighted Difference Vegetation Index;"
     94                            "savi;Soil Adjusted Vegetation Index;"
     95                            "msavi;Modified Soil Adjusted Vegetation Index;"
     96                            "msavi2;second Modified Soil Adjusted Vegetation Index;"
     97                            "gemi;Global Environmental Monitoring Index;"
     98                            "arvi;Atmospherically Resistant Vegetation Indices;"
     99                            "gvi;Green Vegetation Index;"
     100                            "gari;Green atmospherically resistant vegetation index;");
     101    input1->answer = "ndvi";
     102
    89103    input2 = G_define_standard_option(G_OPT_R_INPUT);
    90     input2->key = _("red");
    91     input2->description =
    92         _("Name of the RED Channel surface reflectance map [0.0;1.0]");
     104    input2->key = "red";
     105    input2->label =
     106        _("Name of the red channel surface reflectance map");
     107    input2->description = _("Range: [0.0;1.0]");
    93108
    94109    input3 = G_define_standard_option(G_OPT_R_INPUT);
    95     input3->key = _("nir");
    96     input3->description =
    97         _("Name of the NIR Channel surface reflectance map [0.0;1.0]");
     110    input3->key = "nir";
     111    input3->label =
     112        _("Name of the nir channel surface reflectance map");
     113    input3->description = _("Range: [0.0;1.0]");
    98114
    99115    input4 = G_define_standard_option(G_OPT_R_INPUT);
    100     input4->key = _("green");
     116    input4->key = "green";
    101117    input4->required = NO;
    102     input4->description =
    103         _("Name of the GREEN Channel surface reflectance map [0.0;1.0]");
    104 
     118    input4->label =
     119        _("Name of the green channel surface reflectance map");
     120    input4->description = _("Range: [0.0;1.0]");
     121   
    105122    input5 = G_define_standard_option(G_OPT_R_INPUT);
    106     input5->key = _("blue");
     123    input5->key = "blue";
    107124    input5->required = NO;
    108     input5->description =
    109         _("Name of the BLUE Channel surface reflectance map [0.0;1.0]");
     125    input5->label =
     126        _("Name of the blue channel surface reflectance map");
     127    input5->description = _("Range: [0.0;1.0]");
    110128
    111129    input6 = G_define_standard_option(G_OPT_R_INPUT);
    112     input6->key = _("chan5");
     130    input6->key = "chan5";
    113131    input6->required = NO;
    114     input6->description =
    115         _("Name of the CHAN5 Channel surface reflectance map [0.0;1.0]");
     132    input6->label =
     133        _("Name of the chan5 channel surface reflectance map");
     134    input6->description = _("Range: [0.0;1.0]");
    116135
    117136    input7 = G_define_standard_option(G_OPT_R_INPUT);
    118     input7->key = _("chan7");
     137    input7->key = "chan7";
    119138    input7->required = NO;
    120     input7->description =
    121         _("Name of the CHAN7 Channel surface reflectance map [0.0;1.0]");
     139    input7->label =
     140        _("Name of the chan7 channel surface reflectance map");
     141    input7->description = _("Range: [0.0;1.0]");
    122142
    123143    output = G_define_standard_option(G_OPT_R_OUTPUT);
    124     output->description = _("Name of the output vi layer");
    125144
    126145    if (G_parser(argc, argv))
     
    137156
    138157    if ((infd_redchan = G_open_cell_old(redchan, "")) < 0)
    139         G_fatal_error(_("Cannot open cell file [%s]"), redchan);
     158        G_fatal_error(_("Unable to open raster map <%s>"), redchan);
    140159    inrast_redchan = G_allocate_d_raster_buf();
    141160
    142161    if ((infd_nirchan = G_open_cell_old(nirchan, "")) < 0)
    143         G_fatal_error(_("Cannot open cell file [%s]"), nirchan);
     162        G_fatal_error(_("Unable to open raster map <%s>"), nirchan);
    144163    inrast_nirchan = G_allocate_d_raster_buf();
    145164
    146165    if (greenchan) {
    147166        if ((infd_greenchan = G_open_cell_old(greenchan, "")) < 0)
    148             G_fatal_error(_("Cannot open cell file [%s]"), greenchan);
     167            G_fatal_error(_("Unable to open raster map <%s>"), greenchan);
    149168        inrast_greenchan = G_allocate_d_raster_buf();
    150169    }
     
    152171    if (bluechan) {
    153172        if ((infd_bluechan = G_open_cell_old(bluechan, "")) < 0)
    154             G_fatal_error(_("Cannot open cell file [%s]"), bluechan);
     173            G_fatal_error(_("Unable to open raster map <%s>"), bluechan);
    155174        inrast_bluechan = G_allocate_d_raster_buf();
    156175    }
     
    158177    if (chan5chan) {
    159178        if ((infd_chan5chan = G_open_cell_old(chan5chan, "")) < 0)
    160             G_fatal_error(_("Cannot open cell file [%s]"), chan5chan);
     179            G_fatal_error(_("Unable to open raster map <%s>"), chan5chan);
    161180        inrast_chan5chan = G_allocate_d_raster_buf();
    162181    }
     
    164183    if (chan7chan) {
    165184        if ((infd_chan7chan = G_open_cell_old(chan7chan, "")) < 0)
    166             G_fatal_error(_("Cannot open cell file [%s]"), chan7chan);
     185            G_fatal_error(_("Unable to open raster map <%s>"), chan7chan);
    167186        inrast_chan7chan = G_allocate_d_raster_buf();
    168187    }
     
    174193    /* Create New raster files */
    175194    if ((outfd = G_open_raster_new(result, DCELL_TYPE)) < 0)
    176         G_fatal_error(_("Could not open <%s>"), result);
     195        G_fatal_error(_("Unable to create raster map <%s>"), result);
    177196
    178197    /* Process pixels */
    179198    for (row = 0; row < nrows; row++)
    180199    {
    181         DCELL d;
    182200        DCELL d_bluechan;
    183201        DCELL d_greenchan;
     
    190208
    191209        if (G_get_d_raster_row(infd_redchan, inrast_redchan, row) < 0)
    192             G_fatal_error(_("Could not read from <%s>"), redchan);
     210            G_fatal_error(_("Unable to read raster map <%s> row %d"),
     211                          redchan, row);
    193212        if (G_get_d_raster_row(infd_nirchan, inrast_nirchan, row) < 0)
    194             G_fatal_error(_("Could not read from <%s>"), nirchan);
     213            G_fatal_error(_("Unable to read raster map <%s> row %d"),
     214                          nirchan, row);
    195215        if (greenchan) {
    196216            if (G_get_d_raster_row(infd_greenchan, inrast_greenchan, row) < 0)
    197                 G_fatal_error(_("Could not read from <%s>"), greenchan);
     217                G_fatal_error(_("Unable to read raster map <%s> row %d"),
     218                              greenchan, row);
    198219        }
    199220        if (bluechan) {
    200221            if (G_get_d_raster_row(infd_bluechan, inrast_bluechan, row) < 0)
    201                 G_fatal_error(_("Could not read from <%s>"), bluechan);
     222                G_fatal_error(_("Unable to read raster map <%s> row %d"),
     223                              bluechan, row);
    202224        }
    203225        if (chan5chan) {
    204226            if (G_get_d_raster_row(infd_chan5chan, inrast_chan5chan, row) < 0)
    205                 G_fatal_error(_("Could not read from <%s>"), chan5chan);
     227                G_fatal_error(_("Unable to read raster map <%s> row %d"),
     228                              chan5chan, row);
    206229        }
    207230        if (chan7chan) {
    208231            if (G_get_d_raster_row(infd_chan7chan, inrast_chan7chan, row) < 0)
    209                 G_fatal_error(_("Could not read from <%s>"), chan7chan);
     232                G_fatal_error(_("Unable to read raster map <%s> row %d"),
     233                              chan7chan, row);
    210234        }
    211235
     
    280304        }
    281305        if (G_put_d_raster_row(outfd, outrast) < 0)
    282             G_fatal_error(_("Cannot write to output raster file"));
     306            G_fatal_error(_("Failed writing raster map <%s> row %d"),
     307                          result, row);
    283308    }
    284309
     
    313338    G_command_history(&history);
    314339    G_write_history(result, &history);
     340   
    315341    exit(EXIT_SUCCESS);
    316342}
Note: See TracChangeset for help on using the changeset viewer.