Notebook
# calculate mean NH4 from data at Hope and Gravesend dataG=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( Profs.variable_name=='AMMONIA DISSOLVED', Profs.station_name=='Fraser River (Main Arm) at Gravesend Reach - Buoy')).all() YDG, valG = plotYMDV(dataG,'r','temp') dataH=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( Profs.variable_name=='AMMONIA DISSOLVED', Profs.station_name.like('%Hope%'))).all() YDH, valH = plotYMDV(dataH,'b','NH4, red=Gravesend, blue=Hope') units=session.query(Profs.unit_code).\ filter(and_( Profs.variable_name=='AMMONIA DISSOLVED', or_(Profs.station_name=='Fraser River (Main Arm) at Gravesend Reach - Buoy', Profs.station_name.like('%Hope%')))).group_by(Profs.unit_code).all() for row in units: print('units:',row) val=np.concatenate((valG,valH)) nh4_cst=np.mean(val) print('nh4_cst =', nh4_cst/mwN*1000, 'uM')
# NO2+NO3 at Hope and Gravesend dataG=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( Profs.value<2.5, # remove single high outlier Profs.variable_name=='NITROGEN DISSOLVED NO3 & NO2', Profs.station_name.like('%Gravesend%'))).all() YDG, valG = plotYMDV(dataG,'r','temp') dataH=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( Profs.variable_name=='NITROGEN DISSOLVED NO3 & NO2', Profs.station_name.like('%Hope%'))).all() YDH, valH = plotYMDV(dataH,'b','NO3, red=Gravesend, blue=Hope') units=session.query(Profs.unit_code).\ filter(and_( Profs.variable_name=='NITROGEN DISSOLVED NO3 & NO2', or_(Profs.station_name.like('%Gravesend%'), Profs.station_name.like('%Hope%')))).group_by(Profs.unit_code).all() for row in units: print('units:',row) YD=np.concatenate((YDG,YDH)) val=np.concatenate((valG, valH)) no3dict=gsmooth(YD,val,60) #print(i,np.max([v for v in no3dict.values()]))
# Si at Hope and Gravesend dataG=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( Profs.value<2.5, # remove single high outlier or_(Profs.variable_name=='SILICA DISSOLVED', Profs.variable_name=='SILICON DISSOLVED'), Profs.station_name.like('%Gravesend%'))).all() YDG, valG = plotYMDV(dataG,'r','temp') dataH=session.query(Profs.Year, Profs.Month, Profs.Day, Profs.value).\ filter(and_( or_(Profs.variable_name=='SILICA DISSOLVED', Profs.variable_name=='SILICON DISSOLVED'), Profs.station_name.like('%Hope%'))).all() YDH, valH = plotYMDV(dataH,'b','Si, red=Gravesend, blue=Hope') units=session.query(Profs.unit_code).\ filter(and_( or_(Profs.variable_name=='SILICA DISSOLVED', Profs.variable_name=='SILICON DISSOLVED'), or_(Profs.station_name.like('%Gravesend%'), Profs.station_name.like('%Hope%')))).group_by(Profs.unit_code).all() for row in units: print('units:',row) YD=np.concatenate((YDG,YDH)) val=np.concatenate((valG, valH)) sidict=gsmooth(YD,val,60)