Skip to content

Commit f2a3d3c

Browse files
author
Joe Hamman
committed
fixed initialization bug in
Fix the bug of #455 when `options.VEGPARAM_LAI == FALSE`
2 parents bdd64b5 + 86ed848 commit f2a3d3c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/read_vegparam.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ veg_con_struct *read_vegparam(FILE *vegparam,
214214
for(k=0; k<Nfields; k++)
215215
free(vegarr[k]);
216216

217+
for ( j = 0; j < MONTHSPERYEAR; j++ ) {
218+
temp[i].albedo[j] = veg_lib[temp[i].veg_class].albedo[j];
219+
temp[i].LAI[j] = veg_lib[temp[i].veg_class].LAI[j];
220+
temp[i].vegcover[j] = veg_lib[temp[i].veg_class].vegcover[j];
221+
temp[i].Wdmax[j] = veg_lib[temp[i].veg_class].Wdmax[j];
222+
}
223+
217224
if ( options.VEGPARAM_LAI ) {
218225
// Read the LAI line
219226
if ( fgets( line, MAXSTRING, vegparam ) == NULL ){
@@ -238,14 +245,7 @@ veg_con_struct *read_vegparam(FILE *vegparam,
238245
sprintf(ErrStr,"ERROR - cell %d - expecting %d LAI values but found %d in line %s\n",gridcel, NfieldsMax, Nfields, line);
239246
nrerror(ErrStr);
240247
}
241-
242-
for ( j = 0; j < MONTHSPERYEAR; j++ ) {
243-
temp[i].albedo[j] = veg_lib[temp[i].veg_class].albedo[j];
244-
temp[i].LAI[j] = veg_lib[temp[i].veg_class].LAI[j];
245-
temp[i].vegcover[j] = veg_lib[temp[i].veg_class].vegcover[j];
246-
temp[i].Wdmax[j] = veg_lib[temp[i].veg_class].Wdmax[j];
247-
}
248-
248+
249249
if (options.LAI_SRC == FROM_VEGPARAM) {
250250
for ( j = 0; j < 12; j++ ) {
251251
tmp = atof( vegarr[j] );

0 commit comments

Comments
 (0)