Emergent constraints
Emergent constraints¶
- class emergent_constraint.aircraft_constraint(ubin, lbin, udθ, ldθ, gradient_lat_range, flux_memory, flux_lat_range, campaign_time_point, bin_aggregation_method, fit_groups, model_tracer_list, dfs_obs, dfs_model, model_groups={}, model_tracer_ext_list=[], model_list_sfco2_lnd=[], methane_theta_lbound=305.0, use_methane_gradient_correction=False, lbin_as_upper_bound=False, ubin_as_lower_bound=False, restrict_groups=False)¶
This object computes the aircraft constraint.
This is what happens here:
Initialize object with parameters defining the computation;
Compute observed gradient and error estimate from campaigns;
Group campaigns into fit_groups and compute associated DataFrame;
Compute fluxes for each campaign based on the associated fit_group
5. Fit a harmonic function to the campaign flux estimates, use this fit to generate an annual mean estimate with associated uncertainty.
- Parameters
ubin (float) – The value of θ on which to center the upper bin.
lbin (float) – The value of θ on which to center the lower bin.
udθ (float) – The width in θ units of the upper bin.
ldθ (float) – The width in θ units of the lower bin.
gradient_lat_range ([float, float]) – The latitude range over which to compute the vertical gradient.
flux_memory (float) – The time in days over which to average air-sea fluxes in the calculation.
flux_lat_range ([float, float]) – The latitude range over which to integrate fluxes.
campaign_time_point (string) – Acceptable values: [“center”, “end”]; where to set the campaign’s time-axis value.
bin_aggregation_method (string) – Acceptable values: [“mean”, “median”]; how to aggregate aircraft data in the θ bins.
fit_groups (iterable) – The groups by which to aggegrate campaigns.
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
dfs_obs (dict) – Dictionary of observational data contained in pandas.DataFrame’s returned from load_data.
dfs_model (dict) – Dictionary of simulated observations contained in pandas.DataFrame’s returned from load_data.
model_groups (dict) – A dictionary specifying a grouping of the models; the code returns a model-group-weighted fit.
model_tracer_ext_list (list of tuples) – A list of tuples specifying the (model, tracer) pairs to use to estimate “external” contributions to the observed gradient. I.e., these data are used to correct the observed estimates of the gradient for land and fossil contributions.
model_list_sfco2_lnd (list of tuples) – A list of (model, tracer) pairs used to correct the resulting flux estimate for in-region land and fossil fuel fluxes. This is only used if the contraint is based on total CO2.
methane_theta_lbound (float) – Specifies the θ value above which to relate CH4 and CO2. This is only relevant if use_methane_gradient_correction=True, which is not the case by default. This option was something we explored, but did not feel it well justified, so did not implement in the final computation.
use_methane_gradient_correction (boolean) – Use vertical gradients of CH4 to correct observed gradient; this option is not scientifically justified and should not be used.
lbin_as_upper_bound (boolean) – Interpret the value of lbin as the upper bound for the lower bin, i.e., aggegrate data where θ < lbin. If lbin_as_upper_bound=True, then ldθ is ignored.
ubin_as_lower_bound (boolean) – Interpret the value of ubin as the lower bound for the upper bin, i.e., aggegrate data where θ > ubin. If ubin_as_lower_bound=True, then udθ is ignored.
restrict_groups (boolean) – Only produce the analysis for fit_groups, not all possible groups (as determined by those groups defined in the code).
- __init__(ubin, lbin, udθ, ldθ, gradient_lat_range, flux_memory, flux_lat_range, campaign_time_point, bin_aggregation_method, fit_groups, model_tracer_list, dfs_obs, dfs_model, model_groups={}, model_tracer_ext_list=[], model_list_sfco2_lnd=[], methane_theta_lbound=305.0, use_methane_gradient_correction=False, lbin_as_upper_bound=False, ubin_as_lower_bound=False, restrict_groups=False)¶
Initialize the aircraft_contraint.
- get_flight_gradients¶
Return a DataFrame with the ∆θCO2 gradient estiamtes for each flight.
- get_campaign_gradients¶
Return a DataFrame with the ∆θCO2 gradient estiamtes for each campaign.
- property campaign_flux¶
Return a DataFrame with the flux estimate for each campaign.
- property harmonic_fit¶
Return a two-harmonic fit to the campaign fluxes.
- property estimate_ann_mean_flux¶
Estimate the annual mean flux by fitting a harmonic function to campaign flux estimates. Return the mean and an estimate of the uncertainty in the mean.
- class emergent_constraint.whole_enchilada(model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=[], profiles_only=True, clobber=False)¶
Encapsulate entire worflow for computing aircraft_constraint.
This object loads the observations and simulated observations. It provides a method get_ac to compute the aircraft_constraint on those data.
- Parameters
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
model_tracer_ext_list (list of tuples) – A list of tuples specifying the (model, tracer) pairs to use to estimate “external” contributions to the observed gradient. I.e., these data are used to correct the observed estimates of the gradient for land and fossil contributions.
model_list_sfco2_lnd (list of tuples) – A list of (model, tracer) pairs used to correct the resulting flux estimate for in-region land and fossil fuel fluxes. This is only used if the contraint is based on total CO2.
profiles_only (boolean) – Use only data collected while “profiling.”
clobber (boolean) – If true, recompute rather than reading pre-computed result from cache.
- __init__(model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=[], profiles_only=True, clobber=False)¶
Initialize the whole_enchilada; load the input data, applying filters.
- get_ac(ubin, lbin, gradient_lat_range, flux_lat_range, fit_groups, flux_memory=90, udθ=10.0, ldθ=None, lbin_as_upper_bound=True, ubin_as_lower_bound=False, methane_theta_lbound=305.0, use_methane_gradient_correction=False, model_groups={}, clobber=False)¶
Compute the aircraft constraint: return an instance of aircraft_constraint. See the documentation for aircraft_constraint.
- class emergent_constraint.surface_constraint(periods, flux_lat_range, weight_by_sd_iav, seasons, fit_period, das_srf, model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=None)¶
This object computes the emergent flux constraint based on surface data.
- Parameters
periods (list of tuples) – A list of tuples with year ranges over which to compute the constraint; e.g. [(1999, 2020), (1999, 2009), (2009, 2020)].
flux_lat_range ([float, float]) – The latitude range over which to integrate fluxes.
weight_by_sd_iav (boolean) – Use a weighted regression to estimate constraint relationship, with the weights set by the standard deviation of interannual variability.
seasons (list) – The seasons over which to compute the constraint. E.g. [“DJF”, “JJA”].
fit_period (string) – The year-range in periods to use as the “calibrated” constraint. E.g., “1999-2020”.
das_srf (dict) – Dictionary of observational data contained in pandas.DataFrame’s returned from load_data_surface.
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
model_tracer_ext_list (list of tuples) – A list of tuples specifying the (model, tracer) pairs to use to estimate “external” contributions to the observed gradient. I.e., these data are used to correct the observed estimates of the gradient for land and fossil contributions.
model_list_sfco2_lnd (list of tuples) – A list of (model, tracer) pairs used to correct the resulting flux estimate for in-region land and fossil fuel fluxes. This is only used if the contraint is based on total CO2.
- __init__(periods, flux_lat_range, weight_by_sd_iav, seasons, fit_period, das_srf, model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=None)¶
set up the object
- property surface_flux¶
Return a pandas.DataFrame with the surface flux estimates for each time range defined in periods.
- class emergent_constraint.whole_enchilada_srf(model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=[])¶
- __init__(model_tracer_list, model_list_sfco2_lnd=[], model_tracer_ext_list=[])¶
Encapsulate entire worflow for computing surface_constraint.
This object loads the observations and simulated observations. It provides a method get_sc to compute the surface_constraint on those data.
- Parameters
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
model_list_sfco2_lnd (list of tuples) – A list of (model, tracer) pairs used to correct the resulting flux estimate for in-region land and fossil fuel fluxes. This is only used if the contraint is based on total CO2.
model_tracer_ext_list (list of tuples) – A list of tuples specifying the (model, tracer) pairs to use to estimate “external” contributions to the observed gradient. I.e., these data are used to correct the observed estimates of the gradient for land and fossil contributions.
- get_sc(flux_lat_range=(- 90.0, - 45.0), weight_by_sd_iav=True, seasons=['DJF', 'JJA'], fit_period='1999-2020', periods=[(2000, 2004), (2005, 2009), (2010, 2014), (2015, 2019), (1999, 2020), (1999, 2009), (2009, 2020)], clobber=False)¶
Compute the emergent flux constraint based on surface observations: return an instance of surface_constraint. See the documentation for surface_constraint.
- emergent_constraint.load_data(model_tracer_list, profiles_only=True, clobber=False)¶
Load the data to support the emergent constraint calculation, applying some filters. This function caches it’s own output, which is simply read back in if the cache exists.
- Parameters
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
profiles_only (boolean) – Use only data collected while “profiling.”
clobber (boolean) – Clear cache and recompute.
- Returns
dfs_obs (dict) – Dictionary of observational data contained in pandas.DataFrame’s.
dfs_model (dict) – Dictionary of simulated observations contained in pandas.DataFrame’s.
- emergent_constraint.load_data_surface(model_tracer_list)¶
Return a dictionary of xarray.DataArray’s with observations and simulated observations.
- Parameters
model_tracer_list (list of tuples) – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
- Returns
das_srf – Dictionary of xarray.DataArray’s with model and observational data. Keys are constructed from each model_tracer_list element as “{model}-{tracer}”.
- Return type
dict
- emergent_constraint.get_parameters(spec='default')¶
Return the parameters for computing the emergent constraint from aircraft data.
- Parameters
spec (string) – Specification of the constraint option in EC-input.yaml. Only one parameter set is suppored, so spec=’default’ is the only support option.
- Returns
air_parms – Dictionary with the parameters for computing the aircraft constraint. Example:
air_parms = { 'ubin': 300.0, 'lbin': 280.0, 'udθ': 10.0, 'lbin_as_upper_bound': True, 'ubin_as_lower_bound': False, 'gradient_lat_range': (-90.0, -45.0), 'flux_lat_range': (-90.0, -45.0), 'flux_memory': 90, 'fit_groups': ('DJF', 'MAMJJASON'), }
- Return type
dict
- emergent_constraint.get_model_tracer_lists(spec)¶
Return the model_tracer_list specified in the emergent constraint input file: EC-input.yaml.
- Parameters
spec (string) – Specification of the constraint option in EC-input.yaml. Options include: ‘ocean_constraint’, ‘total_constraint’
- Returns
model_tracer_list – The models and their tracers to use, i.e. [(CT2017, “CO2_OCN”), (CT2019B, “CO2_OCN”), …]
- Return type
list of tuples