cryotools / cosipy

Coupled snowpack and ice surface energy and mass balance model in Python
GNU General Public License v3.0
51 stars 29 forks source link

TypeError when runing COSIPY on the example files #41

Closed arbindrakhadka closed 8 months ago

arbindrakhadka commented 3 years ago

When running cosipy on a newly built Anaconda on the Zhadang example, we get the error message below. Note that we did manage to install and run cosipy on previous Windows installs of Anaconda. Could this be a problem with the version of xarray or pandas?

Traceback (most recent call last):

File "D:\cosipy-master\cosipy\COSIPY.py", line 366, in main()

File "D:\cosipy-master\cosipy\COSIPY.py", line 62, in main RESULT = IO.create_result_file()

File "D:\cosipy-master\cosipy\cosipy\cpkernel\io.py", line 96, in create_result_file self.init_result_dataset()

File "D:\cosipy-master\cosipy\cosipy\cpkernel\io.py", line 305, in init_result_dataset self.add_variable_along_latlon(self.RESULT, self.DATA.HGT, 'HGT', 'm', 'Elevation')

File "D:\cosipy-master\cosipy\cosipy\cpkernel\io.py", line 781, in add_variable_along_latlon ds[name] = ((northing,easting), var)

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\dataset.py", line 1563, in setitem self.update({key: value})

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\dataset.py", line 4208, in update merge_result = dataset_update_method(self, other)

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\merge.py", line 984, in dataset_update_method return merge_core(

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\merge.py", line 632, in merge_core collected = collect_variables_and_indexes(aligned)

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\merge.py", line 294, in collect_variables_and_indexes variable = as_variable(variable, name=name)

File "C:\Users\khadkaa\anaconda3\envs\cosipy\lib\site-packages\xarray\core\variable.py", line 121, in as_variable raise TypeError(

TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.

AnsArn commented 3 years ago

Yes, I think it is an issue with the newest xarray version 0.19.0.

Could you install version 0.18.2 and test if it works?

FannyBrun commented 2 years ago

Sorry for not following on the thread. Yes we rolled back to the xarray version 0.18.2 and it worked fine. Thanks!

xiaoheijie commented 1 year ago

Can COSIPY run normally on Windows system now?

AnsArn commented 1 year ago

The main run can be executed on Windows systems. Only the preprocessing step to create the static file is not possible on Windows systems.