Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow xarray > 2023.2 #542

Open
Lukas113 opened this issue Feb 14, 2024 · 1 comment
Open

allow xarray > 2023.2 #542

Lukas113 opened this issue Feb 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@Lukas113
Copy link
Collaborator

For the imaging part of Karabo while running source_detection.ipynb, I've encountered the following error with xarray 2023.11 (see traceback). When I downgraded xarray to 2023.2 (release before blame commit to raise ValueError), there was no such error and everything worked fine. Because this error is caused through RASCIL and ska_sdp_func_python (see traceback), I think fixing this error is out of my control. If my assessment is correct, when should fix it as follows:

First, just constrain xarray to be <= 2023.2. However, this also constrains pandas to be < 2 (conda-resolver said so). And because these two libraries are widely used libraries, we should address this issue further. However, this might require some effort. Firstly, because RASCIL hasn't contrained ska_sdp_func_python & ska_sdp_func versions, I'm concerned that the latest release of RASCIL 1.1.0 (April 2023) might not be compatible with the (hopefully fixed) major release of ska-sdp-func 1.0 (November 2023). In addition, we also need to build the according conda-wheels after testing.

Long story short: As a hotfix, I'll constrain xarray <= 2023.2 (and accept the pandas downgrade for the moment). The best-case scenario would be that RASCIL soon does a new release, where we could fix the according ska-sdp deps. I don't think that building a dirty conda-wheel (10 months after the last release) of RASCIL is a good solution. If there's a better suggestion, I'd like to hear it.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[14], line 6
      2 imager_askap.ingest_vis_nchan = 16
      4 # Try differnet algorithm
      5 # More sources
----> 6 deconvolved, restored, residual = imager_askap.imaging_rascil(
      7     clean_nmajor=1,
      8     clean_algorithm="mmclean",
      9     clean_scales=[10, 30, 60],
     10     clean_fractional_threshold=0.3,
     11     clean_threshold=0.12e-3,
     12     clean_nmoment=5,
     13     clean_psf_support=640,
     14     clean_restored_output="integrated",
     15     use_dask=True,
     16 )

File ~/i4ds/ska/Karabo-Pipeline/karabo/imaging/imager.py:432, in Imager.imaging_rascil(self, deconvolved_fits_path, restored_fits_path, residual_fits_path, client, use_dask, n_threads, use_cuda, img_context, clean_algorithm, clean_beam, clean_scales, clean_nmoment, clean_nmajor, clean_niter, clean_psf_support, clean_gain, clean_threshold, clean_component_threshold, clean_component_method, clean_fractional_threshold, clean_facets, clean_overlap, clean_taper, clean_restore_facets, clean_restore_overlap, clean_restore_taper, clean_restored_output)
    388 models = [
    389     rsexecute.execute(create_image_from_visibility)(
    390         bvis,
   (...)
    397     for bvis in blockviss
    398 ]
    400 result = continuum_imaging_skymodel_list_rsexecute_workflow(
    401     vis_list=blockviss,
    402     model_imagelist=models,
   (...)
    429     imaging_uvmin=self.imaging_uvmin,
    430 )
--> 432 result = rsexecute.compute(result, sync=True)
    434 residual, restored, skymodel = result
    436 deconvolved = [sm.image for sm in skymodel]

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/rascil/workflows/rsexecute/execution_support/rsexecute.py:311, in _rsexecutebase.compute(self, value, sync)
    309 except:
    310     pass
--> 311 future = self.client.compute(value, sync=sync)
    312 wait(future)
    313 if self._verbose:

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/distributed/client.py:3495, in Client.compute(self, collections, sync, optimize_graph, workers, allow_other_workers, resources, retries, priority, fifo_timeout, actors, traverse, **kwargs)
   3492         futures.append(arg)
   3494 if sync:
-> 3495     result = self.gather(futures)
   3496 else:
   3497     result = futures

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/distributed/client.py:2383, in Client.gather(self, futures, errors, direct, asynchronous)
   2380     local_worker = None
   2382 with shorten_traceback():
-> 2383     return self.sync(
   2384         self._gather,
   2385         futures,
   2386         errors=errors,
   2387         direct=direct,
   2388         local_worker=local_worker,
   2389         asynchronous=asynchronous,
   2390     )

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/rascil/workflows/rsexecute/skymodel/skymodel_rsexecute.py:113, in skymodel_restore()
    112 def skymodel_restore(s, res, cb):
--> 113     res_image = restore_cube(s.image, residual=res, clean_beam=cb)
    114     return restore_skycomponent(res_image, s.components, cb)

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/ska_sdp_func_python/image/deconvolution.py:1179, in restore_cube()
   1163 def restore_cube(
   1164     model: Image, psf=None, residual=None, clean_beam=None
   1165 ) -> Image:
   1166     """Restore the model image to the residuals.
   1167 
   1168     The clean beam can be specified as a dictionary with
   (...)
   1177 
   1178     """
-> 1179     model_list = image_scatter_channels(model)
   1180     residual_list = image_scatter_channels(residual)
   1181     psf_list = image_scatter_channels(psf)

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/ska_sdp_func_python/image/gather_scatter.py:184, in image_scatter_channels()
    179 if im is None:
    180     return None
    182 return [
    183     r[1]
--> 184     for r in im.groupby_bins("frequency", bins=subimages, squeeze=False)
    185 ]

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/xarray/core/dataset.py:10279, in groupby_bins()
  10271 from xarray.core.groupby import (
  10272     BinGrouper,
  10273     DatasetGroupBy,
  10274     ResolvedBinGrouper,
  10275     _validate_groupby_squeeze,
  10276 )
  10278 _validate_groupby_squeeze(squeeze)
> 10279 grouper = BinGrouper(
  10280     bins=bins,
  10281     cut_kwargs={
  10282         "right": right,
  10283         "labels": labels,
  10284         "precision": precision,
  10285         "include_lowest": include_lowest,
  10286     },
  10287 )
  10288 rgrouper = ResolvedBinGrouper(grouper, group, self)
  10290 return DatasetGroupBy(
  10291     self,
  10292     (rgrouper,),
  10293     squeeze=squeeze,
  10294     restore_coord_dims=restore_coord_dims,
  10295 )

File <string>:5, in __init__()

File ~/miniconda3/envs/karabo_dev_env/lib/python3.9/site-packages/xarray/core/groupby.py:602, in __post_init__()
    600 def __post_init__(self) -> None:
    601     if duck_array_ops.isnull(self.bins).all():
--> 602         raise ValueError("All bin edges are NaN.")

ValueError: All bin edges are NaN.
@Lukas113 Lukas113 added bug Something isn't working enhancement New feature or request labels Feb 14, 2024
@Lukas113 Lukas113 self-assigned this Feb 14, 2024
@Lukas113 Lukas113 mentioned this issue Feb 14, 2024
@Lukas113
Copy link
Collaborator Author

Lukas113 commented Feb 16, 2024

A minor update: I set the xarray-constraint on the Feedstock because it's an issue from ska-sdp-func-python and not Karabo. In addition, I removed the build-nr fixings to enable constaint-updates. Otherwise, each legacy karabo installation would be corrupt if a feedstock-wheel needs an update.

The hotfix is finished, as soon as there is an updated build of ska-sdp-func-python available with a larger build-nr. However, I'll try to create a reproducible test-case to catch this error.

Lukas113 added a commit that referenced this issue Feb 26, 2024
* added sarus doc 🍔

* enhanced doc 🎏

* added conda-prefix in dockerfile to have correct set env-var in sarus container 👨

* bugfix gpu-testing 📒

* skip pinocchio-test because it seems not to work properly on each platform 😖

* integrated user-build testing in workflow 8️⃣

* updated dockerfile-dev 🎅

* removed test-user-package because testing is now happening before pushing the image 👠

* adapted docker-dev 🍹

* Revert "removed test-user-package because testing is now happening before pushing the image 👠"

This reverts commit a828dfd.

* updated dockerfile-dev 🔌

* changed dev-workflow for testing 💀

* removed workflow-run trigger of dev-image because out of memory 🚈

* added mpich std-loc in Dockerfile.user 🍞

* adapted docker-user ⛎

* minor bugfix dockerfile-user 📥

* updated environments-files 🎇

* updated mpi-version in dockerfile 🆎

* updated Dockerfile-user structure 👾

* added mpi-tests to karabo 🌱

* updated requirements.txt with new versions 🎼

* integrated mpi-tests into github workflow and codecov-report 🆖

* minor fix using pytest-cov instead of coverage in github workflow 🌊

* fixed coverage-files discovery (I think) 🏧

* adapted codecov workflow according to github.com/codecov/codecov-action 🎲

* adapted container-doc 🍗

* bugfix Dockerfile mpi-compilation needs python 🍚

* minor adjustments in Dockerfile.user 😉

* added mpi-supported h5py wheel as karabo dependency 🍟

* removed pinocchio from environment.yaml 🔘

* updated environment.yaml with mpich-deps 🈴

* updated conda-build files 🚟

* replaced np.object0 with according non-deprecated alias 🐳

* minor bugfix in pyproject.toml 🙇

* deleted test-pinocchio (wrongly merged) 🍭

* updated environment files 🐎

* imporved dev-setup 🔉

* removed requirements.txt :godmode:

* added ipykernel to dev-deps 🚙

* bugfix filter-sources for xarray>2023.2 🔦

* updated build-procedure ⛪

* implemented dynamic versioneering 😔

* removed remaining requirements.txt stuff 👜

* updated Dockerfile-user mpi-installation to be dependent on karabo-user installation version 🛀

* refactored dockerfiles 🐭

* added versioneer to meta.yaml build-stage 📚

* added versioneer to meta.yaml build-stage 🚕

* bugfix conda-build meta.yaml for versioneer 💩

* adapted conda-build to custom pkg-version 😤

* adapted Dockerfile.user to a testable (before release) setup 👸

* bugfix build-user-image.yml ➿

* bugfix build-user-image.yml 🚧

* updated Dockerfile-user 👏

* bugfix user-dockerfile 🕘

* bugfix Dockerfile-dev 🔖

* minor doc-update in dockerfile-dev 🚸

* updated description of build-user-image workflow inputs 🔫

* introduced venv in dockerfile-user to not f*** up base env 😌

* updated dev-img with venv 😓

* updated build-user-image workflow to be able to run on workflow-dispatch 🐬

* added file to build-and-export-docker action 📌

* bugfix build-args in build-user-image workflow 👨

* bugfix get-shallow git-repo from git-rev (not only branches or tags) 📷

* bugfix remote from https and not from ssh 🎮

* updated workflow-dispatch descriptions ‼️

* bugfix build-args passing to docker-build-push action 🆘

* throw exit-code in dockerfile-user if build not set correctly 🎵

* added dev-flag to conda-build 🌹

* added security to dev-builds in conda-build workflow 🛄

* bugfix dev-evaluation in conda-build.yml 🈂️

* outcommented mpich-compilation in Dockerfile 😥

* bugfix conda-build export of env-vars in same step ⛺

* added failing tests if PR is draft 🆖

* setup build-user-img, conda-build & test-user-package for dev-testing 🔍

* added df-h to build-user-image workflow 🎃

* made docker-build by myself ✂️

* made docker-build by myself entirely 🚥

* ensured to push on ghcr.io ✈️

* bugfix docker-push user-image workflow 💘

* bugfix docker-push user-image workflow 📢

* bugfix added img-name to push image 🚸

* bugfix registry docker push 🍎

* adapted docker-img address accordingly to ghcr.io 🎩

* adapted build-user-image to standard 🐗

* added pytest installation to docker-user image testing workflow 🎢

* bugfix pytest-call in user-image 💴

* added bash shell in docker-run in build-test-user-image 👥

* adapted ld-library-path to base-image 2️⃣

* made site-package-location identification in build-user-image more robust 📵

* defined entrypoint to Dockerfile-user ➡️

* bugfix calling tests in build-user-image 🐻

* readded conda-activate-karabo to .bashrc for interactive mode 💓

* bugfix removed unnecessary " at the end of docker-run 🚅

* set env-vars in test-user-image ♓

* minor changes 🎵

* adapted test-workflow to main-setup 💡

* adapted docker-img dev to karabo-venv 📄

* adapted mpi-doc ❇️

* addressed mypy-issues 6️⃣

* added type-ignore to __init__.py because mypy can't handle that 🍥

* adapted exclude-option in setup.cfg to hopefully ignore __init__.py on the runners 🐽

* adapted mypy-exclude-regex to exclude all __init__.py ⏰

* hopefully bugfix to ignore __init__.py by mypy 🍟

* trying editable install to avoid duplicate modules 😓

* added verbose-flag to pytest-testing of docker-image 📫

* removed pytest-mpi as dep and added --only-mpi flag handling in conftest.py 👪

* minor changes in pytest test-discovery 🎁

* removed mpi-pytest from codecov because of race-condition issue which doesn't seem to be solvable atm 👬

* bugfix compute filter-mask in filter-sky 👫

* ugly hotfix to initialize dask-mpi inside docker-container 🏯

* added mpi-tests to docker-user tests 💀

* bugfix only enter dask-initialize with mpi if mpirun 🐚

* bugfix conda-build inherited env-vars [skip ci] 👚

* bugfix conda-build inherited env-vars [skip ci] 🚑

* bugfix conda-build set output-vars [skip ci] 🌈

* removed notebook-test from user-img test because data-dirs are not part of package and therefore would cause an error [skip ci] 🕠

* bugfix casting to str-to-boolean for reproducable github-workflows 🔩

* added debugging logs to github workflows [skip ci] ☎️

* adapted meta.yaml to pin compatible numpy ❓

* updated conda-build to be closer to a best-practise build 😿

* fixed bluebild-version 🌅

* removed echos and improved build-user-image workflow 🔻

* removed build-string default to ensure that workflow-user knows what he/she does 🐟

* minor update in container.md ⏩

* bugfix check leading v in tag in conda-build workflow 🍙

* bugfix set dev-string check correclty in conda-build.yml 🚷

* added versioneer to dev-dep ⚪

* improved version definition security for conda-build workflows ♒

* minor imporvements in conda-build ⤵️

* hopefully bugfix of github boolean passing in reusable workflow see #1483 of github runners 🎈

* improved version definition security for conda-build workflows ↪️

* added little verbosity to conda-build workflow 📍

* hopefully bugfix to trigger build-docker by taking boolean values directly from input 👂

* bugfix build-user-image.yml 🛅

* minor improvements in build-user-image.yml 🎫

* replaced exit 2 with exit 1 in all bash scripts 3️⃣

* bugfix install environment in user Dockerfile correctly 💙

* removed weird leading v to github-workflows version-args 🍚

* updated codecov.yml to not fail if below target 🎰

* bugfix: added python interpreter and versioneer through conda for checking conda-build worklow inputs 🇷🇺

* added conda-prefix to python interpreter to hopefully get viable binary Ⓜ️

* added conda-prefix to python interpreter to hopefully get viable binary :bowtie:

* removed dev-deps in environment.yaml and meta.yaml ⌛

* bugfix: removed bdsf dev-dep 💒

* addressed mypy-issues 🚝

* updated mypy-complaints chunks-dict issue in sky-model 🚞

* fixed build-nr of feedstock-deps 🐹

* addresses mypy attr-defined for matplotlib BLUE 😾

* renamed build-user-image do build-docker-image 🐚

* adapted readme-badges 🍰

* addressed pr-request to install mpich via apt 🐒

* adapted documentation and dockerfile-steps 🍶

* bugfix added -y to apt install in Dockerfile [skip ci] ↩️

* improved docs ♈

* changed Dockerfile setup to use andromeda user instead of root 😉

* minor update in dockerfile 🔛

* changed run-stages of dockerfile 🍲

* removed user-changeing because of singularity uid issues 🔫

* moved Dockerfile to root & removed docker-dir 🚌

* added bash-env to env-vars for singularity noninteractive-shell [skip ci] 🕣

* bugfix: correctly activate venv in docker & singularity container for interactive and non-interactive shells 💛

* fixed conda activate functionality for docker & singularity interactive and non-interactive shells 💉

* removed unnecessary sourcing in dockerfile [skip ci] 🔣

* added ldconfig after mpich-installation in dockerfile 👤

* minor changes in dockerfile [skip ci] 🐟

* outcommented mpi-hook from dockerfile because it's still error-prone 📢

* adapted container-doc ↩️

* bugfix: in test docker-image to enable --only-mpi custom flag for pytest 📓

* added karabo shared lib to ldconfig cache to enable native cscs-mpi-hook 🕡

* replaced weird file-handler root-dir setup with /tmp with honor of TMP, TMPDIR & TEMP 🌐

* changed tmp-dir-name setup to avoid collisions 🐂

* loosened mpich-version constraints because we no longer rely on apt to install mpich ◻️

* updated mpi-doc 😡

* minor bugfix for mpi-tests in ci :hurtrealbad:

* added scratch as a possible tmpdir in FileHandler ⏰

* bugfix get-tmp-dir 🐲

* added cachetools as dep 😇

* redesigned FileHandler for short- and long-term-memory caching 😡

* improved file-handler by getting unique tmp-dir per unique object 💥

* refactored image and imager to new filehandler-setup 😔

* adapted interferometer.py and telescope.py to new FileHandler setup ↪️

* adapted visibility and sourcedetection to new FileHandler setup 🙌

* enhanced FileHandler get-tmp-dir with subdir & mkdir option 🚘

* adapted Karabo to new FileHandler setup 🐍

* bugfix accessing .ltm and .stm through FileHandler 👅

* bugfixes FileHandler & according tests 📝

* changed Downloadobject-storage cache from site-packages to tmp 🌁

* removed weird KaraboResource pseudo-interface from repo ♥️

* removed FileHandler get-tmp-dir subdir option because seems unnecessary ⛽

* implemented seed-option to FileHandler.get-tmp-dir 🍢

* changed ltm & stm of FileHandler from static functions to lazy class-attributes 📄

* intermediate commit separating Dask & Slurm concerns in dask.py 🕔

* adapted other karabo-files to new DaskHandler setup 🚨

* readded accidentally removed plotting-util.py 👡

* bugfix dask-usage 🍀

* minor bugfix in test-dask 🚬

* refactored create_baseline_cut_telelescope to improved disk-caching & be less error-prone 😷

* bugfixes in Telescope.create-baseline-cut-telescope 🔑

* addressed mypy-issues 😐

* updated singularity-doc 🍓

* addressed PR-requests 🎍

* addressed PR526 requests 🍀

* bugfix removed set libmamba-solver globally in installation-user.md 📦

* made plot-function api more consistent 😰

* refactored DaskHandler to use just a single DaskHandler class for function-calling purpose 🎼

* bugfix removed fetch-dask-handler function from karabo 🎁

* addressed PR540 requests 🐻

* bugfix seeding ltm-memory 🎵

* improved api-signatures & bugfix in imager and result 🆖

* constrained xarray <=2023.2 (see issue #542) 💒

* bugfix cls to classmethod 🐐

* bugfix kwargs quiet passing in detect-sources-in-images 🌱

* removed guess-beam-parameters from result.py because it doesn't work anymore 🌀

* removed fixing of build-nr to enable dependency-constraint updates for past releases 💉

* reverted xarray-constraint because it's an issue of ska-sdp-func-python and not of Karabo ⚠️

* added imaging-rascil test to test-image 💯

* enhanced environment.yaml description 🈴

* added guess-beam-parameters again after removal with improvements ♐

* relocated and enhanced guess-beam-parameters and it's usage 📔
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant