@@ -1148,9 +1148,16 @@ def MCTRoutingLoop(self,ChanQMCTOutStart,ChanQMCTInStart,ChanQKinOut,SideflowCha
1148
1148
### calling MCT function for single cell
1149
1149
q11 [idpix ], V11 [idpix ], Cm0 [idpix ], Dm0 [idpix ] = self .MCTRouting_single (q10 [idpix ], q01 [idpix ], q00 [idpix ], ql [idpix ], Cm0 [idpix ], Dm0 [idpix ],
1150
1150
dt , xpix [idpix ], s0 [idpix ], Balv [idpix ], ANalv [idpix ], Nalv [idpix ])
1151
- # debug
1152
- # q11[idpix] = q01[idpix]
1153
- # Set outflow to be the same as inflow in MCT grid cells ('tanto entra tanto esce')
1151
+
1152
+ # # cmcheck - tanto entra tanto esce
1153
+ # # debug
1154
+ # q11[idpix] = q01[idpix] + ql[idpix]
1155
+ # # Set outflow to be the same as inflow in MCT grid cells ('tanto entra tanto esce')
1156
+ # V11[idpix] = ChanM3MCT0[idpix]
1157
+ # # Set end volume to be the same as initial volume in MCT grid cells ('tanto entra tanto esce')
1158
+
1159
+
1160
+
1154
1161
1155
1162
# Update contribution from upstream pixels at time t+1 (dim=all pixels) using the newly calculated q11
1156
1163
# I want to update q01 (inflow at t+1) for cells downstream of idpix using the newly calculated q11
@@ -1288,10 +1295,10 @@ def MCTRouting_single(self, q10, q01, q00, ql, Cm0, Dm0, dt, xpix, s0, Balv, ANa
1288
1295
#### end of for loop
1289
1296
1290
1297
1291
- # cmcheck
1292
- calc_t = xpix / ck1
1293
- if calc_t < dt :
1294
- print ('xpix/ck1 < dt' )
1298
+ # # cmcheck
1299
+ # calc_t = xpix / ck1
1300
+ # if calc_t < dt:
1301
+ # print('xpix/ck1 < dt')
1295
1302
1296
1303
1297
1304
k1 = dt / Cm1
@@ -1556,12 +1563,10 @@ def _setMCTRoutingOrders(self):
1556
1563
self .pixels_ordered = self .pixels_ordered .sort_values (["order" , "pixels" ]).set_index ("order" ).squeeze ()
1557
1564
except : # FOR COMPATIBILITY WITH OLDER PANDAS VERSIONS
1558
1565
self .pixels_ordered = self .pixels_ordered .sort (["order" , "pixels" ]).set_index ("order" ).squeeze ()
1559
- # Output of pd.DataFrame.squeeze() is not a DataFrame and not a Series.
1566
+ # Ensure output is always a Series, even if only one element
1560
1567
if not isinstance (self .pixels_ordered , pd .Series ):
1561
- # self.pixels_ordered = pd.DataFrame({'order': [0], 'pixel': self.pixels_ordered})
1562
- # self.pixels_ordered.set_index('order', inplace=True)
1563
1568
self .pixels_ordered = pd .Series (self .pixels_ordered )
1564
- self . pixels_ordered . rename_axis ( "order" )
1569
+
1565
1570
order_counts = self .pixels_ordered .groupby (self .pixels_ordered .index ).count ()
1566
1571
stop = order_counts .cumsum ()
1567
1572
self .order_start_stop = np .column_stack ((np .append (0 , stop [:- 1 ]), stop )).astype (int ) # astype for cython import in windows (see above)
0 commit comments