-
Notifications
You must be signed in to change notification settings - Fork 17
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
Remove standard topmodel output when running from ngen #41
Changes from all commits
11b32be
bfea366
fe7cd9b
bdc39b0
4d40b80
9c0745c
122ae65
e29eed6
d8c7221
bbfa55c
60dbc77
53b0419
76a8988
840028c
5607002
59ae02d
8264d68
7756c24
aca60e7
54675ee
558f90a
7c1f590
9eb924f
9eb91bf
116d98c
5529661
609fa10
55298a8
fb822d2
14f875d
379f352
8c5d597
f6a8ca8
aca081d
1bbd41d
c524a3a
6e58fd1
1b06db4
cfbdec5
3b25e5c
98c2a1c
c81f69d
00db5ea
dd56d13
b625c15
0042550
da5b500
92c6017
8bd02b6
625e351
fc066cb
2ffd6e4
76c3b3f
1978a88
38f3a95
8c7ad8c
9f3b0e0
0c346a4
51959a2
aec96a6
9330aec
7dfb805
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,7 @@ max_contrib_area=0.0; | |
/* Note: original source code starts for-loop over nstep here | ||
Also recall that bmi adaptation removes submatchment loop | ||
which lived in topmod9502.c main() function */ | ||
if(yes_print_output==TRUE && current_time_step==1) | ||
if(yes_print_output==TRUE && current_time_step==1 && stand_alone==TRUE) | ||
{ | ||
fprintf(output_fptr, | ||
"it p ep q(it) quz q sbar qof\n"); | ||
|
@@ -340,7 +340,7 @@ for(ir=1;ir<=num_time_delay_histo_ords;ir++) | |
//Add current time flow to mass balance variable | ||
*sumq += Q[it]; | ||
/* BMI Adaption: replace nstep with current_time_step */ | ||
if(yes_print_output==TRUE && in<=current_time_step) | ||
if(yes_print_output==TRUE && in<=current_time_step && stand_alone==TRUE) | ||
{ | ||
fprintf(output_fptr,"%d %6.4e %6.4e %6.4e %6.4e %6.4e %6.4e %6.4e\n", | ||
current_time_step, (*p), (*ep), Q[it], (*quz), (*qb), (*sbar), (*qof)); | ||
|
@@ -368,7 +368,7 @@ return; | |
|
||
} | ||
|
||
extern void water_balance(FILE *output_fptr, int yes_print_output, | ||
extern void water_balance(FILE *output_fptr, int yes_print_output, int stand_alone, | ||
char *subcat,double *bal, double *sbar, double *sump, | ||
double *sumae, double *sumq, double *sumrz, double *sumuz) | ||
{ | ||
|
@@ -383,8 +383,8 @@ extern void water_balance(FILE *output_fptr, int yes_print_output, | |
(*sump),(*sumae),(*sumq),(*sumrz),(*sumuz),(*sbar),(*bal)); | ||
#endif | ||
|
||
if (yes_print_output==TRUE) | ||
{ | ||
if (yes_print_output==TRUE && stand_alone==TRUE) | ||
{ | ||
fprintf(output_fptr,"\nWater Balance for Subcatchment: %s\n",subcat); | ||
fprintf(output_fptr, | ||
" SUMP SUMAE SUMQ SUMRZ SUMUZ SBAR BAL\n"); | ||
|
@@ -421,8 +421,7 @@ d_alloc(Qobs,(*nstep)); | |
//NJF This is dangerous, there is no validation between nstep and | ||
//number of historgram ordinates, which is used to iterate Q in later steps | ||
//so this could easily overflow if nstep is smaller than historgram ords | ||
d_alloc(Q,(*nstep)); //NJF TODO validate that this works correctly | ||
//When used in "stand alone" mode | ||
d_alloc(Q,(*nstep)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this ever validated? I don't believe I went through that code path in detail throughout the dyamic alloc refactoring. Might want to leave this comment until we are sure there isn't possible issues here in stand alone mode? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am able to run in stand alone mode and with NGEN. Output files topmod.out and hyd.out are produced and seem correct. Not sure if further validation is needed. On a tangential note, to run in stand_alone I am using:
When I view the info in docs/STAND_ALONE.md, I do not see these instructions anywhere. If this is the expected way to execute in stand_alone, it may be worth adding those instructions there. If it is not the expected way to execute in stand_alone mode, feel free to let me know! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Ben-Choat - The install doc gives instructions on standalone via cmake. It probably wouldn't be a bad idea to add a link in the STAND_ALONE.md. Thanks for pointing this out. |
||
d_alloc(contrib_area,(*nstep)); | ||
|
||
//--------------------------------------- | ||
|
@@ -441,7 +440,7 @@ return; | |
extern void tread(FILE *subcat_fptr,FILE *output_fptr,char *subcat, | ||
int *num_topodex_values,int *num_channels,double *area, | ||
double **dist_area_lnaotb,double **lnaotb, int yes_print_output, | ||
double **cum_dist_area_with_dist,double *tl, | ||
int stand_alone, double **cum_dist_area_with_dist,double *tl, | ||
double **dist_from_outlet) | ||
{ | ||
/************************************************************** | ||
|
@@ -458,7 +457,7 @@ int j; | |
fgets(subcat,256,subcat_fptr); /* do twice to read in line-feed */ | ||
fgets(subcat,256,subcat_fptr); | ||
|
||
if (yes_print_output == TRUE) | ||
if (yes_print_output == TRUE && stand_alone == TRUE) | ||
{ | ||
fprintf(output_fptr,"Subcatchment : %s\n",subcat); | ||
} | ||
|
@@ -540,7 +539,7 @@ for(j=1;j<=(*num_channels);j++) | |
/* dist_from_outlet[1] is distance from subcatchment outlet */ | ||
/* cum_dist_area_with_dist[1] = 0. */ | ||
|
||
if(yes_print_output==TRUE) | ||
if(yes_print_output==TRUE && stand_alone==TRUE) | ||
{ | ||
fprintf(output_fptr,"TL = %8.2lf\n",(*tl)); | ||
fprintf(output_fptr,"SUMAC = %8.2lf\n",sumac); | ||
|
@@ -555,8 +554,9 @@ return; | |
* to enable calibratable parameters to be updated. | ||
* BChoat 2023/08/29 | ||
*/ | ||
/** | ||
|
||
|
||
/** | ||
* Function to convert distance/area form to time delay histogram ordinates | ||
* | ||
* Converts parameters to m/time step DT | ||
|
@@ -929,7 +929,6 @@ double tch[num_channels+1]; //+1 to maintain 1 based indexing used by other rout | |
double sumar; | ||
int ir; | ||
|
||
|
||
/* read in run parameters */ | ||
fgets(subcat,256,in_param_fptr); | ||
|
||
|
@@ -938,21 +937,22 @@ printf("subcat: %s\n", subcat); | |
fscanf(in_param_fptr,"%lf %lf %lf %lf %lf %lf %lf %lf %d %lf %lf %lf", | ||
szm,t0,td,chv,rv,srmax,Q0,sr0,infex,xk0,hf,dth); | ||
|
||
|
||
printf("\n\nCalibratable parameters from params*.dat:\n"); | ||
|
||
printf("\nET and recharge:\n"); | ||
printf("srmax = %f\n", *srmax); | ||
printf("td = %f\n", *td); | ||
|
||
printf("\nDischarge:\n"); | ||
printf("chv = %f\n", *chv); | ||
printf("rv = %f\n", *rv); | ||
|
||
printf("\nWater balance:\n"); | ||
printf("szm = %f\n", *szm); | ||
printf("sr0 = %f\n", *sr0); | ||
printf("t0 = %f\n\n", *t0); | ||
#if TOPMODEL_DEBUG >= 1 | ||
printf("\n\nCalibratable parameters from params*.dat:\n"); | ||
|
||
printf("\nET and recharge:\n"); | ||
printf("srmax = %f\n", *srmax); | ||
printf("td = %f\n", *td); | ||
|
||
printf("\nDischarge:\n"); | ||
printf("chv = %f\n", *chv); | ||
printf("rv = %f\n", *rv); | ||
|
||
printf("\nWater balance:\n"); | ||
printf("szm = %f\n", *szm); | ||
printf("sr0 = %f\n", *sr0); | ||
printf("t0 = %f\n\n", *t0); | ||
#endif | ||
|
||
//NJF num_channels is the value provided (SHOULD COME FROM TREAD) | ||
//Convert distance/area form to time delay histogram ordinates | ||
|
@@ -976,7 +976,7 @@ init_water_balance(num_topodex_values, | |
stor_unsat_zone, szq, | ||
deficit_local, deficit_root_zone, sbar, bal); | ||
|
||
if(yes_print_output==TRUE) | ||
if(yes_print_output==TRUE && stand_alone == TRUE) | ||
{ | ||
|
||
// calculate sum of hist ords for printing to output file | ||
|
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.
spurious comment