Open dnowacki-usgs opened 6 months ago
The caching is currently per figure for interactive speed per this comment: https://github.com/SciTools/cartopy/blob/5e449397646e499e918b629c657e93c4c48b96f9/lib/cartopy/io/ogc_clients.py#L349-L357
A local cache would be a great addition, similar to what is available in the img_tiles
:
https://github.com/SciTools/cartopy/blob/5e449397646e499e918b629c657e93c4c48b96f9/lib/cartopy/io/img_tiles.py#L59-L69
For reference, this is the PR that was added in: https://github.com/SciTools/cartopy/pull/1533
Thank you for this clarification. Happy to close this now, or leave it open if someone wants to take it on as an enhancement. I'd love to make a PR but likely won't be able to in the immediate future.
I think it makes sense to leave this open as a feature request. It seems like an obvious thing for people to want and @greglucas has now included some guidance for if/when someone has time to look into it.
I couldn't help myself and threw a proof of concept PR together (#2316). Bad timing as I will be traveling for the next couple of weeks, but the basic functionality is working.
Description
I asked a relevant question on SO a few months back but raising as an issue here as the current documentation is unclear and/or misleading.
When accessing a WMTS source,
ax.add_wmts()
callsWMTSRasterSource()
. The docs forWMTSRasterSource
state that it "Uses tile caching for fast repeated map retrievals" and a glance at the code indicates cache-related stuff going on.In my experience, however, no caching is performed, and repeated identical calls result in network activity every time. Are the docs referring to some other kind of caching?
Code to reproduce
Full environment definition
### Operating system macOS 13.6.3 ### Cartopy version 0.22.0 ### conda list ``` # Name Version Build Channel adal 1.2.7 pyhd8ed1ab_0 conda-forge adlfs 2023.10.0 pyhd8ed1ab_0 conda-forge affine 2.4.0 pyhd8ed1ab_0 conda-forge aiobotocore 2.9.0 pyhd8ed1ab_0 conda-forge aiohttp 3.9.1 py311he705e18_0 conda-forge aioitertools 0.11.0 pyhd8ed1ab_0 conda-forge aiosignal 1.3.1 pyhd8ed1ab_0 conda-forge alabaster 0.7.15 pyhd8ed1ab_0 conda-forge annotated-types 0.6.0 pyhd8ed1ab_0 conda-forge antlr-python-runtime 4.11.1 pyhd8ed1ab_0 conda-forge anyio 4.2.0 pyhd8ed1ab_0 conda-forge aom 3.5.0 hf0c8a7f_0 conda-forge appdirs 1.4.4 pyh9f0ad1d_0 conda-forge appnope 0.1.3 pyhd8ed1ab_0 conda-forge argon2-cffi 23.1.0 pyhd8ed1ab_0 conda-forge argon2-cffi-bindings 21.2.0 py311h2725bcf_4 conda-forge arpack 3.7.0 hefb7bc6_2 conda-forge arrow 1.3.0 pyhd8ed1ab_0 conda-forge arrow-cpp 11.0.0 h694c41f_9_cpu conda-forge asciidoctor 2.0.20 h5145e1c_0 conda-forge asciitree 0.3.3 py_2 conda-forge asttokens 2.4.1 pyhd8ed1ab_0 conda-forge async-lru 2.0.4 pyhd8ed1ab_0 conda-forge async-timeout 4.0.3 pyhd8ed1ab_0 conda-forge async_generator 1.10 py_0 conda-forge atk-1.0 2.38.0 h1d18e73_1 conda-forge attrs 23.2.0 pyh71513ae_0 conda-forge aws-c-auth 0.6.26 h684266e_2 conda-forge aws-c-cal 0.5.21 hf54dd2f_2 conda-forge aws-c-common 0.8.14 hb7f2c08_0 conda-forge aws-c-compression 0.2.16 h99c63db_5 conda-forge aws-c-event-stream 0.2.20 h0ae4c0f_4 conda-forge aws-c-http 0.7.6 hcdd7835_0 conda-forge aws-c-io 0.13.19 had634fe_3 conda-forge aws-c-mqtt 0.8.6 ha4e05e3_12 conda-forge aws-c-s3 0.2.7 hba8c00c_1 conda-forge aws-c-sdkutils 0.1.9 h99c63db_0 conda-forge aws-checksums 0.1.14 h99c63db_5 conda-forge aws-crt-cpp 0.19.8 h8b21dc2_12 conda-forge aws-sdk-cpp 1.10.57 h0d082ec_8 conda-forge awscli 2.13.39 py311h6eed73b_0 conda-forge awscrt 0.16.13 py311he964f54_4 conda-forge azure-core 1.29.5 pyhd8ed1ab_0 conda-forge azure-datalake-store 0.0.51 pyh9f0ad1d_0 conda-forge azure-identity 1.15.0 pyhd8ed1ab_0 conda-forge azure-storage-blob 12.19.0 pyhd8ed1ab_0 conda-forge babel 2.14.0 pyhd8ed1ab_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 pyhd8ed1ab_3 conda-forge backports.functools_lru_cache 2.0.0 pyhd8ed1ab_0 conda-forge beautifulsoup4 4.12.2 pyha770c72_0 conda-forge black 23.12.1 py311h6eed73b_0 conda-forge blackdoc 0.3.9 pyhd8ed1ab_0 conda-forge bleach 6.1.0 pyhd8ed1ab_0 conda-forge blinker 1.7.0 pyhd8ed1ab_0 conda-forge blosc 1.21.5 heccf04b_0 conda-forge bmipy 2.0.1 pyhd8ed1ab_0 conda-forge bokeh 3.3.2 pyhd8ed1ab_0 conda-forge boltons 23.1.1 pyhd8ed1ab_0 conda-forge boost-cpp 1.78.0 h31500c2_2 conda-forge botocore 1.33.13 pyhd8ed1ab_0 conda-forge bottleneck 1.3.7 py311h4a70a88_1 conda-forge bounded-pool-executor 0.0.3 pyhd8ed1ab_0 conda-forge branca 0.7.0 pyhd8ed1ab_1 conda-forge brotli 1.0.9 hb7f2c08_9 conda-forge brotli-bin 1.0.9 hb7f2c08_9 conda-forge brotli-python 1.0.9 py311h814d153_9 conda-forge brotlipy 0.7.0 py311h2725bcf_1006 conda-forge brunsli 0.1 h046ec9c_0 conda-forge bzip2 1.0.8 h10d778d_5 conda-forge c-ares 1.24.0 h10d778d_0 conda-forge c-blosc2 2.12.0 h0ae8482_0 conda-forge ca-certificates 2023.11.17 h8857fd0_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cairo 1.16.0 h904041c_1014 conda-forge cartopy 0.22.0 py311h1eadf79_1 conda-forge cctools 973.0.1 hd9ad811_15 conda-forge cctools_osx-64 973.0.1 habff3f6_15 conda-forge certifi 2023.11.17 pyhd8ed1ab_0 conda-forge cf-units 3.2.0 py311hc9a392d_4 conda-forge cffi 1.16.0 py311hc0b63fd_0 conda-forge cfgv 3.3.1 pyhd8ed1ab_0 conda-forge cfitsio 4.2.0 hd56cc12_0 conda-forge cftime 1.6.3 py311hc9a392d_0 conda-forge charls 2.4.2 he965462_0 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge clang 15.0.7 hac416ee_4 conda-forge clang-15 15.0.7 default_h6b1ee41_4 conda-forge clang_impl_osx-64 15.0.7 h03d6864_8 conda-forge clang_osx-64 15.0.7 hb91bd55_8 conda-forge clangxx 15.0.7 default_h6b1ee41_4 conda-forge click 8.1.7 unix_pyh707e725_0 conda-forge click-plugins 1.1.1 py_0 conda-forge cligj 0.7.2 pyhd8ed1ab_1 conda-forge cloudpickle 3.0.0 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge colorcet 3.0.1 pyhd8ed1ab_0 conda-forge comm 0.2.1 pyhd8ed1ab_0 conda-forge commonmark 0.9.1 py_0 conda-forge compiler-rt 15.0.7 ha38d28d_2 conda-forge compiler-rt_osx-64 15.0.7 ha38d28d_2 conda-forge compliance-checker 5.1.0 pyhd8ed1ab_0 conda-forge conda 23.7.4 py311h6eed73b_0 conda-forge conda-package-handling 2.2.0 pyh38be061_0 conda-forge conda-package-streaming 0.9.0 pyhd8ed1ab_0 conda-forge contourpy 1.2.0 py311h7bea37d_0 conda-forge coverage 7.4.0 py311he705e18_0 conda-forge cryptography 40.0.2 py311h61927ef_0 conda-forge curl 8.1.2 hbee3ae8_0 conda-forge cycler 0.12.1 pyhd8ed1ab_0 conda-forge cytoolz 0.12.2 py311h2725bcf_1 conda-forge dask 2023.12.1 pyhd8ed1ab_0 conda-forge dask-core 2023.12.1 pyhd8ed1ab_0 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge dav1d 1.2.1 h0dc2134_0 conda-forge debugpy 1.8.0 py311hdf8f085_1 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge distlib 0.3.8 pyhd8ed1ab_0 conda-forge distributed 2023.12.1 pyhd8ed1ab_0 conda-forge distro 1.8.0 pyhd8ed1ab_0 conda-forge docutils 0.19 py311h6eed73b_1 conda-forge dolfyn 1.3.0 py311h6eed73b_1 conda-forge earthaccess 0.8.2 pyhd8ed1ab_0 conda-forge entrypoints 0.4 pyhd8ed1ab_0 conda-forge et_xmlfile 1.1.0 pyhd8ed1ab_0 conda-forge exceptiongroup 1.2.0 pyhd8ed1ab_0 conda-forge execnet 2.0.2 pyhd8ed1ab_0 conda-forge executing 2.0.1 pyhd8ed1ab_0 conda-forge exiftool 12.42 pl5321h694c41f_0 conda-forge expat 2.5.0 hf0c8a7f_1 conda-forge fasteners 0.17.3 pyhd8ed1ab_0 conda-forge ffmpeg 5.1.2 gpl_h8b4fe81_106 conda-forge fftw 3.3.10 nompi_h4fa670e_108 conda-forge filelock 3.13.1 pyhd8ed1ab_0 conda-forge fiona 1.8.22 py311h9687163_5 conda-forge flake8 7.0.0 pyhd8ed1ab_0 conda-forge flit-core 3.9.0 pyhd8ed1ab_0 conda-forge fmt 9.1.0 hb8565cd_0 conda-forge folium 0.15.1 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 h77eed37_1 conda-forge fontconfig 2.14.2 h5bb23bf_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge fonttools 4.47.0 py311he705e18_0 conda-forge fqdn 1.5.1 pyhd8ed1ab_0 conda-forge freetype 2.12.1 h60636b9_2 conda-forge freexl 1.0.6 hb7f2c08_1 conda-forge fribidi 1.0.10 hbcb3906_0 conda-forge frozenlist 1.4.1 py311he705e18_0 conda-forge fsspec 2023.12.2 pyhca7485f_0 conda-forge future 0.18.3 pyhd8ed1ab_0 conda-forge gdal 3.6.2 py311h619941e_9 conda-forge gdbm 1.18 h8a0c380_2 conda-forge gdk-pixbuf 2.42.10 he00a9fc_0 conda-forge geopandas 0.14.2 pyhd8ed1ab_0 conda-forge geopandas-base 0.14.2 pyha770c72_0 conda-forge geos 3.11.1 hf0c8a7f_0 conda-forge geotiff 1.7.1 hd690177_6 conda-forge gettext 0.21.1 h8a4c099_0 conda-forge gflags 2.2.2 hb1e8313_1004 conda-forge gfortran 13.2.0 h2c809b3_1 conda-forge gfortran_impl_osx-64 13.2.0 h7643cbd_1 conda-forge gfortran_osx-64 13.2.0 h18f7dce_1 conda-forge gh 2.40.1 h990441c_0 conda-forge ghostscript 10.02.1 h93d8f39_0 conda-forge giflib 5.2.1 hb7f2c08_3 conda-forge git 2.42.0 pl5321hbb4c4ee_0 conda-forge git-lfs 3.4.1 h694c41f_0 conda-forge glog 0.6.0 h8ac2a54_0 conda-forge gmp 6.3.0 h93d8f39_0 conda-forge gnutls 3.7.9 h1951705_0 conda-forge graphite2 1.3.13 h2e338ed_1001 conda-forge graphviz 7.1.0 hc51f7b9_0 conda-forge grpc-cpp 1.51.1 h88f4db0_3 conda-forge gtk2 2.24.33 h7c1209e_2 conda-forge gts 0.7.6 h53e17e3_4 conda-forge h11 0.14.0 pyhd8ed1ab_0 conda-forge h5netcdf 1.3.0 pyhd8ed1ab_0 conda-forge h5py 3.8.0 nompi_py311h777de7a_100 conda-forge harfbuzz 6.0.0 h08f8713_0 conda-forge hdf4 4.2.15 h7aa5921_5 conda-forge hdf5 1.12.2 nompi_h48135f9_101 conda-forge heapdict 1.0.1 py_0 conda-forge holoviews 1.18.1 pyhd8ed1ab_0 conda-forge hvplot 0.9.1 pyhd8ed1ab_0 conda-forge hydromt 0.8.0 pyhd8ed1ab_0 conda-forge hydromt_sfincs 1.0.2 pyhd8ed1ab_0 conda-forge icu 70.1 h96cf925_0 conda-forge identify 2.5.33 pyhd8ed1ab_0 conda-forge idna 3.6 pyhd8ed1ab_0 conda-forge imagecodecs 2023.1.23 py311h86fed7d_0 conda-forge imageio 2.33.1 pyh8c1a49c_0 conda-forge imagemagick 7.1.1_5 pl5321h3f82b43_1 conda-forge imagesize 1.4.1 pyhd8ed1ab_0 conda-forge importlib-metadata 7.0.1 pyha770c72_0 conda-forge importlib_metadata 7.0.1 hd8ed1ab_0 conda-forge importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge iniconfig 2.0.0 pyhd8ed1ab_0 conda-forge ipykernel 6.28.0 pyh3cd1d5f_0 conda-forge ipython 8.17.2 pyh31c8845_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isl 0.25 hb486fe8_0 conda-forge isodate 0.6.1 pyhd8ed1ab_0 conda-forge isoduration 20.11.0 pyhd8ed1ab_0 conda-forge isort 5.13.2 pyhd8ed1ab_0 conda-forge jbig 2.1 h0d85af4_2003 conda-forge jedi 0.19.1 pyhd8ed1ab_0 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge jmespath 1.0.1 pyhd8ed1ab_0 conda-forge joblib 1.3.2 pyhd8ed1ab_0 conda-forge jpeg 9e hb7f2c08_3 conda-forge json-c 0.16 h01d06f9_0 conda-forge json5 0.9.14 pyhd8ed1ab_0 conda-forge jsonpatch 1.33 pyhd8ed1ab_0 conda-forge jsonpointer 2.4 py311h6eed73b_3 conda-forge jsonschema 4.20.0 pyhd8ed1ab_0 conda-forge jsonschema-specifications 2023.12.1 pyhd8ed1ab_0 conda-forge jsonschema-with-format-nongpl 4.20.0 pyhd8ed1ab_0 conda-forge julia 1.9.3 h8d83f4a_0 conda-forge jupyter-lsp 2.2.1 pyhd8ed1ab_0 conda-forge jupyter_client 8.6.0 pyhd8ed1ab_0 conda-forge jupyter_core 5.7.1 py311h6eed73b_0 conda-forge jupyter_events 0.9.0 pyhd8ed1ab_0 conda-forge jupyter_server 2.12.2 pyhd8ed1ab_0 conda-forge jupyter_server_terminals 0.5.1 pyhd8ed1ab_0 conda-forge jupyterlab 4.0.10 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.3.0 pyhd8ed1ab_0 conda-forge jupyterlab_server 2.25.2 pyhd8ed1ab_0 conda-forge jxrlib 1.1 h10d778d_3 conda-forge kealib 1.5.0 h5c1f988_0 conda-forge kiwisolver 1.4.5 py311h5fe6e05_1 conda-forge krb5 1.20.1 h049b76e_0 conda-forge lame 3.100 hb7f2c08_1003 conda-forge landlab 2.7.0 py311h1eadf79_0 conda-forge lazy_loader 0.3 pyhd8ed1ab_0 conda-forge lcms2 2.15 h29502cd_0 conda-forge ld64 609 ha91a046_15 conda-forge ld64_osx-64 609 h0fd476b_15 conda-forge lerc 4.0.0 hb486fe8_0 conda-forge libabseil 20230125.0 cxx17_hf0c8a7f_1 conda-forge libaec 1.1.2 he965462_1 conda-forge libarchive 3.6.2 h6d8d9f1_0 conda-forge libarrow 11.0.0 hae1ae47_9_cpu conda-forge libavif 0.11.1 h22361c6_2 conda-forge libblas 3.9.0 20_osx64_openblas conda-forge libbrotlicommon 1.0.9 hb7f2c08_9 conda-forge libbrotlidec 1.0.9 hb7f2c08_9 conda-forge libbrotlienc 1.0.9 hb7f2c08_9 conda-forge libcblas 3.9.0 20_osx64_openblas conda-forge libclang-cpp15 15.0.7 default_h6b1ee41_4 conda-forge libcrc32c 1.1.2 he49afe7_0 conda-forge libcurl 8.1.2 hbee3ae8_0 conda-forge libcxx 16.0.6 hd57cbcb_0 conda-forge libdap4 3.20.6 h3e144a0_2 conda-forge libdeflate 1.17 hac1461d_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 h10d778d_2 conda-forge libevent 2.1.10 h7d65743_4 conda-forge libexpat 2.5.0 hf0c8a7f_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgd 2.3.3 h4685329_4 conda-forge libgdal 3.6.2 hd7924a8_9 conda-forge libgfortran 5.0.0 13_2_0_h97931a8_1 conda-forge libgfortran-devel_osx-64 13.2.0 h80d4556_1 conda-forge libgfortran5 13.2.0 h2873a65_1 conda-forge libglib 2.78.1 h6d9ecee_0 conda-forge libgoogle-cloud 2.8.0 h2ba3e75_0 conda-forge libgrpc 1.51.1 h5bc3d57_3 conda-forge libiconv 1.17 hd75f5a5_2 conda-forge libidn2 2.3.4 hb7f2c08_0 conda-forge libkml 1.3.0 hab3ca0e_1016 conda-forge liblapack 3.9.0 20_osx64_openblas conda-forge libllvm14 14.0.6 hc8e404f_4 conda-forge libllvm15 15.0.7 h7001e86_1 conda-forge libmagic 5.39 haaf19a9_0 conda-forge libmamba 1.4.9 hc2ec11d_0 conda-forge libmambapy 1.4.9 py311h266e549_0 conda-forge libnetcdf 4.9.1 nompi_h56690a0_101 conda-forge libnghttp2 1.58.0 h64cf6d3_1 conda-forge libopenblas 0.3.25 openmp_hfef2a42_0 conda-forge libopenblas-ilp64 0.3.25 openmp_h17068ef_0 conda-forge libopenlibm4 0.8.1 h10d778d_1 conda-forge libopus 1.3.1 hc929b4f_1 conda-forge libosxunwind 0.0.6 h940c156_0 conda-forge libpng 1.6.39 ha978bb4_0 conda-forge libpq 15.2 h3640bf0_0 conda-forge libprotobuf 3.21.12 h7d26f99_2 conda-forge librsvg 2.54.4 h3d48ba6_0 conda-forge librttopo 1.1.0 h9461dca_12 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libsolv 0.7.27 hf4d7fad_0 conda-forge libspatialindex 1.9.3 he49afe7_4 conda-forge libspatialite 5.0.1 hd6e941a_23 conda-forge libsqlite 3.44.2 h92b6c6a_0 conda-forge libssh2 1.11.0 hd019ec5_0 conda-forge libtasn1 4.19.0 hb7f2c08_0 conda-forge libthrift 0.18.0 h16802d8_0 conda-forge libtiff 4.5.0 hee9004a_2 conda-forge libtool 2.4.7 hf0c8a7f_0 conda-forge libudunits2 2.2.28 h516ac8c_3 conda-forge libunistring 0.9.10 h0d85af4_0 conda-forge libutf8proc 2.8.0 hb7f2c08_0 conda-forge libvpx 1.11.0 he49afe7_3 conda-forge libwebp 1.2.4 h70a068d_1 conda-forge libwebp-base 1.2.4 h775f41a_0 conda-forge libxcb 1.13 h0d85af4_1004 conda-forge libxml2 2.10.3 h201ad9d_4 conda-forge libxslt 1.1.37 h5d22bc9_0 conda-forge libzip 1.10.1 hc158999_3 conda-forge libzlib 1.2.13 h8a1eda9_5 conda-forge libzopfli 1.0.3 h046ec9c_0 conda-forge linkify-it-py 2.0.2 pyhd8ed1ab_0 conda-forge llvm-openmp 17.0.6 hb6ac08f_0 conda-forge llvm-tools 15.0.7 h7001e86_1 conda-forge llvmlite 0.41.1 py311hb5c2e0a_0 conda-forge locket 1.0.0 pyhd8ed1ab_0 conda-forge lxml 4.9.2 py311h9f2bb26_0 conda-forge lz4 4.3.2 py311hbaf8d61_1 conda-forge lz4-c 1.9.4 hf0c8a7f_0 conda-forge lzo 2.10 haf1e3a3_1000 conda-forge mamba 1.4.9 py311h8082e30_0 conda-forge mapclassify 2.6.1 pyhd8ed1ab_0 conda-forge markdown 3.5.1 pyhd8ed1ab_0 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge markupsafe 2.1.3 py311h2725bcf_1 conda-forge matplotlib 3.8.2 py311h6eed73b_0 conda-forge matplotlib-base 3.8.2 py311hd316c10_0 conda-forge matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge mccabe 0.7.0 pyhd8ed1ab_0 conda-forge mdit-py-plugins 0.4.0 pyhd8ed1ab_0 conda-forge mdurl 0.1.2 pyhd8ed1ab_0 conda-forge metis 5.1.1 h93d8f39_2 conda-forge missingpy 0.2.0 dev_0