anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: twosixlabs/armory
Issue: Error when running CARLA with --skip-attack

This issue occurs because the CARLA scenario code instantiates another `MetricsLogger` instance [here](https://github.com/twosixlabs/armory/blob/develop/armory/scenarios/carla_object_detection.py#L110). The variable `self.skip_attack` is not propagated to this instantiation, so when the instantiation occurs, `skip_attack` is set to the default `None`. Consequentially, in `metrics.py`, a list of adversarial tasks is generated [here](https://github.com/twosixlabs/armory/blob/develop/armory/utils/metrics.py#L1805) when it shouldn't be (assuming `--skip-attack` is in fact set). This causes the following error in `finalize_results()`:

```
File "/workspace/armory/utils/metrics.py", line 622, in _check_object_detection_input                                                 
    raise ValueError("Received no labels or predictions")   
```

To reproduce, run one of the CARLA configs with `--skip-attack --num-eval-batches 1` set. 

Changed files:
armory/scenarios/carla_object_detection.py

diff --git a/armory/scenarios/carla_object_detection.py b/armory/scenarios/carla_object_detection.py
index 78461c95..6983240f 100644
--- a/armory/scenarios/carla_object_detection.py
+++ b/armory/scenarios/carla_object_detection.py
@@ -108,5 +108,8 @@ class CarlaObjectDetectionTask(Scenario):
             if k in metric_config
         }
         self.metrics_logger_wrt_benign_preds = metrics.MetricsLogger.from_config(
-            subset_config, skip_benign=True, targeted=False
+            subset_config,
+            skip_benign=True,
+            targeted=False,
+            skip_attack=self.skip_attack,
         )
Repository: twosixlabs/armory
Issue: armory --version doesn't just output version

```
(armory) √ david.slater@mac0909:~/armory% ARMORY=$(armory --version)
(armory) √ david.slater@mac0909:~/armory% echo $ARMORY
2022-04-25 09:39:37  8s INFO     art.config:set_data_path:55 set ART_DATA_PATH to /Users/david.slater/.art/data
0.14.7.g517058ab
```

Relatedly, getting the armory version takes 8 seconds.

This is due to `armory/__init__.py`. There are a lot of imports there, including PyTorch, TensorFlow, and ART. It also sets the art path automatically. The init block seems to be the best place to enable all of this, but shouldn't need to happen if just getting the version.

Changed files:
armory/__init__.py

diff --git a/armory/__init__.py b/armory/__init__.py
index a8109e0f..e27cb276 100644
--- a/armory/__init__.py
+++ b/armory/__init__.py
@@ -20,6 +20,7 @@ except ModuleNotFoundError:
 
 import pathlib
 import re
+import sys
 import subprocess
 
 from armory.logs import log
@@ -61,6 +62,15 @@ if __version__ is None:
 __version__ = re.sub(r"dev\\d+\\+(g[0-9a-f]+)(\\.d\\d+)?$", r"\\1", __version__)
 
 
+# If just querying version, stop and exit
+if (
+    len(sys.argv) == 2
+    and (sys.argv[0] == "-m" or pathlib.Path(sys.argv[0]).stem == "armory")
+    and sys.argv[1] in ("-v", "--version", "version")
+):
+    print(f"{__version__}")
+    sys.exit(0)
+
 # Handle PyTorch / TensorFlow interplay
 
 # import torch before tensorflow to ensure torch.utils.data.DataLoader can utilize
Repository: twosixlabs/armory
Issue: Error running so2sat configs

Note that this applies to any/all so2sat configs:

```
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/conda/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/workspace/armory/scenarios/main.py", line 225, in <module>
run_config(
File "/workspace/armory/scenarios/main.py", line 142, in run_config
scenario = get(*args, **kwargs)
File "/workspace/armory/scenarios/main.py", line 134, in get
scenario = ScenarioClass(config, **kwargs)
File "/workspace/armory/scenarios/multimodal_so2sat_scenario.py", line 24, in __init__
self.perturbation_metrics = self.config["metrics"].pop("perturbation")
AttributeError: 'So2SatClassification' object has no attribute 'config'
```

To reproduce:

```
python -m armory run scenario_configs/eval1-4/so2sat/<CONFIG>
```

Changed files:
armory/scenarios/multimodal_so2sat_scenario.py

diff --git a/armory/scenarios/multimodal_so2sat_scenario.py b/armory/scenarios/multimodal_so2sat_scenario.py
index bb9f9c3b..236941ec 100644
--- a/armory/scenarios/multimodal_so2sat_scenario.py
+++ b/armory/scenarios/multimodal_so2sat_scenario.py
@@ -21,12 +21,13 @@ class So2SatClassification(Scenario):
                 f"Multimodal scenario requires attack_modality parameter in {'SAR', 'EO', 'Both'}"
             )
         self.attack_modality = attack_modality
-        self.perturbation_metrics = self.config["metrics"].pop("perturbation")
-        self.config["metrics"]["perturbation"] = None
+
+        super().__init__(*args, **kwargs)
+        self.perturbation_metrics = self.config["metric"].pop("perturbation")
+        self.config["metric"]["perturbation"] = None
         if self.perturbation_metrics is not None:
             if isinstance(self.perturbation_metrics, str):
                 self.perturbation_metrics = [self.perturbation_metrics]
-        super().__init__(*args, **kwargs)
 
     def load_attack(self):
         attack_config = self.config["attack"]
@@ -86,7 +87,7 @@ class So2SatClassification(Scenario):
             modes = [self.attack_modality]
 
         # Generate metrics for perturbation on eo and sar
-        if self.config["metrics"].get("means"):
+        if self.config["metric"].get("means"):
             final = np.mean
         else:
             final = None
@@ -96,10 +97,13 @@ class So2SatClassification(Scenario):
                 m = Meter(
                     f"{mode}_perturbation_{name}",
                     metric,
-                    "scenario.x_{mode}",
-                    "scenario.x_adv_{mode}",
+                    f"scenario.x_{mode}",
+                    f"scenario.x_adv_{mode}",
                     final=final,
                     final_name=f"{mode}_perturbation_mean_{name}",
+                    record_final_only=not bool(
+                        self.config["metric"].get("record_metric_per_sample")
+                    ),
                 )
                 self.hub.connect_meter(m)
Repository: twosixlabs/armory
Issue: [BUG]: Poisoning activation defence gives error while extracting outputs of activation layers

### Description of the bug

This could be because the Resnet50 version of tensorflow from https://github.com/keras-team/keras/blob/b80dd12da9c0bc3f569eca3455e77762cf2ee8ef/keras/applications/resnet.py#L76 is not declared as tf.keras.models.sequential whereas the get_activations in https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/art/estimators/classification/tensorflow.py requires the model to be tf.keras.models.Sequential.

`ValueError: Method get_activations is not supported for non-Sequential models.`

Is there any quick fix?

### Steps To Reproduce

```
cd scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses
armory run audio_p10_activation_defense.json --no-docker --use-gpu
```

### Additional Information

_No response_

Changed files:
armory/baseline_models/tf_graph/audio_resnet50.py

diff --git a/armory/baseline_models/tf_graph/audio_resnet50.py b/armory/baseline_models/tf_graph/audio_resnet50.py
index 497e02dc..3d154e0f 100644
--- a/armory/baseline_models/tf_graph/audio_resnet50.py
+++ b/armory/baseline_models/tf_graph/audio_resnet50.py
@@ -33,6 +33,8 @@ def make_audio_resnet(**kwargs) -> tf.keras.Model:
     )
 
     model = keras.Model(resnet.inputs, resnet.outputs)
+    # ART's TensorFlowV2Classifier get_activations() requires a Sequential model
+    model = keras.Sequential([model])
     model.compile(
         optimizer=tf.keras.optimizers.Adam(),
         loss=tf.keras.losses.SparseCategoricalCrossentropy(),
Repository: twosixlabs/armory
Issue: [BUG]: MOT exporting should not adjust dataset timesteps

### Description of the bug

Given that a[ preprocessing function ](https://github.com/twosixlabs/armory/blob/f529d887e95725bb730c11c5810a68dbe117cc11/armory/data/adversarial_datasets.py#L1019)was added to the MOT dataset loader to 0-index the timesteps, the exporting code no longer needs to [adjust](https://github.com/twosixlabs/armory/blob/f529d887e95725bb730c11c5810a68dbe117cc11/armory/instrument/export.py#L331-L336) for 1-indexed timesteps.

### Steps To Reproduce

Run any MOT config (that doesn't use coco format data) with "export_batches":true; you should see a key error because the timestep indices are off by one

### Additional Information

_No response_

Changed files:
armory/instrument/export.py

diff --git a/armory/instrument/export.py b/armory/instrument/export.py
index f5f131ae..44172572 100644
--- a/armory/instrument/export.py
+++ b/armory/instrument/export.py
@@ -327,13 +327,11 @@ class VideoTrackingExporter(VideoClassificationExporter):
 
         if y.ndim == 1:
             y = np.expand_dims(y, 0)
-        y_dict = {
-            int(timestep - 1): [] for timestep in set(y[:, 0])
-        }  # 0-index timesteps
+        y_dict = {int(timestep): [] for timestep in set(y[:, 0])}
 
         for pred in y:
             # TODO filter out boxes with low confidence?
-            timestep = int(pred[0] - 1)
+            timestep = int(pred[0])
             x0, y0 = pred[2], pred[3]
             x1, y1 = pred[2] + pred[4], pred[3] + pred[5]
             y_dict[timestep].append([x0, y0, x1, y1])
Repository: twosixlabs/armory
Issue: Results JSON doesn't copy all of the config from the input JSON

I observed this with certain fields in `wrapper_kwargs` being omitted. My guess is that these configs are modified in place by the consuming model. To fix this, we should make a defensive copy of the submitted config and drop that into the results json.

Changed files:
armory/scenarios/scenario.py

diff --git a/armory/scenarios/scenario.py b/armory/scenarios/scenario.py
index fc6a6278..c27e8ce1 100644
--- a/armory/scenarios/scenario.py
+++ b/armory/scenarios/scenario.py
@@ -67,6 +67,9 @@ class Scenario:
         self._check_config_and_cli_args(
             config, num_eval_batches, skip_benign, skip_attack, skip_misclassified
         )
+        self.original_config = copy.deepcopy(
+            config
+        )  # Save original for output json, since some scenarios/models modify it
         self.config = config
         self.num_eval_batches = num_eval_batches
         self.skip_benign = bool(skip_benign)
@@ -466,7 +469,7 @@ class Scenario:
 
         output = {
             "armory_version": armory.__version__,
-            "config": self.config,
+            "config": self.original_config,
             "results": self.results,
             "timestamp": int(self.time_stamp),
         }
Repository: twosixlabs/armory
Issue: [BUG]: np has no attribute bool

### Description of the bug

armory/scenarios/poison.py", line 312, in filter_dataset:

```self.removed = (1 - self.indices_to_keep).astype(np.bool) ```

Throws:

```
AttributeError: module 'numpy' has no attribute 'bool'.                                                 
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy s
calar type, use `np.bool_` here.                    
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations 
```

### Steps To Reproduce

Run a poison config with latest docker

### Additional Information

Related to #1971

Changed files:
armory/scenarios/poison.py

diff --git a/armory/scenarios/poison.py b/armory/scenarios/poison.py
index ab248ee2..142aa466 100644
--- a/armory/scenarios/poison.py
+++ b/armory/scenarios/poison.py
@@ -309,7 +309,7 @@ class Poison(Scenario):
         self.x_train = self.x_poison[indices_to_keep]
         self.y_train = self.y_poison[indices_to_keep]
         self.indices_to_keep = indices_to_keep
-        self.removed = (1 - self.indices_to_keep).astype(np.bool)
+        self.removed = (1 - self.indices_to_keep).astype(np.bool_)
         self.probe.update(
             removed=self.removed, predicted_dirty_mask=~self.indices_to_keep
         )
Repository: neurostuff/nimare
Issue: Sometimes p-values are not clipped correctly with montecarlo simulations

In the function `null_to_p`, sometimes this line:
https://github.com/neurostuff/NiMARE/blob/db6347569309d580fcd51e044da764bb9b1286ea/nimare/stats.py#L144

can evaluate to a percentile that is less than the lower bound of p-values, (e.g., if the null array is 100 items making the minimum p-value 0.01 and if there are repeat values in the null_array like (1, 1, 1, 2, ..., 5, 5, 6), the percentile can be under 0.01 without being zero, which becomes a problem in this line:
https://github.com/neurostuff/NiMARE/blob/db6347569309d580fcd51e044da764bb9b1286ea/nimare/stats.py#L151-L152

resulting in some instances where the returned p-value is outside the expected range (0.01 - 0.99).

I'll submit a fix.

Changed files:
nimare/tests/test_stats.py, nimare/stats.py

diff --git a/nimare/stats.py b/nimare/stats.py
index 45c87e3..f28a296 100755
--- a/nimare/stats.py
+++ b/nimare/stats.py
@@ -148,10 +148,10 @@ def null_to_p(test_value, null_array, tail="two"):
         raise ValueError('Argument "tail" must be one of ["two", "upper", ' '"lower"]')
 
     smallest_value = np.maximum(np.finfo(float).eps, 1.0 / len(null_array))
-    if p_value == 0:
-        p_value = smallest_value
-    elif p_value == 1:
-        p_value = 1.0 - smallest_value
+
+    # ensure p_value in the following range:
+    # smallest_value <= p_value <= (1.0 - smallest_value)
+    p_value = max(smallest_value, min(p_value, 1.0 - smallest_value))
 
     return p_value
 
diff --git a/nimare/tests/test_stats.py b/nimare/tests/test_stats.py
index 54d34e0..249ab0e 100644
--- a/nimare/tests/test_stats.py
+++ b/nimare/tests/test_stats.py
@@ -25,3 +25,11 @@ def test_null_to_p():
     assert math.isclose(stats.null_to_p(101, data, "lower"), 0.99)
     assert math.isclose(stats.null_to_p(101, data, "upper"), 0.01)
     assert math.isclose(stats.null_to_p(101, data, "two"), 0.01)
+
+    # modify data to handle edge case
+    data[98] = 100
+    assert math.isclose(stats.null_to_p(1, data, "lower"), 0.01)
+    assert math.isclose(stats.null_to_p(1, data, "upper"), 0.99)
+    assert math.isclose(stats.null_to_p(100, data, "lower"), 0.99)
+    assert math.isclose(stats.null_to_p(100, data, "upper"), 0.01)
+    assert math.isclose(stats.null_to_p(100, data, "two"), 0.01)
Repository: helmholtz-analytics/heat
Issue: unrecieved Isend in balance function

there is a bug in the balance function where if it is used before another function which uses isend and recv then the recv in the second function will fail. the solution to this is to move the line with `send_amt = if else...`  outside of the if loop

Changed files:
heat/core/dndarray.py

diff --git a/heat/core/dndarray.py b/heat/core/dndarray.py
index 20af23cf..8ba52f29 100644
--- a/heat/core/dndarray.py
+++ b/heat/core/dndarray.py
@@ -553,8 +553,8 @@ class DNDarray:
                 if self.comm.rank == spr:
                     for pr in range(spr):
                         send_amt = abs((chunk_map[pr, self.split] - lshape_map[pr, self.split]).item())
+                        send_amt = send_amt if send_amt < self.lshape[self.split] else self.lshape[self.split]
                         if send_amt:
-                            send_amt = send_amt if send_amt < self.lshape[self.split] else self.lshape[self.split]
                             send_slice[self.split] = slice(0, send_amt)
                             keep_slice[self.split] = slice(send_amt, self.lshape[self.split])
 
@@ -592,8 +592,8 @@ class DNDarray:
             if self.comm.rank == spr:
                 for pr in range(self.comm.size - 1, spr, -1):
                     send_amt = abs((chunk_map[pr, self.split] - lshape_map[pr, self.split]).item())
+                    send_amt = send_amt if send_amt < self.lshape[self.split] else self.lshape[self.split]
                     if send_amt:
-                        send_amt = send_amt if send_amt < self.lshape[self.split] else self.lshape[self.split]
                         send_slice[self.split] = slice(self.lshape[self.split] - send_amt, self.lshape[self.split])
                         keep_slice[self.split] = slice(0, self.lshape[self.split] - send_amt)
Repository: choderalab/perses
Issue: Non-specified kinetic energy variable in addGHMCStep

In https://github.com/choderalab/perses/blob/master/perses/annihilation/ncmc_switching.py#L911-L922 there are two kinetic energy variables, "kinetic" and "ke". However ke is never actually added to the set of global variables so it causes the NCMCGHMCAlchemicalIntegrator to behave improperly.

Changed files:
perses/annihilation/ncmc_switching.py

diff --git a/perses/annihilation/ncmc_switching.py b/perses/annihilation/ncmc_switching.py
index baadec37..4b6c0da7 100644
--- a/perses/annihilation/ncmc_switching.py
+++ b/perses/annihilation/ncmc_switching.py
@@ -918,7 +918,7 @@ class NCMCAlchemicalIntegrator(openmm.CustomIntegrator):
         self.addConstrainPositions()
         self.addComputePerDof("v", "v + 0.5*dt*f/m + (x-x1)/dt")
         self.addConstrainVelocities()
-        self.addComputeSum("ke", "0.5*m*v*v")
+        self.addComputeSum("kinetic", "0.5*m*v*v")
         self.addComputeGlobal("Enew", "kinetic + energy")
         # Compute acceptance probability
         self.addComputeGlobal("accept", "step(exp(-(Enew-Eold)/kT) - uniform)")
Repository: choderalab/perses
Issue: Make default functions `lambda_x` : `lambda`

Our current nonequilibrium switching protocol changes LJ and then electrostatics, which is not symmetric. We should simply change to the protocol `lambda` for now

Changed files:
perses/distributed/relative_setup.py

diff --git a/perses/distributed/relative_setup.py b/perses/distributed/relative_setup.py
index 67346e51..d30e545f 100644
--- a/perses/distributed/relative_setup.py
+++ b/perses/distributed/relative_setup.py
@@ -327,8 +327,8 @@ class NonequilibriumSwitchingFEP(object):
     """
 
     default_forward_functions = {
-        'lambda_sterics' : '2*lambda * step(0.5 - lambda) + (1.0 - step(0.5 - lambda))',
-        'lambda_electrostatics' : '2*(lambda - 0.5) * step(lambda - 0.5)',
+        'lambda_sterics' : 'lambda',
+        'lambda_electrostatics' : 'lambda',
         'lambda_bonds' : 'lambda',
         'lambda_angles' : 'lambda',
         'lambda_torsions' : 'lambda'
@@ -464,6 +464,3 @@ if __name__=="__main__":
     ne_fep.run_nonequilibrium_task()
     ne_fep.run_equilibrium()
     ne_fep.collect_ne_work()
-
-
-
Repository: stingraysoftware/stingray
Issue: Docs with Sphinx are not compiling on Travis

This is the error message:

```
/home/travis/build/StingraySoftware/stingray/stingray/__init__.py:docstring of stingray.AveragedPowerspectrum:5: ERROR: Unexpected indentation.
```

Should be easy to cope with this.


Changed files:
stingray/powerspectrum.py

diff --git a/stingray/powerspectrum.py b/stingray/powerspectrum.py
index 5f99a84f..6515fcb4 100755
--- a/stingray/powerspectrum.py
+++ b/stingray/powerspectrum.py
@@ -493,6 +493,7 @@ class AveragedPowerspectrum(Powerspectrum):
         Make an averaged periodogram from a light curve by segmenting the light
         curve, Fourier-transforming each segment and then averaging the
         resulting periodograms.
+
         Parameters
         ----------
         lc: lightcurve.Lightcurve object OR
Repository: dcs4cop/xcube
Issue: Spurious "can't determine whether the indexer has a time zone" warnings

**Describe the bug**
When producing time-series plots in the viewer from user-selected geometries, the server outputs this warning repeatedly:

> UserWarning: We can't determine whether the time indexer has a time zone. We will therefore omit the check on whether the time indexer and the variable are incompatible in terms of timezone awareness. This may result in an error when an indexing operation is carried out. If such an error occurs after this warning, make sure that the time indexer has timezone information.

It's followed by the usual pandas / xarray indexing warning:

> FutureWarning: Indexing a timezone-naive DatetimeIndex with a timezone-aware datetime is deprecated and will raise KeyError in a future version.  Use a timezone-naive object instead.

**To Reproduce** 

With any server config specifying a timezone-naive dataset:

```bash
python -m xcube.cli.main --warnings --logfile xcube-server.log --loglevel DETAIL serve -v --config xcube-server.yaml --update-after 1
```

Start viewer, pick a dataset, select some geometries (points, circles, etc.). Observe warnings in server logs.

**Expected behavior**
These warnings should not appear.

**Additional context**
See #605 .


Changed files:
xcube/util/timeindex.py, xcube/core/timeseries.py

diff --git a/xcube/core/timeseries.py b/xcube/core/timeseries.py
index 97844075..68449cd3 100644
--- a/xcube/core/timeseries.py
+++ b/xcube/core/timeseries.py
@@ -133,10 +133,9 @@ def get_time_series(
         return None
 
     if start_date is not None or end_date is not None:
-        safe_start_date, safe_end_date = \\
-            ensure_time_index_compatible(dataset, (start_date, end_date))
-        # noinspection PyTypeChecker
-        dataset = dataset.sel(time=slice(safe_start_date, safe_end_date))
+        date_slice = slice(start_date, end_date)
+        safe_slice = ensure_time_index_compatible(dataset, date_slice)
+        dataset = dataset.sel(time=safe_slice)
 
     x_name, y_name = grid_mapping.xy_dim_names
     if isinstance(geometry, shapely.geometry.Point):
diff --git a/xcube/util/timeindex.py b/xcube/util/timeindex.py
index e327be4e..46d04473 100644
--- a/xcube/util/timeindex.py
+++ b/xcube/util/timeindex.py
@@ -160,6 +160,7 @@ def _ensure_timestamp_compatible(var: xr.DataArray, time_value: Any,
                     'time indexer', 'time indexer has'
                 )
             )
+            warnings.warn(f'Indexer: {time_value}')
             return time_value
 
     if _has_datetime64_time(var, time_name):
@@ -187,6 +188,7 @@ def _ensure_timestamp_compatible(var: xr.DataArray, time_value: Any,
                     'data in the time co-ordinate have'
                 )
             )
+            warnings.warn(f'First time value: {first_time_value}')
             return time_value
 
     cant_convert_warning_template = (
Repository: dcs4cop/xcube
Issue: Avoid numpy "parsing timezone aware datetimes is deprecated" warning in tile server

**Describe the bug**

The following warning appears when the server is serving tiles to the viewer:

> `xcube/xcube/core/_tile2.py:659: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future`

**To Reproduce**

Start an xcube viewer and server, including the `--warnings` flag to the server to display warnings. Perform some typical user activities in the viewer (pan, zoom, etc.). The warning will appear in the server log output.

**Expected behavior**

It is expected that this warning will not appear.

**Additional context**

While this bug currently has no consequences beyond the warning, xcube does not set an upper limit on the numpy version in its dependencies. Therefore any future numpy release may upgrade this warning to an error and break all xcube server installs from that moment onward.

The error occurs because the viewer requests a tile with a timezone-aware datestamp (Z suffix) -- see #605 for more on this. While this might be considered incorrect in cases where the time dimension of the data is timezone-naive, the server should in any case be able to handle both timezone-naive and timezone-aware datestamps.

The warning can be reproduced in isolation like this:

```python
import numpy as np
np.array('2018-12-31T00:00:00Z').astype('datetime64[ns]')
```

Probably the most sensible fix is to do a specific check in the `_tile2` module for this particular case (datetime64 target type, timezone-aware string), convert to UTC, and force to naive -- in effect reproducing the old behaviour of numpy.

Changed files:
xcube/core/_tile2.py

diff --git a/xcube/core/_tile2.py b/xcube/core/_tile2.py
index 142f99d7..85fd1abd 100644
--- a/xcube/core/_tile2.py
+++ b/xcube/core/_tile2.py
@@ -27,6 +27,7 @@ from typing import Optional, Tuple, Dict, Any, Hashable, Union, Sequence, List
 import PIL
 import matplotlib.colors
 import numpy as np
+import pandas as pd
 import pyproj
 import xarray as xr
 
@@ -656,6 +657,13 @@ def _get_non_spatial_labels(dataset: xr.Dataset,
                 label = coord_var[-1].values
             else:
                 try:
+                    if np.issubdtype(coord_var.dtype, np.datetime64):
+                        timestamp = pd.Timestamp(label)
+                        if timestamp.tz is not None:
+                            # Convert the timestamp to timezone-naive, since
+                            # NumPy doesn't like parsing timezone-aware
+                            # representations into datetime64 types.
+                            label = timestamp.tz_convert(None).isoformat()
                     label = np.array(label).astype(coord_var.dtype)
                 except (TypeError, ValueError) as e:
                     raise TileRequestException(
Repository: dcs4cop/xcube
Issue: Places not loading on PlaceGroupChange

**Describe the bug**

The place select stays empty when selecting place groups are selected.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to cyanoalert
2. Click on select places and select a group
3. See places select

**Expected behavior**
Places should show up




Changed files:
xcube/webapi/controllers/catalogue.py

diff --git a/xcube/webapi/controllers/catalogue.py b/xcube/webapi/controllers/catalogue.py
index 8af3e636..e61dfbeb 100644
--- a/xcube/webapi/controllers/catalogue.py
+++ b/xcube/webapi/controllers/catalogue.py
@@ -119,12 +119,14 @@ def get_dataset(ctx: ServiceContext, ds_id: str, client=None, base_url: str = No
 
 
 def get_dataset_place_groups(ctx: ServiceContext, ds_id: str) -> List[GeoJsonFeatureCollection]:
-    place_groups = ctx.get_dataset_place_groups(ds_id, load_features=True)
-    return _filter_place_groups(place_groups, del_features=False)
+    # Do not load or return features, just place group (metadata).
+    place_groups = ctx.get_dataset_place_groups(ds_id, load_features=False)
+    return _filter_place_groups(place_groups, del_features=True)
 
 
 def get_dataset_place_group(ctx: ServiceContext, ds_id: str, place_group_id: str) -> GeoJsonFeatureCollection:
-    place_group = ctx.get_dataset_place_group(ds_id, place_group_id, load_features=False)
+    # Load and return features for specific place group.
+    place_group = ctx.get_dataset_place_group(ds_id, place_group_id, load_features=True)
     return _filter_place_group(place_group, del_features=False)
Repository: santoshphilip/eppy
Issue: loopdiagram.py failing

this is in the develop branch.

running from ./eppy/useful_scripts folder I get 

    python loopdiagram.py ../resources/iddfiles/Energy+V8_0_0.idd ../resources/idffiles/V8_0_0/5ZoneWaterLoopHeatPump.idf 
    Traceback (most recent call last):
      File "loopdiagram.py", line 594, in <module>
        sys.exit(main())
      File "loopdiagram.py", line 579, in main
        data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
    ValueError: too many values to unpack

Changed files:
eppy/useful_scripts/loopdiagram.py

diff --git a/eppy/useful_scripts/loopdiagram.py b/eppy/useful_scripts/loopdiagram.py
index b87e69a..59c2f6f 100644
--- a/eppy/useful_scripts/loopdiagram.py
+++ b/eppy/useful_scripts/loopdiagram.py
@@ -547,12 +547,17 @@ def main():
                 description=__doc__, 
                 formatter_class=argparse.RawTextHelpFormatter)
                 # need the formatter to print newline from __doc__
-    parser.add_argument('idd', type=str, action='store', 
+    parser.add_argument(
+        'idd', type=str,
+        action='store',
         help='location of idd file = ./somewhere/eplusv8-0-1.idd',
-        required=True)
-    parser.add_argument('file', type=str, action='store', 
+    )
+    parser.add_argument(
+        'file',
+        type=str,
+        action='store',
         help='location of idf file = ./somewhere/f1.idf',
-        required=True)
+    )
     args = parser.parse_args()
     make_and_save_diagram(args.file, args.idd)