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

Compatiblity with xarray>2024.2.0 (DataArray object to construct a variable is ambiguous) #67

Open
Skealz opened this issue Aug 12, 2024 · 0 comments

Comments

@Skealz
Copy link
Collaborator

Skealz commented Aug 12, 2024

When processing RCM HH-HV file:

Traceback (most recent call last):                                                                                                                              File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/bin/SAR_L1-to-L2_wind_processor", line 10, in <module>                         
    sys.exit(processor_starting_point())                                                                                                                      
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/grdwindinversion/main.py", line 50, in processor_starting_point                                                                  
    out_file, outputds = makeL2(input_file, out_folder, config_file,                                                                                          
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/grdwindinversion/inversion.py", line 768, in makeL2                                                                              
    xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf, model_vv, model_vh, sigma0_ocean_cross, dsig_cross, sensor_longname, out_file, config = pr
eprocess(                                                                                                                                                     
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/grdwindinversion/inversion.py", line 700, in preprocess                                                                          
    xr_dataset = xr_dataset.assign(nesz_cross_final=(                                                                                                         
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/xarray/core/dataset.py", line 7145, in assign                                                                                    
    data.update(results_data_vars)                                                                                                                              File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/lib/python3.10/site-packages/xarray/core/dataset.py", line 5703, in update                                                                                        merge_result = dataset_update_method(self, other)                                                                                                         
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/lib/python3.10/site-packages/xarray/core/merge.py", line 1055, in dataset_update_method                                                                           return merge_core(                                                                                                                                          File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/xarray/core/merge.py", line 699, in merge_core                                                                                       collected = collect_variables_and_indexes(aligned, indexes=indexes)                                                                                       
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/lib/python3.10/site-packages/xarray/core/merge.py", line 358, in collect_variables_and_indexes                                                                
    variable = as_variable(variable, name=name, auto_convert=False)                                                                                             File "/home/datawork-cersat-public/cache/project/sarwing/commits/xsar_2024v7v30_1v2_0v2v3vpost13_1v0v8_1v0v6_1v0v6_1v2v2_1v0v3_1v0v1_1v2v0/grdwindinversion/
lib/python3.10/site-packages/xarray/core/variable.py", line 136, in as_variable                                                                                   raise TypeError(                                                                                                                                          
TypeError: Variable 'nesz_cross_final': Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.

Solved the issue using xarray 2024.2.0 and numpy 1.26.0

@Skealz Skealz changed the title DataArray construct fails Compatiblity with xarray>2024.2.0 (DataArray object to construct a variable is ambiguous) Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant