diff --git a/notebooks/demo/tutorial_compression_netcdf.ipynb b/notebooks/demo/tutorial_compression_netcdf.ipynb index fd74dbd44362acae3a0c62ca90411cb794bffc2a..a6c6096acf21cbce72bb3b6144068c70077cd508 100644 --- a/notebooks/demo/tutorial_compression_netcdf.ipynb +++ b/notebooks/demo/tutorial_compression_netcdf.ipynb @@ -126,12 +126,22 @@ "pwd=!pwd\n", "pwd=pwd[0]\n", "source_uncompressed=f\"{pwd}/temp.nc\"\n", - "sds=xr.open_mfdataset(source)\n", + "sds=xr.open_mfdataset(source).isel(time=slice(1,13))\n", "for var in sds.variables:\n", " sds[var].encoding[\"zlib\"]=False\n", "sds.to_netcdf(source_uncompressed)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c6bf599-ba32-416f-ad51-1ddb058cbd83", + "metadata": {}, + "outputs": [], + "source": [ + "sds" + ] + }, { "cell_type": "code", "execution_count": null, @@ -307,7 +317,7 @@ "import numcodecs\n", "rounding = numcodecs.BitRound(keepbits=16)\n", "for var in omon2d.data_vars:\n", - " if var == \"time_bnds\":\n", + " if \"bnds\" in var :\n", " continue\n", " omon2d[var].data=rounding.decode(\n", " rounding.encode(\n", @@ -375,7 +385,7 @@ " source_uncompressed,\n", " engine=\"h5netcdf\",\n", " parallel=False\n", - ") " + ")" ] }, { @@ -408,7 +418,7 @@ " print(keepbits)\n", " if keepbits[var][0] > 0 :\n", " print(keepbits[var][0])\n", - " omon2d[var] = xb.xr_bitround(omon2d[[var]], keepbits+2)[var] # this one wraps around numcodecs.bitround\n", + " omon2d[var] = xb.xr_bitround(omon2d[[var]], keepbits)[var] # this one wraps around numcodecs.bitround\n", "bitinfoend=time.time()" ] }, @@ -490,13 +500,31 @@ "source": [ "!rm test_*compression*.nc" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0fd679fe-140a-4ab3-9a09-0349ad6ab821", + "metadata": {}, + "outputs": [], + "source": [ + "!rm temp.nc" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "31141e83-3c2c-4b05-a5ee-d070a9f7d004", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "eerie_io", + "display_name": "taucenv", "language": "python", - "name": "eerie_io" + "name": "taucenv" }, "language_info": { "codemirror_mode": { @@ -508,7 +536,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.0" + "version": "3.11.4" } }, "nbformat": 4,