lib/gs2crmod/calculations.rb in gs2crmod-0.11.63 vs lib/gs2crmod/calculations.rb in gs2crmod-0.11.64
- old
+ new
@@ -20,10 +20,11 @@
eputs 'Calculating time averaged fluxes'
calculate_saturation_time_index unless @saturation_time_index
return unless FileTest.exist?(netcdf_filename)
@hflux_tot_stav = saturated_time_average('hflux_tot_over_time', {})
@hflux_tot_stav_error = saturated_time_average_error('hflux_tot_over_time', {})
+ @hflux_tot_stav_std_dev = saturated_time_average_std_dev('hflux_tot_over_time', {})
@phi2_tot_stav = saturated_time_average('phi2tot_over_time', {})
#@par_mom_flux_stav = saturated_time_average('par_mom_flux_over_time', {}) rescue nil
#@perp_mom_flux_stav = saturated_time_average('perp_mom_flux_over_time', {}) rescue nil
@es_mom_flux_stav = {}
@es_heat_flux_stav = {}
@@ -95,9 +96,21 @@
# fit_vec = ind * fit[1] + fit[0]
# # p tavg.size
# # GraphKit.autocreate({x: {data: gsl_vector(name, {})}})
# (GraphKit.autocreate({x: {data: tavg}}) + GraphKit.autocreate({x: {data: vec}}) + GraphKit.autocreate({x: {data: fit_vec}})).gnuplot
return tavg.sd
+end
+
+def saturated_time_average_std_dev(name, options)
+# calculate_saturation_time_index unless @saturation_time_index
+ options[:t_index_window] = [@saturation_time_index, list(:t).keys.max]
+ begin
+ vec = gsl_vector(name, options)
+ rescue NoMethodError
+ eputs "Warning: could not calculate #{name} saturated_time_average_std_dev"
+ return nil
+ end
+ return vec.sd
end
# I.e. the time at which the primary modes are saturated and the fluxes settle around a long term average.