Skip to content

Dateline-crossing regions lead to value error when using cutout #514

Description

@ekatef

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest release of atlite.

  • I have confirmed this bug exists on the current master branch of atlite.

Issue Description

Possible duplicate of #301

As reported by @apigott, using atlite 0.5.0 leads to a following error if a region intersects the international date line: ValueError: cannot convert float NaN to integer. More details are available in this Discord thread

Reproducible Example

Take a modelling region intersecting the dateline, build a cutout and run build_renewable_profiles from PyPSA-Earth workflow.

Expected Behavior

Could be good to ensure the the workflow is running smoothly for any region.
Alternatively/additionally, some instructions can be given on how to deal with the dateline regions since it appears the issue can re-appear with changes in Copernicus API.

Error log

Traceback (most recent call last):
  File "~/Documents/oet/pypsa-earth/.snakemake/scripts/tmpq2fmubax.build_renewable_profiles.py", line 762, in <module>
    availability = cutout.availabilitymatrix(regions, excluder, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/site-packages/atlite/gis.py", line 749, in compute_availabilitymatrix
    availability = list(
                   ^^^^^
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/multiprocessing/pool.py", line 873, in next
    raise value
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/site-packages/atlite/gis.py", line 666, in _process_func
    return shape_availability_reprojected(shapes.loc[[i]], *args)[0]
  ^^^^^^^^^^^^^^^^^
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/site-packages/atlite/gis.py", line 362, in shape_availability_reprojected
    masked, transform = pad_extent(
      ^^^^^^^^^^^^^^^^^
  File "~/Documents/oet/pypsa-earth/.pixi/envs/default/lib/python3.11/site-packages/atlite/gis.py", line 248, in pad_extent
    pad = int(dst_transform[0] // covered_res * 1.1)
      ^^^^^^^^^^^^^^^^^
ValueError: cannot convert float NaN to integer

Installed Versions

Details

Package Version


affine 2.4.0
aiohappyeyeballs 2.6.2
aiohttp 3.14.1
aiosignal 1.4.0
amply 0.1.7
anyio 4.14.1
appdirs 1.4.4
appnope 0.1.4
argon2-cffi 25.1.0
argon2-cffi-bindings 25.1.0
argparse_dataclass 2.0.0
arrow 1.4.0
asttokens 3.0.1
async-lru 2.3.0
atlite 0.5.0
attrs 26.1.0
babel 2.18.0
backports.zstd 1.6.0
beautifulsoup4 4.15.0
bleach 6.4.0
bokeh 3.9.1
Bottleneck 1.6.0
branca 0.8.2
Brotli 1.2.0
brotlicffi 1.2.0.1
cached-property 1.5.2
Cartopy 0.25.0
cdsapi 0.7.7
certifi 2026.6.17
cffi 2.0.0
cfgrib 0.9.15.1
cfgv 3.5.0
cftime 1.6.5
chaospy 4.3.20
charset-normalizer 3.4.7
click 8.4.1
click-plugins 1.1.1.2
cligj 0.7.2
cloudpickle 3.1.2
colorama 0.4.6
colorcet 3.2.1
comm 0.2.3
ConfigArgParse 1.7.5
connection-pool 0.0.3
contextily 1.7.0
contourpy 1.3.3
country_converter 1.3.2
cryptography 49.0.0
CurrencyConverter 0.18.19
cycler 0.12.1
cytoolz 1.1.0
dask 2026.6.0
datashader 0.19.1
datrie 0.8.3
debugpy 1.8.21
decorator 5.3.1
defusedxml 0.7.1
deprecation 2.1.0
distlib 0.4.3
distributed 2026.6.0
docutils 0.23
dpath 2.2.0
earth_osm 3.0.2
eccodes 2.47.0
ecmwf-datastores-client 0.5.1
entsoe-py 0.8.0
et_xmlfile 2.0.0
exceptiongroup 1.3.1
executing 2.2.1
fake-useragent 2.2.0
fastjsonschema 2.21.2
filelock 3.29.4
findlibs 0.1.2
fiona 1.10.1
folium 0.20.0
fonttools 4.63.0
fqdn 1.5.1
frozenlist 1.8.0
fsspec 2026.6.0
future 1.0.0
geographiclib 2.1
geopandas 1.1.4
geopy 2.4.1
geoviews 1.15.1
gitdb 4.0.12
GitPython 3.1.50
google-api-core 2.31.0
google-auth 2.55.1
google-cloud-core 2.6.0
google-cloud-storage 3.12.0
google-crc32c 1.8.0
google-resumable-media 2.8.0
googleapis-common-protos 1.75.0
googledrivedownloader 1.1.0
grpcio 1.78.1
grpcio-status 1.78.1
gurobipy 13.0.2
h11 0.16.0
h2 4.3.0
h5netcdf 1.8.1
h5py 3.16.0
highspy 1.13.1
holoviews 1.23.0
hpack 4.2.0
httpcore 1.0.9
httpx 0.28.1
humanfriendly 10.0
hvplot 0.12.2
hyperframe 6.1.0
identify 2.6.19
idna 3.18
importlib_metadata 9.0.0
inflate64 1.0.4
iniconfig 2.3.0
ipykernel 7.3.0
ipython 9.15.0
ipython_pygments_lexers 1.1.1
isoduration 20.11.0
jedi 0.20.0
Jinja2 3.1.6
joblib 1.5.3
json5 0.15.0
jsonpointer 3.1.1
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
jupyter_builder 1.0.2
jupyter_client 8.9.1
jupyter_core 5.9.1
jupyter-events 0.12.1
jupyter-lsp 2.3.1
jupyter_server 2.20.0
jupyter_server_terminals 0.5.4
jupyterlab 4.6.1
jupyterlab_pygments 0.3.0
jupyterlab_server 2.28.0
kiwisolver 1.5.0
lark 1.3.1
linkify-it-py 2.1.0
linopy 0.5.8
llvmlite 0.47.0
locket 1.0.0
lxml 6.1.1
lz4 4.4.5
mapclassify 2.10.0
Markdown 3.10.2
markdown-it-py 4.2.0
MarkupSafe 3.0.3
matplotlib 3.11.0
matplotlib-inline 0.2.2
mdit-py-plugins 0.6.1
mdurl 0.1.2
memory_profiler 0.61.0
mercantile 1.2.1
mistune 3.3.2
msgpack 1.2.1
multidict 6.7.1
multipledispatch 0.6.0
multiurl 0.3.9
multivolumefile 0.2.3
munkres 1.1.4
narwhals 2.22.1
nbclient 0.11.0
nbconvert 7.17.1
nbformat 5.10.4
nest-asyncio2 1.7.2
netCDF4 1.7.4
networkx 3.6.1
nh3 0.3.6
nodeenv 1.10.0
notebook_shim 0.2.4
numba 0.65.1
numexpr 2.14.1
numpoly 1.2.14
numpy 1.26.4
openpyxl 3.1.5
overrides 7.7.0
packaging 26.2
pandas 2.3.3
pandocfilters 1.5.0
panel 1.9.3
panel-material-ui 0.11.2
param 2.4.1
parso 0.8.7
partd 1.4.2
patsy 1.0.2
pexpect 4.9.0
pillow 12.2.0
pip 26.1.2
platformdirs 4.10.0
plotly 6.6.0
pluggy 1.6.0
polars 1.42.0
polars-runtime-32 1.42.0
powerplantmatching 0.8.1
pre_commit 4.6.0
progressbar2 4.5.0
prometheus_client 0.25.0
prompt_toolkit 3.0.52
propcache 0.5.2
proto-plus 1.28.0
protobuf 6.33.5
psutil 7.2.2
ptyprocess 0.7.0
PuLP 2.7.0
pure_eval 0.2.3
py-cpuinfo 9.0.0
py7zr 1.1.3
pyarrow 24.0.0
pyasn1 0.6.3
pyasn1_modules 0.4.2
pybcj 1.0.7
pycountry 24.6.1
pycparser 3.0
pycryptodomex 3.23.0
pyct 0.6.0
pyDOE2 1.3.0
Pygments 2.20.0
pyobjc-core 12.2.1
pyobjc-framework-Cocoa 12.2.1
pyogrio 0.12.1
pyomo 6.10.0
pyOpenSSL 26.3.0
pyparsing 3.3.2
pyppmd 1.3.1
pyproj 3.7.2
pypsa 0.30.3
PySCIPOpt 6.2.1
pyshp 3.1.3
PySocks 1.7.1
pytest 9.1.1
python-dateutil 2.9.0.post0
python-discovery 1.4.2
python-json-logger 4.1.0
python-utils 3.9.1
pytz 2026.2
pyu2f 0.1.5
pyviz_comms 3.0.6
PyYAML 6.0.3
pyzmq 27.1.0
pyzstd 0.19.1
rasterio 1.4.4
referencing 0.37.0
requests 2.34.2
reretry 0.11.8
reverse-geocode 1.4.1
rfc3339_validator 0.1.4
rfc3986-validator 0.1.1
rfc3987-syntax 1.1.0
rich 15.0.0
rioxarray 0.19.0
rpds-py 2026.5.1
rsa 4.9.1
ruamel.yaml 0.17.26
ruamel.yaml.clib 0.2.15
scikit-learn 1.8.0
scipy 1.15.2
seaborn 0.13.2
Send2Trash 2.1.0
setuptools 81.0.0
shapely 2.1.2
six 1.17.0
smart_open 8.0.0
smmap 5.0.3
snakemake 7.32.4
sniffio 1.3.1
snuggs 1.4.7
sortedcontainers 2.4.0
soupsieve 2.8.4
stack_data 0.6.3
statsmodels 0.14.6
stopit 1.1.2
tables 3.11.1
tabulate 0.10.0
tblib 3.2.2
terminado 0.18.1
texttable 1.7.0
threadpoolctl 3.6.0
throttler 1.2.2
tinycss2 1.4.0
toml 0.10.2
tomli 2.4.1
toolz 1.1.0
toposort 1.10
tornado 6.5.7
tqdm 4.67.3
traitlets 5.15.1
tsam 0.0.0.dev0
typing_extensions 4.15.0
typing_utils 0.1.0
tzdata 2026.2
uc-micro-py 2.0.0
ukkonen 1.1.0
unicodedata2 17.0.1
Unidecode 1.4.0
uri-template 1.3.0
urllib3 2.7.0
validators 0.35.0
virtualenv 21.5.1
wcwidth 0.8.1
webcolors 25.10.0
webencodings 0.5.1
websocket-client 1.9.0
wheel 0.47.0
wrapt 2.2.2
xarray 2025.1.2
xlrd 2.0.2
xyzservices 2026.3.0
yarl 1.24.2
yte 1.9.4
zict 3.0.0
zipp 4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions