Skip to content

Commit

Permalink
apply .clang-format (OSGeo#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilason authored Dec 22, 2022
1 parent 8de925f commit e0fe056
Show file tree
Hide file tree
Showing 416 changed files with 28,532 additions and 28,488 deletions.
2 changes: 1 addition & 1 deletion imagery/i.albedo/bb_alb_aster.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Broadband albedo Aster
* After Liang, S.L., 2001.
* After Liang, S.L., 2001.
* Narrowband to broadband conversion of land surface albedo 1 Algorithms.
* Remote Sensing of Environment. 2001, 76, 213-238.
* Input: Ref1, ref3, Ref5, Ref6, Ref8, Ref9
Expand Down
6 changes: 3 additions & 3 deletions imagery/i.albedo/bb_alb_aster2bands.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Broadband albedo Aster
* Salleh and Chan, 2014.
* Land Surface Albedo Determination:
* Remote Sensing and Statistical Validation.
* Salleh and Chan, 2014.
* Land Surface Albedo Determination:
* Remote Sensing and Statistical Validation.
* in proceedings of FIG 2014.
* https://www.fig.net/resources/proceedings/fig_proceedings/fig2014/papers/ts05g/TS05G_salleh_chan_6910.pdf
* Input: Ref1, Ref3
Expand Down
5 changes: 2 additions & 3 deletions imagery/i.albedo/bb_alb_landsat.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ double bb_alb_landsat(double bluechan, double greenchan, double redchan,
{
double result;

result =
(0.293 * bluechan + 0.274 * greenchan + 0.233 * redchan +
0.156 * nirchan + 0.033 * chan5 + 0.011 * chan7);
result = (0.293 * bluechan + 0.274 * greenchan + 0.233 * redchan +
0.156 * nirchan + 0.033 * chan5 + 0.011 * chan7);
return result;
}
18 changes: 9 additions & 9 deletions imagery/i.albedo/bb_alb_landsat8.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/* Broadband albedo Landsat OLI 8
* Simple weighted average from band 2 - 7
* Temporary until a publication creates an algorithm
-* chan5 is OLI Band 6 (1.57-1.65)
* chan5 is OLI Band 6 (1.57-1.65)
* chan7 is OLI band 7 (2.11-2.29)
*
*
* Temporary better fix than weighted average
* ------------------------------------------
* r.regression.multi
* mapx=LC81270512014115LGN00.toar.1,LC81270512014115LGN00.toar.2,
* LC81270512014115LGN00.toar.3,LC81270512014115LGN00.toar.4,
* LC81270512014115LGN00.toar.5,LC81270512014115LGN00.toar.6,
* LC81270512014115LGN00.toar.7
* mapy=MCD43_2014113
*
* mapy=MCD43_2014113
*
*/
double bb_alb_landsat8(double shortbluechan, double bluechan,
double greenchan, double redchan, double nirchan,
double chan5, double chan7)
double bb_alb_landsat8(double shortbluechan, double bluechan, double greenchan,
double redchan, double nirchan, double chan5,
double chan7)
{
double result;

result = 0.058674 + shortbluechan * 2.153642 + bluechan * (-2.242688) +
greenchan * (-0.520669) + redchan * 0.622670 + nirchan * 0.129979 +
chan5 * (-0.047970) + chan7 * 0.152228;
greenchan * (-0.520669) + redchan * 0.622670 + nirchan * 0.129979 +
chan5 * (-0.047970) + chan7 * 0.152228;
return result;
}
9 changes: 4 additions & 5 deletions imagery/i.albedo/bb_alb_modis.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/*
/*
* Broadband albedo MODIS
*/
double bb_alb_modis(double redchan, double nirchan, double chan3,
double chan4, double chan5, double chan6, double chan7)
double bb_alb_modis(double redchan, double nirchan, double chan3, double chan4,
double chan5, double chan6, double chan7)
{
double result;

result =
(0.22831 * redchan + 0.15982 * nirchan +
0.09132 * (chan3 + chan4 + chan5) + 0.10959 * chan6 +
0.22831 * chan7);
0.09132 * (chan3 + chan4 + chan5) + 0.10959 * chan6 + 0.22831 * chan7);
return result;
}
4 changes: 2 additions & 2 deletions imagery/i.albedo/bb_alb_noaa.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Broadband albedo NOAA AVHRR 14
/*
* Broadband albedo NOAA AVHRR 14
* (maybe others too but not sure)
*/
double bb_alb_noaa(double redchan, double nirchan)
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.albedo/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ double bb_alb_landsat(double bluechan, double greenchan, double redchan,
double nirchan, double chan5, double chan7);
double bb_alb_noaa(double redchan, double nirchan);

double bb_alb_modis(double redchan, double nirchan, double chan3,
double chan4, double chan5, double chan6, double chan7);
double bb_alb_modis(double redchan, double nirchan, double chan3, double chan4,
double chan5, double chan6, double chan7);
68 changes: 32 additions & 36 deletions imagery/i.albedo/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/****************************************************************************
*
* MODULE: i.albedo
Expand All @@ -8,12 +7,12 @@
*
* COPYRIGHT: (C) 2004-2014 by the GRASS Development Team
*
* This program is free software under the GNU Lesser General Public
* License. Read the file COPYING that comes with GRASS for details.
* This program is free software under the GNU Lesser General
* Public License. Read the file COPYING that comes with GRASS
* for details.
*
*****************************************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -29,31 +28,31 @@ double bb_alb_aster(double greenchan, double nirchan, double swirchan2,
double bb_alb_landsat(double bluechan, double greenchan, double redchan,
double nirchan, double chan5, double chan7);

double bb_alb_landsat8(double shortbluechan, double bluechan,
double greenchan, double redchan,
double nirchan, double chan5, double chan7);
double bb_alb_landsat8(double shortbluechan, double bluechan, double greenchan,
double redchan, double nirchan, double chan5,
double chan7);

double bb_alb_noaa(double redchan, double nirchan);

double bb_alb_modis(double redchan, double nirchan, double chan3,
double chan4, double chan5, double chan6, double chan7);
double bb_alb_modis(double redchan, double nirchan, double chan3, double chan4,
double chan5, double chan6, double chan7);

int main(int argc, char *argv[])
{
struct Cell_head cellhd; /*region+header info */
struct Cell_head cellhd; /*region+header info */
int nrows, ncols;
int row, col;
struct GModule *module;
struct Option *input, *output;
struct Flag *flag1, *flag2, *flag3;
struct Flag *flag4, *flag5, *flag6;
struct Flag *flag7;
struct History history; /*metadata */
struct Colors colors; /*Color rules */
struct History history; /*metadata */
struct Colors colors; /*Color rules */

/************************************/
char *name; /*input raster name */
char *result; /*output raster name */
char *name; /*input raster name */
char *result; /*output raster name */

/*File Descriptors */
int nfiles;
Expand All @@ -66,7 +65,7 @@ int main(int argc, char *argv[])
void *inrast[MAXFILES];
unsigned char *outrast;

RASTER_MAP_TYPE in_data_type[MAXFILES]; /* 0=numbers 1=text */
RASTER_MAP_TYPE in_data_type[MAXFILES]; /* 0=numbers 1=text */
RASTER_MAP_TYPE out_data_type = DCELL_TYPE;
CELL val1, val2;

Expand All @@ -77,7 +76,7 @@ int main(int argc, char *argv[])
int bottom1a, bottom1b;
int bottom2a, bottom2b;
int bottom3a, bottom3b;
int i_bottom1a /*, i_bottom1b */ ;
int i_bottom1a /*, i_bottom1b */;
int /* i_bottom2a, */ i_bottom2b;

/* int i_bottom3a, i_bottom3b; */
Expand Down Expand Up @@ -136,16 +135,16 @@ int main(int argc, char *argv[])
flag6 = G_define_flag();
flag6->key = 'c';
flag6->label = _("Aggressive mode (Landsat)");
flag6->description =
_("Albedo dry run to calculate some water to beach/sand/desert stretching, "
"a kind of simple atmospheric correction");
flag6->description = _("Albedo dry run to calculate some water to "
"beach/sand/desert stretching, "
"a kind of simple atmospheric correction");

flag7 = G_define_flag();
flag7->key = 'd';
flag7->label = _("Soft mode (MODIS)");
flag7->description =
_("Albedo dry run to calculate some water to beach/sand/desert stretching, "
"a kind of simple atmospheric correction");
flag7->description = _("Albedo dry run to calculate some water to "
"beach/sand/desert stretching, "
"a kind of simple atmospheric correction");

/* FMEO init nfiles */
nfiles = 1;
Expand All @@ -165,8 +164,7 @@ int main(int argc, char *argv[])

for (; *ptr != NULL; ptr++) {
if (nfiles >= MAXFILES)
G_fatal_error(_("Too many input maps. Only %d allowed."),
MAXFILES);
G_fatal_error(_("Too many input maps. Only %d allowed."), MAXFILES);
name = *ptr;

/* Allocate input buffer */
Expand Down Expand Up @@ -212,19 +210,18 @@ int main(int argc, char *argv[])
for (i = 1; i <= nfiles; i++) {
switch (in_data_type[i]) {
case CELL_TYPE:
d[i] = (double)((CELL *) inrast[i])[col];
d[i] = (double)((CELL *)inrast[i])[col];
break;
case FCELL_TYPE:
d[i] = (double)((FCELL *) inrast[i])[col];
d[i] = (double)((FCELL *)inrast[i])[col];
break;
case DCELL_TYPE:
d[i] = (double)((DCELL *) inrast[i])[col];
d[i] = (double)((DCELL *)inrast[i])[col];
break;
}
}
if (modis) {
de = bb_alb_modis(d[1], d[2], d[3], d[4], d[5], d[6],
d[7]);
de = bb_alb_modis(d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
}
else if (avhrr) {
de = bb_alb_noaa(d[1], d[2]);
Expand Down Expand Up @@ -353,7 +350,7 @@ int main(int argc, char *argv[])
b = 0.05 - a * (i_bottom1a / 100.0);
G_message("a= %f\tb= %f", a, b);
}
} /*END OF FLAG1 */
} /*END OF FLAG1 */
/* End of processing histogram */

/* Process pixels */
Expand All @@ -371,13 +368,13 @@ int main(int argc, char *argv[])
for (i = 1; i <= nfiles; i++) {
switch (in_data_type[i]) {
case CELL_TYPE:
d[i] = (double)((CELL *) inrast[i])[col];
d[i] = (double)((CELL *)inrast[i])[col];
break;
case FCELL_TYPE:
d[i] = (double)((FCELL *) inrast[i])[col];
d[i] = (double)((FCELL *)inrast[i])[col];
break;
case DCELL_TYPE:
d[i] = (double)((DCELL *) inrast[i])[col];
d[i] = (double)((DCELL *)inrast[i])[col];
break;
}
}
Expand All @@ -391,8 +388,7 @@ int main(int argc, char *argv[])
de = bb_alb_landsat(d[1], d[2], d[3], d[4], d[5], d[6]);
}
else if (landsat8) {
de = bb_alb_landsat8(d[1], d[2], d[3], d[4], d[5], d[6],
d[7]);
de = bb_alb_landsat8(d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
}
else if (aster) {
de = bb_alb_aster(d[1], d[2], d[3], d[4], d[5], d[6]);
Expand All @@ -401,7 +397,7 @@ int main(int argc, char *argv[])
/* Post-Process Albedo */
de = a * de + b;
}
((DCELL *) outrast)[col] = de;
((DCELL *)outrast)[col] = de;
}
Rast_put_row(outfd, outrast, out_data_type);
}
Expand Down
5 changes: 2 additions & 3 deletions imagery/i.aster.toar/gain_aster.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include<stdio.h>
#include<stdlib.h>

#include <stdio.h>
#include <stdlib.h>

/* Gain values LUT for ASTER */
double gain_aster(int band_number, int gain_code)
Expand Down
Loading

0 comments on commit e0fe056

Please sign in to comment.