Skip to content
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

Miscellaneous clean-up and minor fixes. #723

Merged
merged 25 commits into from
Feb 3, 2018

Conversation

@jhamman jhamman requested a review from dgergel July 12, 2017 19:03
@jhamman
Copy link
Member

jhamman commented Jul 12, 2017

Thanks @tbohn. Can you update your branch with the updates I merged in to develop today? I'm going to let @dgergel have the first review here and @bartnijssen and I will follow her up.

@tbohn
Copy link
Contributor Author

tbohn commented Jul 12, 2017

Actually, @jhamman @dgergel and @bartnijssen can you hold on a little bit? The pull request isn't final yet; I may make another simplification. I will definitely merge the latest develop mods into my branch too.

I'll let you know when this is ready. Thanks!

@dgergel
Copy link
Contributor

dgergel commented Jul 12, 2017

@tbohn sure. Just let me know when it's ready.

double penman(double, double, double, double, double, double, double);
void photosynth(char, double, double, double, double, double, double, double,
double, double, char *, double *, double *, double *, double *,
double *);
void polint(double xa[], double ya[], int n, double x, double *y, double *dy);
void prepare_full_energy(int, all_vars_struct *, soil_con_struct *, double *,
void prepare_full_energy(cell_data_struct *, energy_bal_struct *,
soil_con_struct *, double *,
double *);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to prepare_full_energy() is the only non-format modification. The rest of the changes in vic_run.h came from running uncrustify.

@tbohn tbohn mentioned this pull request Dec 18, 2017
10 tasks
@tbohn tbohn changed the title Feature/clean up vic run Miscellaneous clean-up and minor fixes. Dec 18, 2017
Copy link
Member

@jhamman jhamman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a brief pass and generally like what is going on here. It would be great if @yixinmao and/or @dgergel could give it a full review before we merge it.

@@ -218,7 +218,7 @@ The following options describe the input parameter files.
| VEGPARAM_ALB | string | TRUE or FALSE | If TRUE the vegetation parameter file contains an extra line for each vegetation type that defines monthly ALBEDO values for each vegetation type for each grid cell. Default = FALSE. |
| ALB_SRC | string | N/A | This option tells VIC where to look for ALBEDO values:FROM_VEGLIB = Use the ALBEDO values listed in the vegetation library file. FROM_VEGPARAM = Use the ALBEDO values listed in the vegetation parameter file. Note: for this to work, VEGPARAM_ALB must be TRUE.FROM_VEGHIST = Use the ALBEDO values listed in the veg_hist forcing files. Note: for this to work, ALBEDO must be supplied in the veg_hist files and listed in the global parameter file as one of the variables in the files. Default = FROM_VEGLIB. |
| VEGPARAM_LAI | string | TRUE or FALSE | If TRUE the vegetation parameter file contains an extra line for each vegetation type that defines monthly LAI values for each vegetation type for each grid cell. Default = FALSE. |
| LAI_SRC | string | N/A | This option tells VIC where to look for LAI values:FROM_VEGLIB = Use the LAI values listed in the vegetation library file.FROM_VEGPARAM = Use the LAI values listed in the vegetation parameter file. Note: for this to work, VEGPARAM_LAI must be TRUE.FROM_VEGHIST = Use the LAI values listed in the veg_hist forcing files. Note: for this to work, LAI_IN must be supplied in the veg_hist files and listd in the global parameter file as one of the variables in the files. Default = FROM_VEGLIB. |
| LAI_SRC | string | N/A | This option tells VIC where to look for LAI values:FROM_VEGLIB = Use the LAI values listed in the vegetation library file.FROM_VEGPARAM = Use the LAI values listed in the vegetation parameter file. Note: for this to work, VEGPARAM_LAI must be TRUE.FROM_VEGHIST = Use the LAI values listed in the veg_hist forcing files. Note: for this to work, LAI must be supplied in the veg_hist files and listd in the global parameter file as one of the variables in the files. Default = FROM_VEGLIB. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like these typos were already present but can you add a space after values: and after TRUE.?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

@@ -176,7 +176,7 @@ The following options describe the input parameter files.
| JULY_TAVG_SUPPLIED | string | TRUE or FALSE | If TRUE then VIC will expect an additional variable in the parameter file (July_Tavg) to contain the grid cell's average July temperature. *NOTE*: Supplying July average temperature is only required if the COMPUTE_TREELINE option is set to TRUE. <br><br>Default = FALSE. |
| ORGANIC_FRACT | string | TRUE or FALSE | TRUE = the parameter file contains extra variables: the organic fraction, and the bulk density and soil particle density of the organic matter in each soil layer. FALSE = the parameter file does not contain any information about organic soil, and organic fraction should be assumed to be 0. <br><br>Default = FALSE. |
| ALB_SRC | string | N/A | This option tells VIC where to look for ALBEDO values: if FROM_VEGLIB or FROM_VEGPARAM = Use the ALBEDO values from the parameter file.FROM_VEGPARAM = Use the ALBEDO values listed in the vegetation parameter file. If FROM_VEGHIST = Use the ALBEDO values from the veg_hist forcing files. Note: for this to work, ALBEDO must be supplied in the veg_hist files and listed in the global parameter file as one of the variables in the files. <br><br>Default = FROM_VEGLIB. |
| LAI_SRC | string | N/A | This option tells VIC where to look for LAI values: FROM_VEGLIB = Use the LAI values listed in the vegetation library file.FROM_VEGPARAM = Use the LAI values listed in the vegetation parameter file. Note: for this to work, VEGPARAM_LAI must be TRUE.FROM_VEGHIST = Use the LAI values listed in the veg_hist forcing files. Note: for this to work, LAI_IN must be supplied in the veg_hist files and listd in the global parameter file as one of the variables in the files. Default = FROM_VEGLIB. |
| LAI_SRC | string | N/A | This option tells VIC where to look for LAI values: FROM_VEGLIB = Use the LAI values listed in the vegetation library file.FROM_VEGPARAM = Use the LAI values listed in the vegetation parameter file. Note: for this to work, VEGPARAM_LAI must be TRUE.FROM_VEGHIST = Use the LAI values listed in the veg_hist forcing files. Note: for this to work, LAI must be supplied in the veg_hist files and listd in the global parameter file as one of the variables in the files. Default = FROM_VEGLIB. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space in the middle of TRUE.FROM_VEGHIST

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

else {
log_warn("Sum of the snow band area fractions is 0, "
"setting first fraction to 1\n%s", locstr);
soil_con[i].AreaFract[0] = 1.;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if there were no fractions in the elevation dimension, then we should raise an error, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

@jhamman jhamman requested a review from yixinmao January 2, 2018 05:24
@tbohn
Copy link
Contributor Author

tbohn commented Jan 10, 2018

Also, what type of comments should I add to ReleaseNotes.md? Should I describe all the code changes (briefly of course) or just the changes to the user interface (changed name of some variables/options)?

@jhamman
Copy link
Member

jhamman commented Jan 10, 2018

I'll leave the content in the release note up to you. Look at what we wrote leading up to 5.0.

@tbohn
Copy link
Contributor Author

tbohn commented Jan 11, 2018

Running uncrustify produces many changes, to many files that I didn't even make changes to. And I'm not thinking you'll like the types of format changes it makes. For example, from diffing the after and before, we can see:
diff -r VIC.uncrustify/vic/drivers/cesm/src/vic_cesm_init_library.c VIC/vic/drivers/cesm/src/vic_cesm_init_library.c
183c183
< l2x_vic[i].l2x_Fall_lwup = -1 *param.EMISS_GRND *CONST_STEBOL *pow(
---
> l2x_vic[i].l2x_Fall_lwup = -1 * param.EMISS_GRND * CONST_STEBOL * pow(

so, uncrustify, at least on my machine, is making multiplication look like pointer dereferencing.

I ran uncrustify via the run_uncrustify.bash script.

@tbohn
Copy link
Contributor Author

tbohn commented Jan 11, 2018

I've found a potential bug in my changes - nothing major; can fix it by moving a block of code. But please wait before merging this PR until I've properly fixed the problem.

@jhamman
Copy link
Member

jhamman commented Jan 17, 2018

@tbohn - is this ready to go?

@tbohn
Copy link
Contributor Author

tbohn commented Jan 17, 2018

yes, this is ready.

@jhamman
Copy link
Member

jhamman commented Jan 19, 2018

@yixinmao - can you look into why these tests are failing now? Is it a Python library version issue?

@yixinmao
Copy link
Contributor

@tbohn : I briefly looked at the test results, and it seems like for the classic driver, there are some nan's in the flux output files; and with FULL_ENERGY=TRUE and FROZEN_SOIL=TRUE, it seems like there are some issue with iteration convergence so that the run doesn't end (at least not for a long time). These issues occur locally (so not a travis thing). Do you have any idea what are the causes?

@tbohn
Copy link
Contributor Author

tbohn commented Jan 26, 2018

@yixinmao : strange, no, I don't know what is causing those NaNs. The only things I did were to (a) merge in the latest develop changes and (b) move a block of code to a different place in vic_run.c. It is, of course, possible that I caused the NaNs by doing so, although in my tests on my own machine those didn't occur. I'll take a look.

@yixinmao
Copy link
Contributor

@tbohn hmm weird. Did all tests pass on your machine? They do fail on mine the same way that travis tests fail (i.e., system test failure as well as out of time). Let me know what you find (or can't find).

@tbohn
Copy link
Contributor Author

tbohn commented Jan 26, 2018

@yixinmao I wasn't referring to travis tests on my system; I was referring to tests at my own test sites. Another shortcoming of my tests, which is completely my fault, is that I was using a copy of my git repository for dev/testing, and then ported the changes into git. So there's a chance that the testing version of the code was fine but my port somehow messed things up.

@yixinmao
Copy link
Contributor

@tbohn OK. The tests failed on my local machine without travis (I fetched your branch directly). Do you think you could take a look to see what might be going on? It's probably faster than me looking from scratch. But if you still can't find anything, let me know and I can take a closer look.

@tbohn
Copy link
Contributor Author

tbohn commented Jan 26, 2018

@yixinmao yes, I will take a look this afternoon - I don't expect you to do that investigation; it's my responsibility to debug it, I think. I only needed help earlier in understanding the nature of the travis errors (the messages were not clear to me).

@tbohn tbohn mentioned this pull request Feb 3, 2018
6 tasks
@yixinmao
Copy link
Contributor

yixinmao commented Feb 3, 2018

@jhamman : after @tbohn fixes all tests passed and this PR is ready to be merged.

@jhamman
Copy link
Member

jhamman commented Feb 3, 2018

This looks good to me but I'd like @bartnijssen to give it a final look before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants