Skip to content

Commit 1e521f7

Browse files
committed
resolve dsval#2
1 parent 34f188b commit 1e521f7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

R/splash.point.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ splash.point<-function(sw_in, tc, pn, lat,elev,slop=0,asp=0,soil_data,Au=0,resol
107107
#if there is no information on how many cell drain to this point, assume 3 sides of the octogonal cell
108108
ncellin<-3
109109
ncellout<-3
110-
soil_info<-c(SAT,WP,FC,soil_info$Ksat,lambda,depth,bub_press,RES,Au[1],resolution^2,ncellin,ncellout)
110+
soil_info<-c(SAT,WP,FC,soil_info$Ksat,lambda,depth,bub_press,RES,Au[1],resolution^2,ncellin,ncellout,0)
111111
# ^ Jaideep FIXME: Note that this does not set soil_info[13] to AI. This means that when this is dereferenced in quick-run, there's a risk of segfault or garbage value
112112
}else{
113113
ncellin<-Au[2]
@@ -149,7 +149,7 @@ splash.point<-function(sw_in, tc, pn, lat,elev,slop=0,asp=0,soil_data,Au=0,resol
149149
initial_AI<-my_splash$spin_up(as.integer(365), as.integer(y[1]), as.numeric(sw_av[1:365]), as.numeric(tc_av[1:365]),as.numeric(pn_av[1:365]),slop,asp,as.numeric(snowf_av[1:365]),soil_info)
150150
# ^ Jaideep FIXME: This sees a size-12 soil_info when length(Au)=1, so might get segfault, or worse, AI will get garbage value
151151
#update aridity
152-
soil_info[12]<-sum(initial_AI$pet,na.rm=T)/sum(Pinit[1:365],na.rm = T)
152+
soil_info[13]<-sum(initial_AI$pet,na.rm=T)/sum(Pinit[1:365],na.rm = T)
153153
# ^ Jaideep FIXME: This is assigning AI to soil_info[12] (R indexing) which is ncellout. It should instead go into soil_info[13] (R indexing), i.e. soil_info[12] (C++ indexing)
154154
# run spin up
155155
initial<-my_splash$spin_up(as.integer(365), as.integer(y[1]), as.numeric(sw_av[1:365]), as.numeric(tc_av[1:365]),as.numeric(pn_av[1:365]),slop,asp,as.numeric(snowf_av[1:365]),soil_info)

src/EVAP.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void EVAP::calculate_daily_fluxes(double sw, int n, int y, double sw_in,
9595
rnn_d = d_sr.rnn_d;
9696
double ts = d_sr.ts;
9797

98-
printf("Rnl in EVAP function: %0.6f W/m^2\n", rnl);
98+
// printf("Rnl in EVAP function: %0.6f W/m^2\n", rnl);
9999

100100
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101101
// 1.1. Assume water temperature 0.0 if air temperature < 0.0

src/SOLAR.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void SOLAR::calculate_daily_fluxes(int n, int y, double sw_in, double tc, double
8585
Output:
8686
Features: Calculates the daily solar radiation fluxes
8787
*********************************************************************** */
88-
cout << "SOLAR calc inputs: " << n << " " << y << " " << sw_in << " " << tc << " " << slop << " " << asp << " " << snow << " " << nd << " " << sw << '\n';
88+
// cout << "SOLAR calc inputs: " << n << " " << y << " " << sw_in << " " << tc << " " << slop << " " << asp << " " << snow << " " << nd << " " << sw << '\n';
8989

9090
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9191
// 0. Save day of year
@@ -266,7 +266,7 @@ void SOLAR::calculate_daily_fluxes(int n, int y, double sw_in, double tc, double
266266
//max air temeperature
267267
//ts = tc/dcos(hs/2);
268268

269-
cout << "End of SOLAR calc: rnl = " << rnl << endl;
269+
// cout << "End of SOLAR calc: rnl = " << rnl << endl;
270270

271271
}
272272

src/SPLASH.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ etr SPLASH::run_one_day(int n, int y, double wn, double sw_in, double tc,
15911591
dsoil.nd = nd;
15921592

15931593
dsoil.stress_factor = (sm-RES)/(Wmax-RES);
1594-
cout << "sw_end(calc at start) / stress_end (calc at end) = " << sw << " / " << dsoil.stress_factor << '\n';
1594+
// cout << "sw_end(calc at start) / stress_end (calc at end) = " << sw << " / " << dsoil.stress_factor << '\n';
15951595

15961596
theta_i = (sm)/(depth*1000.0);
15971597
// correct theta_i for NA error reaching boundary conditions

0 commit comments

Comments
 (0)