Skip to content

Commit fff6936

Browse files
authored
fix typos (using codespell) (#323)
1 parent e1711b8 commit fff6936

25 files changed

+38
-38
lines changed

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Breaking changes
117117
and the ``reg_dict`` argument to :py:func:`mesmer.utils.select.extract_land`. These arguments
118118
no longer have any affect (`#235 <https://github.com/MESMER-group/mesmer/pull/235>`_).
119119
By `Mathias Hauser`_.
120-
- Removed ``ref["type"] == "first"``, i.e., caculating the anomaly w.r.t. the first
120+
- Removed ``ref["type"] == "first"``, i.e., calculating the anomaly w.r.t. the first
121121
ensemble member (`#247 <https://github.com/MESMER-group/mesmer/pull/247>`_).
122122
By `Mathias Hauser`_.
123123
- Renamed ``mesmer.calibrate_mesmer._calibrate_and_draw_realisations`` to ``mesmer.calibrate_mesmer._calibrate_tas``

ROADMAP.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ There are two levels of internal data structures used within MESMER: (i) an arra
2424

2525
MESMER currently uses [numpy](https://numpy.org/) to represent its array data structure.
2626
While numpy is the de-facto standard of array computing today, MESMER can profit from labels which encode information about how the array values map to locations in space, time, etc..
27-
For example a 3 dimensional array can be augmented with named dimensons (`time`, `latitude`, `longitude`) and these dimensions can be augmented with coordinates (e.g. the first time step corresponds to 1850).
27+
For example a 3 dimensional array can be augmented with named dimensions (`time`, `latitude`, `longitude`) and these dimensions can be augmented with coordinates (e.g. the first time step corresponds to 1850).
2828
Such data structures are provided by the well established [xarray](http://xarray.pydata.org/en/stable/) library, which adds named dimensions, coordinates and attributes on top of raw numpy-like arrays and is particularly tailored to working with netCDF files.
2929
We therefore plan to replace the array data structure with xarray data structures.
3030

@@ -43,7 +43,7 @@ Specific tasks
4343

4444
### Disentangle the data handling from the statistical functions
4545

46-
Currently, most functions in MESMER combine data handling (e.g. splitting historical data and projections), statistical calibration (e.g. estimating linear regression coefficients), and saving the estimated parameters. These three steps should be split into individual functions, which will offer several benefits: (i) It should become easier to understand what happens in each step of the calibration/ emulation pipeline. (ii) The individual code parts become easier to re-use and update. (iii) Each part can be tested individually.
46+
Currently, most functions in MESMER combine data handling (e.g. splitting historical data and projections), statistical calibration (e.g. estimating linear regression coefficients), and saving the estimated parameters. These three steps should be split into individual functions, which will offer several benefits: (i) It should become easier to understand what happens in each step of the calibration/ emulation pipeline. (ii) The individual code parts become easier to reuse and update. (iii) Each part can be tested individually.
4747

4848
Specific tasks
4949
- Extract common data handling tasks and write individual functions for each of them ([#109](https://github.com/MESMER-group/mesmer/pull/109)).

docs/source/api.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Masking regions
8282
~core.mask.mask_antarctica
8383
~core.regionmaskcompat.mask_3D_frac_approx
8484

85-
Weighted operarions: calculate global mean
85+
Weighted operations: calculate global mean
8686
------------------------------------------
8787

8888
~core.weighted.global_mean

docs/source/development.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Testing philosophy
101101
------------------
102102

103103
When writing tests, we try to put them in one of two categories: integration and regression.
104-
Integration tests run bits of the code and assert the correct behaviour was achived.
104+
Integration tests run bits of the code and assert the correct behaviour was achieved.
105105
Some of the integration tests might run fairly big bits of code, others will be more targeted.
106106
Try to keep integration test files targeted and fairly small.
107107
We can always create `fixtures <https://docs.pytest.org/en/stable/explanation/fixtures.html>`__ to aid code reuse.
@@ -129,7 +129,7 @@ Note that ``make format`` can only be run if you have committed all your work i.
129129
This restriction is made to ensure that you don't format code without being able to undo it, just in case something goes wrong.
130130

131131

132-
Buiding the docs
132+
Building the docs
133133
----------------
134134

135135
After setting yourself up (see `Development setup`_), building the docs is as simple as running ``make docs`` (note, run ``make -B docs`` to force the docs to rebuild and ignore make when it says '... index.html is up to date').
@@ -150,7 +150,7 @@ Why is there a ``Makefile`` in a pure Python repository?
150150
--------------------------------------------------------
151151

152152
Whilst it may not be standard practice, a ``Makefile`` is a simple way to automate general setup (environment setup in particular).
153-
Hence we have one here which basically acts as a notes file for how to do all those little jobs which we often forget e.g. setting up environments, running tests (and making sure we're in the right environment), building docs, setting up auxillary bits and pieces.
153+
Hence we have one here which basically acts as a notes file for how to do all those little jobs which we often forget e.g. setting up environments, running tests (and making sure we're in the right environment), building docs, setting up auxiliary bits and pieces.
154154

155155
.. _Sphinx: http://www.sphinx-doc.org
156156
.. _MESMER issue tracker: https://github.com/MESMER-group/mesmer/issues

examples/config_tas_cmip6ng_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
dir_obs = os.path.join(TEST_DATA_ROOT, "observations")
3131

3232
# mesmer output
33-
dir_aux = os.path.join(EXAMPLE_OUTPUT_ROOT, "auxillary")
33+
dir_aux = os.path.join(EXAMPLE_OUTPUT_ROOT, "auxiliary")
3434
dir_mesmer_params = os.path.join(EXAMPLE_OUTPUT_ROOT, "calibrated_parameters")
3535
dir_mesmer_emus = os.path.join(EXAMPLE_OUTPUT_ROOT, "emulations")
3636

examples/train_create_emus_automated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main(cfg):
1919

2020
# specify the target variable
2121
targ = cfg.targs[0]
22-
print(f"Target variables: {targ}")
22+
print(f"Target variable: {targ}")
2323

2424
# load in the ESM runs
2525
esms = cfg.esms

mesmer/calibrate_mesmer/train_gt.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def train_gt(data, targ, esm, time, cfg, save_params=True):
129129
for scen, data in gt_to_distribute.items():
130130
params_gt[scen] = data.squeeze()
131131

132-
# save the global trend paramters if requested
132+
# save the global trend parameters if requested
133133
if save_params:
134134
save_mesmer_data(
135135
params_gt,
@@ -251,7 +251,7 @@ def train_gt_ic_OLSVOLC(var, gt_lowess, time, cfg=None):
251251

252252
# fit linear regression of gt to aod (because some ESMs react very strongly to
253253
# volcanoes)
254-
# no intercept to not artifically move the ts
254+
# no intercept to not artificially move the ts
255255
lr.fit(
256256
predictors={"aod_obs": aod_obs_all},
257257
target=gv_all_for_aod,
@@ -265,7 +265,7 @@ def train_gt_ic_OLSVOLC(var, gt_lowess, time, cfg=None):
265265
# apply linear regression model to obtain volcanic spikes
266266
contrib_volc = lr.predict(predictors={"aod_obs": aod_obs})
267267

268-
# merge the lowess trend wit the volc contribution
268+
# merge the lowess trend with the volc contribution
269269
gt = gt_lowess + contrib_volc.values.squeeze()
270270

271271
return coef_saod, gt

mesmer/calibrate_mesmer/train_gv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def train_gv(gv, targ, esm, cfg, save_params=True, **kwargs):
8484

8585
# apply the chosen method
8686
if params_gv["method"] == "AR" and wgt_scen_tr_eq:
87-
# specifiy parameters employed for AR process fitting
87+
# specify parameters employed for AR process fitting
8888

8989
kwargs["max_lag"] = kwargs.get("max_lag", 12)
9090
kwargs["sel_crit"] = kwargs.get("sel_crit", "bic")
@@ -93,7 +93,7 @@ def train_gv(gv, targ, esm, cfg, save_params=True, **kwargs):
9393
else:
9494
raise ValueError("No such method and/ or weighting approach.")
9595

96-
# save the global variability paramters if requested
96+
# save the global variability parameters if requested
9797
if save_params:
9898
save_mesmer_data(
9999
params_gv,

mesmer/calibrate_mesmer/train_lt.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def train_lt(preds, targs, esm, cfg, save_params=True):
6060
- ["full_model_contains_lv"] (whether the full model contains part of the local
6161
variability module, bool)
6262
params_lv : dict, optional
63-
dictionary of local variability paramters which are derived together with the
63+
dictionary of local variability parameters which are derived together with the
6464
local trend parameters
6565
6666
- ["targs"] (emulated variables, str)
@@ -186,7 +186,7 @@ def train_lt(preds, targs, esm, cfg, save_params=True):
186186
else:
187187
raise NotImplementedError()
188188

189-
# save the local trend paramters if requested
189+
# save the local trend parameters if requested
190190
if save_params:
191191
save_mesmer_data(
192192
params_lt,

mesmer/calibrate_mesmer/train_lv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def train_lv(preds, targs, esm, cfg, save_params=True, aux={}, params_lv={}):
5555
Returns
5656
-------
5757
params_lv : dict
58-
dictionary of local variability paramters
58+
dictionary of local variability parameters
5959
6060
- ["targs"] (emulated variables, str)
6161
- ["esm"] (Earth System Model, str)

mesmer/core/computation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _calc_geodist_exact(lon, lat):
180180
geodist = np.zeros([n_points, n_points])
181181

182182
# calculate only the upper right half of the triangle
183-
for i in range(n_points):
183+
for i in range(n_points - 1):
184184

185185
# need to duplicate gridpoint (required by geod.inv)
186186
lt = np.repeat(lat[i : i + 1], n_points - (i + 1))

mesmer/core/grid.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def stack_lat_lon(
127127
def unstack_lat_lon_and_align(
128128
data, coords_orig, *, x_dim="lon", y_dim="lat", stack_dim="gridcell"
129129
):
130-
"""unstack an 1D grid to a regular lat-lon grid and align with orignal coords
130+
"""unstack an 1D grid to a regular lat-lon grid and align with original coords
131131
132132
Parameters
133133
----------
@@ -184,7 +184,7 @@ def unstack_lat_lon(data, *, x_dim="lon", y_dim="lat", stack_dim="gridcell"):
184184

185185

186186
def align_to_coords(data, coords_orig):
187-
"""align an unstacked lat-lon grid with its orignal coords
187+
"""align an unstacked lat-lon grid with its original coords
188188
189189
Parameters
190190
----------

mesmer/core/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _minimize_local_discrete(func, sequence, **kwargs):
6161
raise ValueError("`fun` returned `-inf`")
6262
# skip element if inf is returned - not sure about this?
6363
elif np.isinf(res):
64-
warnings.warn("`fun` retured `inf`", OptimizeWarning)
64+
warnings.warn("`fun` returned `inf`", OptimizeWarning)
6565

6666
if res < current_min:
6767
current_min = res

mesmer/core/weighted.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def lat_weights(lat_coords):
3535

3636

3737
def weighted_mean(data, weights, dims=None):
38-
"""weighted mean - convinience function which ignores data_vars missing dims
38+
"""weighted mean - convenience function which ignores data_vars missing dims
3939
4040
Parameters
4141
----------

mesmer/create_emulations/create_emus_gv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def create_emus_gv_AR(params_gv, nr_emus_v, nr_ts_emus_v, seed):
135135
number of time steps in each global variability emulation
136136
137137
seed : int
138-
esm and scenario specific seed for gv module to ensure reproducability of
138+
esm and scenario specific seed for gv module to ensure reproducibility of
139139
results
140140
141141
Returns

mesmer/create_emulations/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _gather_lr_preds(preds_dict, predictor_names, scen, dims):
5757
Parameters
5858
----------
5959
preds_dict : dict
60-
Dictonary containg all predictors.
60+
Dictionary containing all predictors.
6161
predictor_names : list of str
6262
List of all predictors to gather from ``preds_dict``.
6363
scen : str
@@ -68,7 +68,7 @@ def _gather_lr_preds(preds_dict, predictor_names, scen, dims):
6868
Returns
6969
-------
7070
predictors : dict
71-
Dictonary of gathered predictors.
71+
Dictionary of gathered predictors.
7272
7373
Notes
7474
-----
@@ -88,7 +88,7 @@ def _gather_lr_params(params_dict, targ, dims):
8888
Parameters
8989
----------
9090
params_dict : dict
91-
Dictonary containg all parameters.
91+
Dictionary containing all parameters.
9292
targ : str
9393
Name of target variable for which to read the parameters.
9494
dims : str, tuple of str

mesmer/io/_load_cmipng.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def extract_time_lon_lat_wgt3d(data):
5858

5959

6060
def find_files_cmipng(gen, esm, var, scenario, dir_cmipng):
61-
"""Find filname in ETHZ cmip-ng archive.
61+
"""Find filename in ETHZ cmip-ng archive.
6262
6363
Parameters
6464
----------

mesmer/io/load_mesmer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def load_mesmer_output(
4040
target variables (e.g., "tas")
4141
esm_str : str, optional
4242
Earth System Model (e.g., "CanESM2", "CanESM5")
43-
scen_str : str, otional
43+
scen_str : str, optional
4444
scenario (e.g., "rcp85", "ssp585", "h-ssp585")
4545
mid_path : str, optional
4646
middle part of pathway depending on what exactly want to load (e.g.,
@@ -106,7 +106,7 @@ def load_mesmer_output(
106106
dict_out = {}
107107
elif len(path_list) > 1:
108108
warnings.warn(
109-
"More than 1 file exists for these critera. "
109+
"More than 1 file exists for these criteria. "
110110
"Please be more concrete in your selection."
111111
" An empty dictionary will be returned.",
112112
)

mesmer/io/save_mesmer_bundle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def save_mesmer_data(params, *folders, filename_parts):
8888
Parameters
8989
----------
9090
params : Any
91-
Python object containg the parameters to save (e.g. a dictionary containing
91+
Python object containing the parameters to save (e.g. a dictionary containing
9292
numpy arrays etc.)
9393
*folders : str
9494
Name of the folders where to store the data.

mesmer/stats/linear_regression.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def predict(
7575
available_predictors = set(predictors.keys())
7676

7777
if required_predictors != available_predictors:
78-
raise ValueError("Missing or superflous predictors.")
78+
raise ValueError("Missing or superfluous predictors.")
7979

8080
prediction = params.intercept
8181
for key in required_predictors:

mesmer/stats/localized_covariance.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def find_localized_empirical_covariance(
8888
weights : xr.DataArray
8989
Weights for the individual samples.
9090
localizer : dict of DataArray```
91-
Dictonary containing the localization radii as keys and the localization matrix
91+
Dictionary containing the localization radii as keys and the localization matrix
9292
as values. The localization must be 2D and of shape n_gridpoints x n_gridpoints.
9393
Currently only the Gaspari-Cohn localizer is implemented in MESMER.
9494
dim : str
@@ -154,7 +154,7 @@ def _find_localized_empirical_covariance_np(data, weights, localizer, k_folds):
154154
weights : 1D array
155155
Weights for the individual samples.
156156
localizer : dict of array-like
157-
Dictonary containing the localization radii as keys and the localization matrix
157+
Dictionary containing the localization radii as keys and the localization matrix
158158
as values. The localization must be 2D and of shape nr_gridpoints x nr_gridpoints.
159159
Currently only the Gaspari-Cohn localizer is implemented in MESMER.
160160
k_folds : int

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = mesmer-emulator
3-
author = mesmer developpers
3+
author = mesmer developers
44
author_email = [email protected]
55
license = GPLv3+
66
keywords = climate atmosphere "Earth System Model Emulator"

tests/unit/test_grid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_to_unstructured_dropna(dropna, coords, time_pos):
136136

137137
da[slice(time_pos), 0, 0] = np.NaN
138138

139-
# the gridpoint is droped if ANY time step is NaN
139+
# the gridpoint is dropped if ANY time step is NaN
140140
expected[:, 0] = np.NaN
141141

142142
if dropna:

tests/unit/test_linear_regression.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def test_LR_predict(as_2D):
8888
)
8989
lr.params = params if as_2D else params.squeeze()
9090

91-
with pytest.raises(ValueError, match="Missing or superflous predictors"):
91+
with pytest.raises(ValueError, match="Missing or superfluous predictors"):
9292
lr.predict({})
9393

94-
with pytest.raises(ValueError, match="Missing or superflous predictors"):
94+
with pytest.raises(ValueError, match="Missing or superfluous predictors"):
9595
lr.predict({"tas": None, "something else": None})
9696

9797
tas = xr.DataArray([0, 1, 2], dims="time")

tests/unit/test_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def func(i, data_dict):
4747

4848
data_dict = {key: value for key, value in enumerate((5, np.inf, 3))}
4949

50-
with pytest.warns(mesmer.core.utils.OptimizeWarning, match="`fun` retured `inf`"):
50+
with pytest.warns(mesmer.core.utils.OptimizeWarning, match="`fun` returned `inf`"):
5151
result = mesmer.core.utils._minimize_local_discrete(
5252
func, data_dict.keys(), data_dict=data_dict
5353
)

0 commit comments

Comments
 (0)