Skip to content

Commit

Permalink
Use new xeofs syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
r-ford committed Apr 5, 2024
1 parent 344445c commit e1aa2b2
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions notebooks/climate-modes-xeofs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
"from scipy import stats, signal\n",
"from cartopy import crs as ccrs, feature as cfeature\n",
"from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter\n",
"\n",
"from xeofs.xarray import EOF"
"import xeofs as xe"
]
},
{
Expand Down Expand Up @@ -130,10 +129,10 @@
"metadata": {},
"outputs": [],
"source": [
"s_model = EOF(sst, n_modes=4, dim=['time'], weights='coslat')\n",
"s_model.solve()\n",
"s_eofs = s_model.eofs()\n",
"s_pcs = s_model.pcs()\n",
"s_model = xe.models.EOF(n_modes=4, use_coslat=True)\n",
"s_model.fit(sst, dim='time')\n",
"s_eofs = s_model.components()\n",
"s_pcs = s_model.scores()\n",
"s_expvar = s_model.explained_variance_ratio()"
]
},
Expand Down Expand Up @@ -238,10 +237,10 @@
"metadata": {},
"outputs": [],
"source": [
"ds_model = EOF(ssta_dt, n_modes=4, dim=['time'], weights='coslat')\n",
"ds_model.solve()\n",
"ds_eofs = ds_model.eofs()\n",
"ds_pcs = ds_model.pcs()\n",
"ds_model = xe.models.EOF(n_modes=4, use_coslat=True)\n",
"ds_model.fit(ssta_dt, dim='time')\n",
"ds_eofs = ds_model.components()\n",
"ds_pcs = ds_model.scores()\n",
"ds_expvar = ds_model.explained_variance_ratio()"
]
},
Expand Down Expand Up @@ -303,10 +302,10 @@
"metadata": {},
"outputs": [],
"source": [
"ep_model = EOF(ep_ssta_dt, n_modes=4, dim=['time'], norm=True, weights='coslat')\n",
"ep_model.solve()\n",
"ep_eofs = ep_model.eofs()\n",
"ep_pcs = ep_model.pcs()\n",
"ep_model = xe.models.EOF(n_modes=4, use_coslat=True)\n",
"ep_model.fit(ep_ssta_dt, dim='time')\n",
"ep_eofs = ep_model.components()\n",
"ep_pcs = ep_model.scores()\n",
"ep_expvar = ep_model.explained_variance_ratio()"
]
},
Expand Down Expand Up @@ -411,10 +410,10 @@
"metadata": {},
"outputs": [],
"source": [
"np_model = EOF(np_ssta_dt, n_modes=4, dim=['time'], norm=True, weights='coslat')\n",
"np_model.solve()\n",
"np_eofs = np_model.eofs()\n",
"np_pcs = np_model.pcs()\n",
"np_model = xe.models.EOF(n_modes=4, use_coslat=True)\n",
"np_model.fit(np_ssta_dt, dim='time')\n",
"np_eofs = np_model.components()\n",
"np_pcs = np_model.scores()\n",
"np_expvar = np_model.explained_variance_ratio()"
]
},
Expand Down Expand Up @@ -491,7 +490,7 @@
"## Resources and references\n",
"Huang, B., Thorne, P. S., Banzon, V., Boyer, T. P., Chepurin, G. A., Lawrimore, J. H., Menne, M. J., Smith, T. J., Vose, R. S., & Zhang, H. (2017). Extended Reconstructed Sea Surface Temperature, Version 5 (ERSSTv5): Upgrades, Validations, and Intercomparisons. *Journal of Climate*, *30*(20), 8179–8205. https://doi.org/10.1175/jcli-d-16-0836.1\n",
"\n",
"Niclas Rieger, actions-user, Sam Levang, & Aaron Spring. (2023). nicrie/xeofs: v0.7.2 (v0.7.2). Zenodo. https://doi.org/10.5281/zenodo.7521663"
"Rieger et al., (2024). xeofs: Comprehensive EOF analysis in Python with xarray. *Journal of Open Source Software*, *9*(93), 6060, https://doi.org/10.21105/joss.06060"
]
}
],
Expand Down

0 comments on commit e1aa2b2

Please sign in to comment.