-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/initialize albedo cesm driver #712
Feature/initialize albedo cesm driver #712
Conversation
…lize_albedo_cesm_driver_2
…dgergel/VIC into feature/initialize_albedo_cesm_driver_2
…o feature/initialize_albedo_cesm_driver_2"" This reverts commit e1d5d17.
…lize_albedo_cesm_driver_2
…ve travis test debugging value from calc_gridcell_avg_albedo
@bartnijssen and @jhamman, this is (finally) ready for review. |
docs/Development/ReleaseNotes.md
Outdated
@@ -51,14 +51,16 @@ To check which release of VIC you are running: | |||
|
|||
1. Fixes Julian day for the first timestep in the dmy struct for the CESM driver. | |||
|
|||
3. Speed up NetCDF operations in the image/CESM drivers ([GH#684](https://github.com/UW-Hydro/VIC/pull/684)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by the numbering and the edits on previous pull requests. Please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This deletion was a mistake, it shouldn't have been here. Fixed.
double ***tmpT; | ||
double **tmpZ; | ||
int ErrorFlag; | ||
|
||
cell_data_struct **cell; | ||
energy_bal_struct **energy; | ||
veg_var_struct **veg_var; | ||
gridcell_avg_struct gridcell_avg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a pointer. You don't want to copy the whole structure, you just want to point to the structure
|
||
cell = all_vars->cell; | ||
energy = all_vars->energy; | ||
veg_var = all_vars->veg_var; | ||
gridcell_avg = all_vars->gridcell_avg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if gridcell_avg
is a pointer, then this would read
gridcell_avg = &(all_vars->gridcell_avg);
Or just get rid of it. Seems to me that later in the same code you just use all_vars->gridcell_avg
directly anyway, so you don't really need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - I just deleted it since I'm using all_vars->gridcell_avg
instead.
} | ||
} | ||
} | ||
all_vars->gridcell_avg.avg_albedo = albedo_sum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment: Either use the local variable gridcell_avg
(but change to a pointer) and use
gridcell_avg->avg_albedo = albedo_sum;
or get rid of local variable and just leave this as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left it as is and deleted the local variable gridcell_avg
.
@@ -30,7 +30,7 @@ | |||
* @brief This routine creates the list of output data. | |||
*****************************************************************************/ | |||
void | |||
alloc_out_data(size_t ngridcells, | |||
alloc_out_data(size_t ngridcells, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure you run all the code through uncrustify
(see: https://github.com/UW-Hydro/VIC/tree/master/tools/code_format)
} | ||
} | ||
|
||
// compute gridcell-averaged albedo using average longwave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
longwave
should not be part of any albedo calculation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed - this was a typo, since I'm not actually using longwave
…lize_albedo_cesm_driver_2
// compute gridcell-averaged albedo using average longwave | ||
// and shortwave over gridcell | ||
|
||
// compute gridcell-averaged albedo using average longwave shortwave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still says longwave
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh yes. This was careless.
closes #new tests addedscience test figuresThis PR adds functionality for computing gridcell-averaged albedo for all drivers at each timestep. The purpose of this is to initialize and correctly compute albedo in the CESM driver to pass to WRF, but it has been implemented in all drivers for the sake of consistency. It includes the following components and additions to the core structure of VIC:
gridcell_avg
, toall_vars
, whereavg_albedo
(gridcell-averaged albedo) is storedSTATE_AVG_ALBEDO
, for reading and writing gridcell-averaged albedocalc_gridcell_avg_albedo.c
, tovic_run
to compute gridcell-averaged albedo at each time stepvic_initialize_albedo()
, contained invic_cesm_init_library.c
, to CESM driver incesm_interface_c.c
for settingl2x
albedo values to reasonable estimates during the initialization phase