Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dorbaker committed Nov 14, 2023
1 parent c6f9c0c commit 89ff060
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions datasets/nasa-nex-gddp-cmip6/nasa-nex-gddp-cmip6-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2036,10 +2036,10 @@
"for i in range(len(items[0].properties[\"kerchunk:indices\"][\"refs\"])):\n",
" if i % 100 == 1:\n",
" print(\n",
" list(items[0].properties[\"kerchunk:indices\"][\"refs\"].keys())[i], \n",
" list(items[0].properties[\"kerchunk:indices\"][\"refs\"].keys())[i],\n",
" items[0].properties[\"kerchunk:indices\"][\"refs\"][\n",
" list(items[0].properties[\"kerchunk:indices\"][\"refs\"].keys())[i]\n",
" ]\n",
" ],\n",
" )"
]
},
Expand Down Expand Up @@ -3555,12 +3555,16 @@
" for key in d[\"templates\"]:\n",
" d[\"templates\"][key] = d[\"templates\"][key] + \"?\" + sas_token\n",
" single_ref_sets.append(d)\n",
"mzz = MultiZarrToZarr(single_ref_sets, concat_dims=[\"time\"], identical_dims=[\"lat\",\"lon\"])\n",
"mzz = MultiZarrToZarr(\n",
" single_ref_sets, concat_dims=[\"time\"], identical_dims=[\"lat\", \"lon\"]\n",
")\n",
"d = mzz.translate()\n",
"m = fsspec.get_mapper(\"reference://\",fo=d)\n",
"m = fsspec.get_mapper(\"reference://\", fo=d)\n",
"m.fs.clear_instance_cache()\n",
"ds = xr.open_dataset(m, engine=\"zarr\", consolidated=False, decode_times=True, chunks=\"auto\")\n",
"ds = ds.convert_calendar(calendar = \"gregorian\", align_on = \"date\", missing = -99)\n",
"ds = xr.open_dataset(\n",
" m, engine=\"zarr\", consolidated=False, decode_times=True, chunks=\"auto\"\n",
")\n",
"ds = ds.convert_calendar(calendar=\"gregorian\", align_on=\"date\", missing=-99)\n",
"ds"
]
},
Expand Down Expand Up @@ -3595,13 +3599,15 @@
"from dask.diagnostics import ProgressBar\n",
"\n",
"with ProgressBar():\n",
" plt.figure(figsize=(30,5))\n",
" ds.isel(lat=22,lon=13).where(ds.isel(lat=22,lon=13).hurs>0).hurs.plot()\n",
" plt.figure(figsize=(30, 5))\n",
" ds.isel(lat=22, lon=13).where(ds.isel(lat=22, lon=13).hurs > 0).hurs.plot()\n",
" plt.ylabel(\"Relative Humidity\")\n",
" plt.xlabel(\"Date\")\n",
" plt.title(\"Relative Humidity Vs Time @ ({},{}) for model {}\".format(\n",
" ds.lat.values[22], ds.lon.values[13], items[0].properties[\"cmip6:model\"] \n",
" ))\n",
" plt.title(\n",
" \"Relative Humidity Vs Time @ ({},{}) for model {}\".format(\n",
" ds.lat.values[22], ds.lon.values[13], items[0].properties[\"cmip6:model\"]\n",
" )\n",
" )\n",
" plt.show()"
]
},
Expand Down

0 comments on commit 89ff060

Please sign in to comment.