Open kthyng opened 2 years ago
This has to do with Proj 5 (#1124 and #1148). Long ago, I started looking at this and writing tests for everything, but never figured out the best way to fix it. Probably casting to float
on input would do, but then tests break because of string comparisons. The issue effectively is that we add a small epsilon to avoid Proj doing wrapping, but for float32, that epsilon is so small it rounds to 0.
@QuLogic Thanks for explaining it to me. I understand it's a more complicated issue now — hopefully someone googling in the future can find this and realize what their issue is if it comes up. Feel free to close it if you want.
Description
Type of float for
central_longitude
as an input to the Mercator projection results in a map, but type of np.float32 results in an empty map (whose range in x is essentially 0).Code to reproduce
results in
results in an empty space.
Full environment definition
### Operating system MacOS ### Cartopy version 0.19.0.post1 ### conda list ``` # packages in environment at /Users/kthyng/miniconda3/envs/ocean-model-skill-assessor: # # Name Version Build Channel aiohttp 3.8.1 py39h63b48b0_1 conda-forge aiosignal 1.2.0 pyhd8ed1ab_0 conda-forge alabaster 0.7.12 py_0 conda-forge anyio 3.6.1 py39h6e9494a_0 conda-forge appdirs 1.4.4 pyh9f0ad1d_0 conda-forge appnope 0.1.3 pyhd8ed1ab_0 conda-forge argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge argon2-cffi-bindings 21.2.0 py39h63b48b0_2 conda-forge asciitree 0.3.3 pypi_0 pypi astroid 2.7.2 py39h6e9494a_0 conda-forge asttokens 2.0.5 pyhd8ed1ab_0 conda-forge async-timeout 4.0.2 pyhd8ed1ab_0 conda-forge attrs 22.1.0 pyh71513ae_1 conda-forge babel 2.10.3 pyhd8ed1ab_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge beautifulsoup4 4.11.1 pyha770c72_0 conda-forge black 22.6.0 py39h6e9494a_2 conda-forge bleach 5.0.1 pyhd8ed1ab_0 conda-forge bokeh 2.4.3 py39h6e9494a_0 conda-forge brotli 1.0.9 h5eb16cf_7 conda-forge brotli-bin 1.0.9 h5eb16cf_7 conda-forge brotlipy 0.7.0 py39h63b48b0_1004 conda-forge bzip2 1.0.8 h0d85af4_4 conda-forge c-ares 1.18.1 h0d85af4_0 conda-forge ca-certificates 2022.6.15 h033912b_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cartopy 0.19.0.post1 py39hada9a11_0 conda-forge certifi 2022.6.15 py39h6e9494a_0 conda-forge cf_xarray 0.7.4 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py39hae9ecf2_0 conda-forge cfgv 3.3.1 pyhd8ed1ab_0 conda-forge cftime 1.6.1 py39h15b18c7_0 conda-forge charset-normalizer 2.1.0 pyhd8ed1ab_0 conda-forge check-manifest 0.46 pyhd8ed1ab_0 conda-forge click 8.1.3 py39h6e9494a_0 conda-forge cloudpickle 2.1.0 pyhd8ed1ab_0 conda-forge cmarkgfm 0.8.0 py39h63b48b0_1 conda-forge cmocean 2.0 py_3 conda-forge colorama 0.4.5 pyhd8ed1ab_0 conda-forge colorspacious 1.1.2 pyh24bf2e0_0 conda-forge conda 4.13.0 py39h6e9494a_1 conda-forge conda-package-handling 1.8.1 py39h63b48b0_1 conda-forge coverage 6.4.3 py39h6218fd2_0 conda-forge cryptography 37.0.4 py39h9c2a9ce_0 conda-forge curl 7.83.1 h372c54d_0 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge cytoolz 0.12.0 py39h701faf5_0 conda-forge dask 2021.7.0 pyhd8ed1ab_0 conda-forge dask-core 2021.7.0 pyhd3eb1b0_0 debugpy 1.6.0 py39hfd1d529_0 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge distlib 0.3.5 pyhd8ed1ab_0 conda-forge distributed 2021.7.0 py39hecd8cb5_0 doctr 1.9.0 pyhd8ed1ab_0 conda-forge docutils 0.17.1 py39h6e9494a_0 conda-forge entrypoints 0.4 pyhd8ed1ab_0 conda-forge erddapy 1.0.0 pypi_0 pypi execnet 1.9.0 pyhd8ed1ab_0 conda-forge executing 0.9.1 pyhd8ed1ab_0 conda-forge extract_model 0.7 pyhd8ed1ab_0 conda-forge fasteners 0.16.3 pypi_0 pypi filelock 3.7.1 pyhd8ed1ab_0 conda-forge flake8 3.9.2 pyhd8ed1ab_0 conda-forge flake8-builtins 1.5.3 pyh9f0ad1d_0 conda-forge flake8-comprehensions 3.6.1 pyhd8ed1ab_0 conda-forge flake8-mutable 1.2.0 py_1 conda-forge flake8-print 4.0.0 pyhd8ed1ab_0 conda-forge flit-core 3.7.1 pyhd8ed1ab_0 conda-forge fonttools 4.34.4 py39h701faf5_0 conda-forge freetype 2.10.4 h4cff582_1 conda-forge frozenlist 1.3.1 py39h6218fd2_0 conda-forge fsspec 2022.7.1 pyhd8ed1ab_0 conda-forge geojson 2.5.0 py_0 conda-forge geos 3.9.1 he49afe7_2 conda-forge gettext 0.19.8.1 hd1a6beb_1008 conda-forge giflib 5.2.1 hbcb3906_2 conda-forge glib 2.72.1 h2292cb8_0 conda-forge glib-tools 2.72.1 h2292cb8_0 conda-forge gst-plugins-base 1.20.3 hda0ba4b_0 conda-forge gstreamer 1.20.3 hdc08c3f_0 conda-forge h5netcdf 0.11.0 pyhd8ed1ab_0 conda-forge h5py 3.7.0 nompi_py39h66c274d_100 conda-forge hdf4 4.2.15 hefd3b78_3 conda-forge hdf5 1.12.1 nompi_ha60fbc9_104 conda-forge heapdict 1.0.1 py_0 conda-forge icu 70.1 h96cf925_0 conda-forge identify 2.5.3 pyhd8ed1ab_0 conda-forge idna 3.3 pyhd8ed1ab_0 conda-forge imagesize 1.4.1 pyhd8ed1ab_0 conda-forge importlib-metadata 4.11.4 py39h6e9494a_0 conda-forge importlib-resources 5.9.0 pyhd8ed1ab_0 conda-forge importlib_metadata 4.11.4 hd8ed1ab_0 conda-forge importlib_resources 5.9.0 pyhd8ed1ab_0 conda-forge iniconfig 1.1.1 pyh9f0ad1d_0 conda-forge intake 0.6.2 pypi_0 pypi intake-xarray 0.6.0 pyhd8ed1ab_0 conda-forge ioos_qc 1.0.0 pyh9f0ad1d_0 conda-forge ipykernel 6.15.1 pyh736e0ef_0 conda-forge ipython 8.4.0 py39h6e9494a_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.7.1 pyhd8ed1ab_0 conda-forge isort 5.9.2 pypi_0 pypi jedi 0.18.1 pyhd8ed1ab_2 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge joblib 1.1.0 pyhd8ed1ab_0 conda-forge jpeg 9e hac89ed1_2 conda-forge json5 0.9.5 pyh9f0ad1d_0 conda-forge jsonschema 4.9.1 pyhd8ed1ab_0 conda-forge jupyter 1.0.0 py39h6e9494a_6 conda-forge jupyter_client 7.3.4 pyhd8ed1ab_0 conda-forge jupyter_console 6.4.4 pyhd8ed1ab_0 conda-forge jupyter_core 4.11.1 py39h6e9494a_0 conda-forge jupyter_server 1.18.1 pyhd8ed1ab_0 conda-forge jupyterlab 3.0.16 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge jupyterlab_server 2.15.0 pyhd8ed1ab_0 conda-forge jupyterlab_widgets 1.1.1 pyhd8ed1ab_0 conda-forge keyring 23.7.0 py39h6e9494a_0 conda-forge kiwisolver 1.4.4 py39h7c694c3_0 conda-forge krb5 1.19.3 hb49756b_0 conda-forge lazy-object-proxy 1.7.1 py39h63b48b0_1 conda-forge lcms2 2.12 h577c468_0 conda-forge lerc 4.0.0 hb486fe8_0 conda-forge libarchive 3.5.2 hde4784d_3 conda-forge libblas 3.9.0 15_osx64_openblas conda-forge libbrotlicommon 1.0.9 h5eb16cf_7 conda-forge libbrotlidec 1.0.9 h5eb16cf_7 conda-forge libbrotlienc 1.0.9 h5eb16cf_7 conda-forge libcblas 3.9.0 15_osx64_openblas conda-forge libclang 14.0.6 default_h55ffa42_0 conda-forge libclang13 14.0.6 default_hb5731bd_0 conda-forge libcurl 7.83.1 h372c54d_0 conda-forge libcxx 14.0.6 hce7ea42_0 conda-forge libdeflate 1.13 h775f41a_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 haf1e3a3_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge libgfortran5 9.3.0 h6c81a4c_23 conda-forge libglib 2.72.1 hfbcb929_0 conda-forge libiconv 1.16 haf1e3a3_0 conda-forge liblapack 3.9.0 15_osx64_openblas conda-forge libllvm11 11.1.0 hd011deb_3 conda-forge libllvm14 14.0.6 h41df66c_0 conda-forge libmamba 0.25.0 h2d3d89a_1 conda-forge libmambapy 0.25.0 py39h3f08081_1 conda-forge libnetcdf 4.8.1 nompi_h6609ca0_102 conda-forge libnghttp2 1.47.0 h942079c_0 conda-forge libogg 1.3.4 h35c211d_1 conda-forge libopenblas 0.3.20 openmp_h4e9756f_1 conda-forge libopus 1.3.1 hc929b4f_1 conda-forge libpng 1.6.37 h5a3d3bf_3 conda-forge libpq 14.4 hf6bb32a_0 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libsolv 0.7.22 hd9580d2_0 conda-forge libssh2 1.10.0 h52ee1ee_2 conda-forge libtiff 4.4.0 h5e0c7b4_3 conda-forge libvorbis 1.3.7 h046ec9c_0 conda-forge libwebp 1.2.3 hf64df63_1 conda-forge libwebp-base 1.2.3 hac89ed1_2 conda-forge libxcb 1.13 h0d85af4_1004 conda-forge libxml2 2.9.14 h08a9926_3 conda-forge libzip 1.9.2 hab082e8_0 conda-forge libzlib 1.2.12 hfe4f2af_2 conda-forge llvm-openmp 14.0.4 ha654fa7_0 conda-forge llvmlite 0.38.1 py39hdfe08e5_0 conda-forge locket 1.0.0 pyhd8ed1ab_0 conda-forge lz4-c 1.9.3 he49afe7_1 conda-forge lzo 2.10 haf1e3a3_1000 conda-forge mamba 0.25.0 py39ha435c47_1 conda-forge markupsafe 2.1.1 py39h63b48b0_1 conda-forge matplotlib-base 3.5.2 py39h64a0072_1 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge mccabe 0.6.1 pypi_0 pypi mistune 0.8.4 py39h89e85a6_1005 conda-forge more-itertools 8.13.0 pyhd8ed1ab_0 conda-forge msgpack-python 1.0.4 py39h7c694c3_0 conda-forge multidict 6.0.2 py39h63b48b0_1 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge mypy 0.910 py39h89e85a6_0 conda-forge mypy_extensions 0.4.3 py39h6e9494a_5 conda-forge mysql-common 8.0.30 h924029e_0 conda-forge mysql-libs 8.0.30 h3cab752_0 conda-forge nbclassic 0.4.3 pyhd8ed1ab_0 conda-forge nbclient 0.6.6 pyhd8ed1ab_0 conda-forge nbconvert 6.5.0 pyhd8ed1ab_0 conda-forge nbconvert-core 6.5.0 pyhd8ed1ab_0 conda-forge nbconvert-pandoc 6.5.0 pyhd8ed1ab_0 conda-forge nbformat 5.4.0 pyhd8ed1ab_0 conda-forge nbsphinx 0.8.7 pyhd8ed1ab_0 conda-forge ncurses 6.3 h96cf925_1 conda-forge nest-asyncio 1.5.5 pyhd8ed1ab_0 conda-forge netcdf4 1.6.0 nompi_py39h340a447_100 conda-forge nodeenv 1.7.0 pyhd8ed1ab_0 conda-forge notebook 6.4.12 pyha770c72_0 conda-forge notebook-shim 0.1.0 pyhd8ed1ab_0 conda-forge nspr 4.32 hcd9eead_1 conda-forge nss 3.78 ha8197d3_0 conda-forge numba 0.55.2 py39hc37845d_0 conda-forge numcodecs 0.8.0 pypi_0 pypi numpy 1.22.4 py39h677350a_0 conda-forge ocean-model-skill-assessor 0.1.dev56+g9f5f955.d20210913 dev_0