Skip to content

Instantly share code, notes, and snippets.

@rsignell-usgs
Created November 26, 2023 17:07
Show Gist options
  • Save rsignell-usgs/64dc37589b73de32c72d1648c7c8142b to your computer and use it in GitHub Desktop.
Save rsignell-usgs/64dc37589b73de32c72d1648c7c8142b to your computer and use it in GitHub Desktop.
cmip6_leap_request.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "9d4b2906-acff-4f92-8e1c-b88929d21810",
"metadata": {
"tags": []
},
"source": [
"# Generate create a list of CMIP6 instance_ids \n",
"to [request data to be added to CMIP6 google storage](https://github.com/leap-stc/cmip6-leap-feedstock/issues/new/choose):"
]
},
{
"cell_type": "markdown",
"id": "95fa2ddd-3e83-470c-8752-cbe1c9aecc6e",
"metadata": {},
"source": [
"for example, from a NetCDF file `history` global attribute find the string like this:\n",
"``` \n",
"CMIP6/HighResMIP/MOHC/HadGEM3-GC31-HH/hist-1950/r1i1p1f1/Omon/so/gn/v20200514\n",
"```\n",
"then form a pattern in the cell below"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0a70ec05-12a8-4f49-83bc-b080fe19cd9a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['CMIP6.HighResMIP.NERC.HadGEM3-GC31-HH.hist-1950.r1i1p1f1.Omon.so.gn.v20200514',\n",
" 'CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.highres-future.r1i1p1f1.Omon.so.gn.v20200514',\n",
" 'CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.control-1950.r1i1p1f1.Omon.so.gn.v20200514',\n",
" 'CMIP6.HighResMIP.NERC.HadGEM3-GC31-HH.hist-1950.r1i1p1f1.Omon.thetao.gn.v20200514',\n",
" 'CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.control-1950.r1i1p1f1.Omon.thetao.gn.v20200514',\n",
" 'CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.highres-future.r1i1p1f1.Omon.thetao.gn.v20200514']"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pangeo_forge_esgf.parsing import parse_instance_ids\n",
"parse_iids = [\n",
" \"CMIP6.HighResMIP.*.HadGEM3-GC31-HH.*.*.*.so.*.*\",\n",
" \"CMIP6.HighResMIP.*.HadGEM3-GC31-HH.*.*.*.thetao.*.*\",\n",
"]\n",
"iids = []\n",
"for piid in parse_iids:\n",
" iids.extend(parse_instance_ids(piid))\n",
"iids"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "291a3d0a-a3a6-41c2-9939-3b95a9b91155",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "global-global-pangeo",
"language": "python",
"name": "conda-env-global-global-pangeo-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment