diff --git a/PySDM/environments/box.py b/PySDM/environments/box.py index 0281534d3..67b49731c 100644 --- a/PySDM/environments/box.py +++ b/PySDM/environments/box.py @@ -18,7 +18,10 @@ def __getitem__(self, item): return self._ambient_air[item] def __setitem__(self, key, value): - self._ambient_air[key] = self.particulator.backend.Storage.from_ndarray(np.array([value])) + if key not in self._ambient_air: + self._ambient_air[key] = self.particulator.backend.Storage.from_ndarray(np.array([value])) + else: + self._ambient_air[key][:] = value def register(self, builder): self.particulator = builder.particulator diff --git a/PySDM/initialisation/multiplicities.py b/PySDM/initialisation/multiplicities.py index 285abbc57..2aa1f7198 100644 --- a/PySDM/initialisation/multiplicities.py +++ b/PySDM/initialisation/multiplicities.py @@ -12,6 +12,6 @@ def discretise_n(y_float): raise Exception(f"{percent_diff}% error in total real-droplet number due to casting multiplicities to ints") if not (y_int > 0).all(): - raise Exception("int-casting resulted in multiplicity of zero") + raise Exception(f"int-casting resulted in multiplicity of zero (min(y_float)={min(y_float)})") return y_int diff --git a/PySDM/physics/formulae.py b/PySDM/physics/formulae.py index 205221499..013d02139 100644 --- a/PySDM/physics/formulae.py +++ b/PySDM/physics/formulae.py @@ -65,7 +65,7 @@ def _pick(value: str, choices: dict): for name, cls in choices.items(): if name == value: return cls() - raise ValueError(f"Unknown setting: '{value}';, choices are: {tuple(choices.keys())}") + raise ValueError(f"Unknown setting: '{value}'; choices are: {tuple(choices.keys())}") def _choices(module): @@ -93,7 +93,7 @@ def __init__(self, *, state_variable_triplet: str = 'RhodThdQv', particle_advection: str = 'ImplicitInSpace', hydrostatics: str = 'Default', - freezing_temperature_spectrum: str = 'Niemand_et_al_2012', + freezing_temperature_spectrum: str = 'Null', heterogeneous_ice_nucleation_rate: str = 'Null' ): self.seed = seed diff --git a/PySDM/physics/freezing_temperature_spectrum/null.py b/PySDM/physics/freezing_temperature_spectrum/null.py new file mode 100644 index 000000000..11f7752f0 --- /dev/null +++ b/PySDM/physics/freezing_temperature_spectrum/null.py @@ -0,0 +1,2 @@ +class Null: + pass diff --git a/PySDM/products/product.py b/PySDM/products/product.py index dfaa5425e..2eb415101 100644 --- a/PySDM/products/product.py +++ b/PySDM/products/product.py @@ -79,14 +79,14 @@ def __init__(self, **args): self.source = None def register(self, builder): - assert isinstance(builder.particulator.env, _Moist) super().register(builder) self.particulator.observers.append(self) self.environment = builder.particulator.env self.source = self.environment[self._name] def notify(self): - self.source = self.environment.get_predicted(self._name) + if isinstance(self.environment, _Moist): + self.source = self.environment.get_predicted(self._name) def get(self): self.download_to_buffer(self.source) diff --git a/PySDM/state/particles.py b/PySDM/state/particles.py index 2c158ef6d..d19a6df54 100644 --- a/PySDM/state/particles.py +++ b/PySDM/state/particles.py @@ -76,6 +76,9 @@ def keys(self): def __getitem__(self, item): return self.attributes[item].get() + def __contains__(self, key): + return key in self.attributes + def permutation(self, u01, local): if local: """ diff --git a/README.md b/README.md index 3eaf97a14..473924fb4 100644 --- a/README.md +++ b/README.md @@ -602,7 +602,8 @@ the license of the contributed code must be compatible with GPL v3. Developing the code, we follow [The Way of Python](https://www.python.org/dev/peps/pep-0020/) and the [KISS principle](https://en.wikipedia.org/wiki/KISS_principle). -The codebase has greatly benefited from [PyCharm code inspections](https://www.jetbrains.com/help/pycharm/code-inspection.html). +The codebase has greatly benefited from [PyCharm code inspections](https://www.jetbrains.com/help/pycharm/code-inspection.html) +and [Pylint](https://pylint.org) code analysis (which constitutes one of the CI workflows). Issues regarding any incorrect, unintuitive or undocumented bahaviour of PySDM are best to be reported on the [GitHub issue tracker](https://github.com/atmos-cloud-sim-uj/PySDM/issues/new). @@ -616,10 +617,24 @@ We look forward to your contributions and feedback. ## Credits: -Development of PySDM is supported by the EU through a grant of the Foundation for Polish Science (POIR.04.04.00-00-5E1C/18). - -copyright: Jagiellonian University -licence: GPL v3 +The development and maintenance of PySDM is led by [Sylwester Arabas](https://github.com/slayoo/). +[Piotr Bartman](https://github.com/piotrbartman/) had been the architect and main developer +of technological solutions in PySDM. +The suite of examples shipped with PySDM includes contributions from researchers +from [Jagiellonian University](https://en.uj.edu.pl/en) departments of computer science, physics and chemistry; +and from +[Caltech's Climate Modelling Alliance](https://clima.caltech.edu/). + +Development of PySDM had been initially supported by the EU through a grant of the +[Foundation for Polish Science](https://www.fnp.org.pl/)) (POIR.04.04.00-00-5E1C/18) +realised at the [Jagiellonian University](https://en.uj.edu.pl/en). +The immersion freezing support in PySDM is developed with support from the +US Department of Energy [Atmospheric System Research](https://asr.science.energy.gov/) programme +through a grant realised at the +[University of Illinois at Urbana-Champaign](https://illinois.edu/). + +copyright: [Jagiellonian University](https://en.uj.edu.pl/en) +licence: [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html) ## Related resources and open-source projects