Trends with the SAGE II / OSIRIS / OMPS-LP DatasetΒΆ
Here we calculate trends using the SAGE II / OSIRIS / OMPS-LP dataset by regressing to deseasonalized relative monthly zonal mean anomalies
[2]:
import xarray as xr
import numpy as np
from LOTUS_regression.regression import regress_all_bins
from LOTUS_regression.predictors import load_data
The data is in a single NetCDF4 file.
[3]:
MERGED_FILE = r'/home/runner/work/lotus-regression/lotus-regression/test_data//S2_OS_OMPS/MERGED_LOTUS.nc'
mzm_data = xr.open_dataset(MERGED_FILE, engine='netcdf4')
print(mzm_data)
<xarray.Dataset>
Dimensions: (altitude: 59, time: 387, mean_latitude: 13, month: 12)
Coordinates:
* altitude (altitude) float64 0.0 1.0 2.0 3.0 ... 55.0 56.0 57.0 58.0
* time (time) datetime64[ns] 1984-10-01 1984-11-01 ... 2016-12-01
latitude_bin (mean_latitude) object ...
* mean_latitude (mean_latitude) float64 -60.0 -50.0 -40.0 ... 50.0 60.0
* month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
Data variables:
anomaly (mean_latitude, time, altitude) float64 ...
relative_anomaly (mean_latitude, time, altitude) float64 ...
std (mean_latitude, time, altitude) float64 ...
relative_std (mean_latitude, time, altitude) float64 ...
count (mean_latitude, time, altitude) float64 ...
osiris_mzm (mean_latitude, month, altitude) float64 ...
sageii_mzm (mean_latitude, month, altitude) float64 ...
omps_mzm (mean_latitude, month, altitude) float64 ...
inst_flags (mean_latitude, time, altitude) float64 ...
[4]:
predictors = load_data('pred_baseline_pwlt.csv')
print(predictors.columns)
Index(['enso', 'solar', 'qboA', 'qboB', 'aod', 'linear_pre', 'linear_post',
'constant'],
dtype='object')
[5]:
results = regress_all_bins(predictors, mzm_data['relative_anomaly'], tolerance=0.1)
# Convert to ~ percent
results *= 100
print(results)
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
Intel MKL ERROR: Parameter 5 was incorrect on entry to DTRTRI.
<xarray.Dataset>
Dimensions: (mean_latitude: 13, altitude: 59)
Coordinates:
* mean_latitude (mean_latitude) float64 -60.0 -50.0 -40.0 ... 50.0 60.0
* altitude (altitude) float64 0.0 1.0 2.0 3.0 ... 55.0 56.0 57.0 58.0
Data variables: (12/16)
enso (mean_latitude, altitude) float64 nan nan ... 1.096 0.7407
enso_std (mean_latitude, altitude) float64 nan nan ... 0.4803 0.4746
solar (mean_latitude, altitude) float64 nan nan ... 0.5286 0.8473
solar_std (mean_latitude, altitude) float64 nan nan ... 0.7342 0.7259
qboA (mean_latitude, altitude) float64 nan nan ... -0.359
qboA_std (mean_latitude, altitude) float64 nan nan ... 0.4608 0.4559
... ...
linear_pre (mean_latitude, altitude) float64 nan nan ... 7.96e-16
linear_pre_std (mean_latitude, altitude) float64 nan nan ... 2.331e-15
linear_post (mean_latitude, altitude) float64 nan nan ... 3.685 2.928
linear_post_std (mean_latitude, altitude) float64 nan nan ... 1.145 1.137
constant (mean_latitude, altitude) float64 nan nan ... -6.11 -3.712
constant_std (mean_latitude, altitude) float64 nan nan ... 4.174 4.148
[6]:
import LOTUS_regression.plotting.trends as trends
trends.pre_post_with_confidence(results, x='mean_latitude', y='altitude', ylim=(18, 50), log_y=False, figsize=(16, 6),
x_label='Latitude [$^\circ$]', y_label='Altitude [km]', pre_title='Pre 1997',
post_title='Post 1997')