|
25 | 25 | " distrib=True)"
|
26 | 26 | ]
|
27 | 27 | },
|
| 28 | + { |
| 29 | + "cell_type": "markdown", |
| 30 | + "metadata": {}, |
| 31 | + "source": [ |
| 32 | + "**Warning**: don't use default search with `facets=*`.\n", |
| 33 | + "\n", |
| 34 | + "This behavior is kept for backward-compatibility, but ESGF indexes might not\n", |
| 35 | + "successfully perform a distributed search when this option is used, so some\n", |
| 36 | + "results may be missing. For full results, it is recommended to pass a list of\n", |
| 37 | + "facets of interest when instantiating a context object. For example,\n", |
| 38 | + "\n", |
| 39 | + " ctx = conn.new_context(facets='project,experiment_id')\n", |
| 40 | + "\n", |
| 41 | + "Only the facets that you specify will be present in the `facets_counts` dictionary.\n", |
| 42 | + "\n", |
| 43 | + "This warning is displayed when a distributed search is performed while using the\n", |
| 44 | + "`facets=*` default, a maximum of once per context object. To suppress this warning,\n", |
| 45 | + "set the environment variable `ESGF_PYCLIENT_NO_FACETS_STAR_WARNING` to any value\n", |
| 46 | + "or explicitly use `conn.new_context(facets='*')`" |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + "cell_type": "code", |
| 51 | + "execution_count": null, |
| 52 | + "metadata": {}, |
| 53 | + "outputs": [], |
| 54 | + "source": [ |
| 55 | + "facets='project,experiment_family'" |
| 56 | + ] |
| 57 | + }, |
28 | 58 | {
|
29 | 59 | "cell_type": "markdown",
|
30 | 60 | "metadata": {},
|
|
38 | 68 | "metadata": {},
|
39 | 69 | "outputs": [],
|
40 | 70 | "source": [
|
41 |
| - "ctx = conn.new_context(project='CMIP5', query='humidity')\n", |
| 71 | + "ctx = conn.new_context(project='CMIP5', query='humidity', facets=facets)\n", |
42 | 72 | "ctx.hit_count"
|
43 | 73 | ]
|
44 | 74 | },
|
|
64 | 94 | "metadata": {},
|
65 | 95 | "outputs": [],
|
66 | 96 | "source": [
|
67 |
| - "conn = SearchConnection('http://esgf-index1.ceda.ac.uk/esg-search', distrib=True)\n", |
68 |
| - "ctx = conn.new_context()\n", |
69 |
| - "dataset_id_pattern = \"cordex.output.WAS-44.IITM.CCCma-CanESM2.historical.r1i1p1.*\"\n", |
| 97 | + "conn = SearchConnection('http://esgf-index1.ceda.ac.uk/esg-search', distrib=False)\n", |
| 98 | + "ctx = conn.new_context(facets=facets)\n", |
| 99 | + "dataset_id_pattern = \"cmip5.output1.MOHC.HadGEM2-CC.historical.mon.atmos.Amon.*\"\n", |
70 | 100 | "results = ctx.search(query=\"id:%s\" % dataset_id_pattern)\n",
|
| 101 | + "len(results)" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "code", |
| 106 | + "execution_count": null, |
| 107 | + "metadata": {}, |
| 108 | + "outputs": [], |
| 109 | + "source": [ |
71 | 110 | "files = results[0].file_context().search()\n",
|
| 111 | + "len(files)" |
| 112 | + ] |
| 113 | + }, |
| 114 | + { |
| 115 | + "cell_type": "code", |
| 116 | + "execution_count": null, |
| 117 | + "metadata": {}, |
| 118 | + "outputs": [], |
| 119 | + "source": [ |
72 | 120 | "download_url = files[0].download_url\n",
|
73 | 121 | "print(download_url)"
|
74 | 122 | ]
|
|
208 | 256 | ],
|
209 | 257 | "metadata": {
|
210 | 258 | "kernelspec": {
|
211 |
| - "display_name": "Python 3", |
| 259 | + "display_name": "Python 3 (ipykernel)", |
212 | 260 | "language": "python",
|
213 | 261 | "name": "python3"
|
214 | 262 | },
|
|
222 | 270 | "name": "python",
|
223 | 271 | "nbconvert_exporter": "python",
|
224 | 272 | "pygments_lexer": "ipython3",
|
225 |
| - "version": "3.7.3" |
| 273 | + "version": "3.10.2" |
| 274 | + }, |
| 275 | + "nbTranslate": { |
| 276 | + "displayLangs": [ |
| 277 | + "*" |
| 278 | + ], |
| 279 | + "hotkey": "alt-t", |
| 280 | + "langInMainMenu": true, |
| 281 | + "sourceLang": "en", |
| 282 | + "targetLang": "fr", |
| 283 | + "useGoogleTranslate": true |
226 | 284 | }
|
227 | 285 | },
|
228 | 286 | "nbformat": 4,
|
|
0 commit comments