GeoscienceAustralia / tcrm

A statistical-parametric model for assessing wind hazard from tropical cyclones
http://geoscienceaustralia.github.io/tcrm
Other
80 stars 52 forks source link

Installation error #118

Closed Wenbo-Duan closed 2 years ago

Wenbo-Duan commented 2 years ago

Hi,

I’m a new user of TCRM on windows and I’m running into an error when installing the package and running the run_test_all.cmd (shown below). I'm using python 3.8.8 on windows 10 enterprise version. I'm also a bit confused by the instruction for Setting the environment for windows. What exactly needs to be set up? Is it PYTHONPATH?

Any input would be appreciated, thanks!

====================================================================== ERROR: test_largePercentThreshold (tests.test_maps.TestSelectColorMap) Test select_colormap returns diverging color map for larger threshold

Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 95, in test_largePercentThreshold self.assertColorMapEqual(cmap, self.diverging_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

====================================================================== ERROR: test_sequentialData (tests.test_maps.TestSelectColorMap) Test asymmetric data range returns sequential color map

Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 90, in test_sequentialData self.assertColorMapEqual(cmap, self.sequential_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

====================================================================== ERROR: test_symmetricDataDiverges (tests.test_maps.TestSelectColorMap) Test symmetric data range (around 0) returns divergent color map

Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 85, in test_symmetricDataDiverges self.assertColorMapEqual(cmap, self.diverging_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()


Ran 180 tests in 55.322s

FAILED (errors=3, skipped=7)

wcarthur commented 2 years ago

Hi @Wenbo-Duan Setting PYTHONPATH is essential to point to appropriate python libraries. If you're executing TCRM at a Windows command prompt, then you need to use the set command for this. I have the code installed on my local machine in C:\WorkSpace\tcrm, so I need the following to add the TCRM modules to the path:

set PYTHONPATH=%PYTHONPATH%;C:\WorkSpace\tcrm;C:\WorkSpace\tcrm\Utilities

If you have your other python libraries (e.g. matplotlib) installed in a non-standard directory, then you will need to add those directories to the PYTHONPATH as well.

Wenbo-Duan commented 2 years ago

Thanks, I'm using anaconda PowerShell prompt and I set PYTHONPATH using the following command: conda env config vars set PYTHONPATH=%PYTHONPATH%;C:\TCRM;C:\TCRM\Utilities When running the test command, I get the following errors, all of them seem to be related to the color map. Can I ignore this error?

Thanks!

ERROR: test_largePercentThreshold (tests.test_maps.TestSelectColorMap) Test select_colormap returns diverging color map for larger threshold Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 95, in test_largePercentThreshold self.assertColorMapEqual(cmap, self.diverging_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

====================================================================== ERROR: test_sequentialData (tests.test_maps.TestSelectColorMap) Test asymmetric data range returns sequential color map Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 90, in test_sequentialData self.assertColorMapEqual(cmap, self.sequential_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

====================================================================== ERROR: test_symmetricDataDiverges (tests.test_maps.TestSelectColorMap) Test symmetric data range (around 0) returns divergent color map Traceback (most recent call last): File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 85, in test_symmetricDataDiverges self.assertColorMapEqual(cmap, self.diverging_cmap) File "C:\TCRM\tcrm-3.1.9\tests\test_maps.py", line 57, in assertColorMapEqual expected._segmentdata) File "C:\ProgramData\Anaconda3\envs\tcrm\lib\unittest\case.py", line 1132, in assertDictEqual if d1 != d2: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Ran 180 tests in 55.322s

FAILED (errors=3, skipped=7)

wcarthur commented 2 years ago

Seems that assertDictEqual doesn't like anything other than really simple dicts. The dicts in the colormaps are comprised of numpy arrays as values, and this results in the observed ValueError. I've updated the test suite to compare individual elements of the colormaps, so as to avoid using assertDictEqual.

See https://github.com/GeoscienceAustralia/tcrm/commit/091db2f503f9ad1a5c45ac3306a21eae73d8ea8a

Wenbo-Duan commented 2 years ago

Thank you!