Skip to content

Commit

Permalink
Remove inadvertant rebase diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Nov 4, 2024
1 parent 090b25e commit 2c55d9e
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 2,171 deletions.
1,333 changes: 0 additions & 1,333 deletions auxiliary_tools/template_cdat_regression_test.ipynb

This file was deleted.

27 changes: 0 additions & 27 deletions e3sm_diags/driver/qbo_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import scipy.fftpack
import xarray as xr
import xcdat as xc
<<<<<<< HEAD
from scipy.signal import detrend
=======
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))

from e3sm_diags.driver.utils.dataset_xr import Dataset
from e3sm_diags.driver.utils.io import _get_output_dir, _write_to_netcdf
Expand All @@ -29,12 +26,9 @@
# The region will always be 5S5N
REGION = "5S5N"

<<<<<<< HEAD
# Target power spectral vertical level for the wavelet diagnostic.
POW_SPEC_LEV = 20.0

=======
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))

class MetricsDict(TypedDict):
qbo: xr.DataArray
Expand All @@ -43,11 +37,8 @@ class MetricsDict(TypedDict):
period_new: np.ndarray
psd_x_new: np.ndarray
amplitude_new: np.ndarray
<<<<<<< HEAD
wave_period: np.ndarray
wavelet: np.ndarray
=======
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))
name: str


Expand Down Expand Up @@ -105,7 +96,6 @@ def run_diag(parameter: QboParameter) -> QboParameter:
x_ref, ref_dict["period_new"]
)

<<<<<<< HEAD
# Diagnostic 4: calculate the Wavelet
test_dict["wave_period"], test_dict["wavelet"] = _calculate_wavelet(
test_dict["qbo"]
Expand All @@ -114,8 +104,6 @@ def run_diag(parameter: QboParameter) -> QboParameter:
ref_dict["qbo"]
)

=======
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))
parameter.var_id = var_key
parameter.output_file = "qbo_diags"
parameter.main_title = (
Expand All @@ -135,15 +123,7 @@ def run_diag(parameter: QboParameter) -> QboParameter:

# Write the metrics to .json files.
test_dict["name"] = test_ds._get_test_name()
<<<<<<< HEAD
ref_dict["name"] = ref_ds._get_ref_name()
=======

try:
ref_dict["name"] = ref_ds._get_ref_name()
except AttributeError:
ref_dict["name"] = parameter.ref_name
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))

_save_metrics_to_json(parameter, test_dict, "test") # type: ignore
_save_metrics_to_json(parameter, ref_dict, "ref") # type: ignore
Expand Down Expand Up @@ -172,11 +152,7 @@ def _save_metrics_to_json(
metrics_dict[key] = metrics_dict[key].tolist() # type: ignore

with open(abs_path, "w") as outfile:
<<<<<<< HEAD
json.dump(metrics_dict, outfile, default=str)
=======
json.dump(metrics_dict, outfile)
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))

logger.info("Metrics saved in: {}".format(abs_path))

Expand Down Expand Up @@ -379,7 +355,6 @@ def deseason(xraw):
# i.e., get the difference between this month's value and it's "usual" value
x_deseasoned[month_index] = xraw[month_index] - xclim[month]
return x_deseasoned
<<<<<<< HEAD


def _calculate_wavelet(var: xr.DataArray) -> Tuple[np.ndarray, np.ndarray]:
Expand Down Expand Up @@ -444,5 +419,3 @@ def _get_psd_from_wavelet(data: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
psd = np.mean(np.square(np.abs(cwtmatr)), axis=1)

return (period, psd)
=======
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))
52 changes: 0 additions & 52 deletions e3sm_diags/driver/utils/dataset_xr.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,6 @@ def _get_ref_name(self, default_name: str | None = None) -> str:

return self.parameter.ref_name

<<<<<<< HEAD
=======
raise AttributeError(
"Either `parameter.short_ref_name`, `parameter.reference_name`, or "
"`parameter.ref_name` must be set to get the name and years attribute for "
"reference datasets."
)

>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))
def _get_global_attr_from_climo_dataset(
self, attr: str, season: ClimoFreq
) -> str | None:
Expand Down Expand Up @@ -444,7 +435,6 @@ def _get_climo_dataset(self, season: str) -> xr.Dataset:
)

ds = squeeze_time_dim(ds)
<<<<<<< HEAD
ds = self._subset_vars_and_load(ds, self.var)

return ds
Expand Down Expand Up @@ -475,9 +465,6 @@ def _add_cf_attrs_to_z_axes(self, ds: xr.Dataset) -> xr.Dataset:

if axis_attr is None:
ds[dim].attrs["axis"] = "Z"
=======
ds = self._subset_vars_and_load(ds)
>>>>>>> c7ef34e9 (CDAT Migration Phase 2: Refactor `qbo` set (#826))

return ds

Expand Down Expand Up @@ -815,45 +802,6 @@ def _get_matching_climo_src_vars(

return None

def _subset_vars_and_load(self, ds: xr.Dataset) -> xr.Dataset:
"""Subset for variables needed for processing and load into memory.
Subsetting the dataset reduces its memory footprint. Loading is
necessary because there seems to be an issue with `open_mfdataset()`
and using the multiprocessing scheduler defined in e3sm_diags,
resulting in timeouts and resource locking. To avoid this, we load the
multi-file dataset into memory before performing downstream operations.
Source: https://github.com/pydata/xarray/issues/3781
Parameters
----------
ds : xr.Dataset
The dataset.
Returns
-------
xr.Dataset
The dataset subsetted and loaded into memory.
"""
# slat and slon are lat lon pair for staggered FV grid included in
# remapped files.
if "slat" in ds.dims:
ds = ds.drop_dims(["slat", "slon"])

all_vars_keys = list(ds.data_vars.keys())
hybrid_var_keys = set(list(sum(HYBRID_SIGMA_KEYS.values(), ())))
keep_vars = [
var
for var in all_vars_keys
if "bnd" in var or "bounds" in var or var in hybrid_var_keys
]
ds = ds[[self.var] + keep_vars]

ds.load(scheduler="sync")

return ds

# --------------------------------------------------------------------------
# Time series related methods
# --------------------------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions e3sm_diags/parameter/core_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
from e3sm_diags.driver.utils.dataset_xr import Dataset


if TYPE_CHECKING:
from e3sm_diags.driver.utils.dataset_xr import Dataset


class CoreParameter:
def __init__(self):
# File I/O
Expand Down
132 changes: 0 additions & 132 deletions e3sm_diags/plot/cartopy/aerosol_aeronet_plot.py

This file was deleted.

Loading

0 comments on commit 2c55d9e

Please sign in to comment.