Closed lee1043 closed 1 year ago
Hi @lee1043 – see this FAQ on this issue. Does this resolve the issue?
Hi @pochedls, thank you for the information. In this specific case unfortunately either or both of compat
and join
option was not helping. I guess this might be a data issue, but wanted to share with the team just in case this could be helpful. I haven't looked the data itself in detail.
@msahn can you tell if the data is raw data or obs4mip-processed?
>>> xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', compat='override')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xcdat/dataset.py", line 205, in open_mfdataset
ds = xr.open_mfdataset(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/backends/api.py", line 1011, in open_mfdataset
combined = combine_by_coords(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 976, in combine_by_coords
concatenated = _combine_single_variable_hypercube(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 634, in _combine_single_variable_hypercube
concatenated = _combine_nd(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 235, in _combine_nd
combined_ids = _combine_all_along_first_dim(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 270, in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 293, in _combine_1d
combined = concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 249, in concat
return _dataset_concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 505, in _dataset_concat
concat_over, equals, concat_dim_lengths = _calc_concat_over(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 406, in _calc_concat_over
process_subset_opt(coords, "coords")
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 321, in process_subset_opt
raise ValueError(
ValueError: Cannot specify both coords='different' and compat='override'.
>>> xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', join='override')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xcdat/dataset.py", line 205, in open_mfdataset
ds = xr.open_mfdataset(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/backends/api.py", line 1011, in open_mfdataset
combined = combine_by_coords(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 976, in combine_by_coords
concatenated = _combine_single_variable_hypercube(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 634, in _combine_single_variable_hypercube
concatenated = _combine_nd(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 235, in _combine_nd
combined_ids = _combine_all_along_first_dim(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 270, in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 293, in _combine_1d
combined = concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 249, in concat
return _dataset_concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 521, in _dataset_concat
merged_vars, merged_indexes = merge_collected(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/merge.py", line 291, in merge_collected
merged_vars[name] = unique_variable(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/merge.py", line 145, in unique_variable
raise MergeError(
xarray.core.merge.MergeError: conflicting values for variable 'lon_bnds' on objects to be combined. You can skip this check by specifying compat='override'.
>>> xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', compat='override', join='override')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xcdat/dataset.py", line 205, in open_mfdataset
ds = xr.open_mfdataset(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/backends/api.py", line 1011, in open_mfdataset
combined = combine_by_coords(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 976, in combine_by_coords
concatenated = _combine_single_variable_hypercube(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 634, in _combine_single_variable_hypercube
concatenated = _combine_nd(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 235, in _combine_nd
combined_ids = _combine_all_along_first_dim(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 270, in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/combine.py", line 293, in _combine_1d
combined = concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 249, in concat
return _dataset_concat(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 505, in _dataset_concat
concat_over, equals, concat_dim_lengths = _calc_concat_over(
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 406, in _calc_concat_over
process_subset_opt(coords, "coords")
File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20230418/lib/python3.9/site-packages/xarray/core/concat.py", line 321, in process_subset_opt
raise ValueError(
ValueError: Cannot specify both coords='different' and compat='override'.
@lee1043 This is raw data downloaded from CREATE-IP. search_url='https://esgf-node.llnl.gov/esg-search/wget/?distrib=false&dataset_id=CREATE-IP.reanalysis.NASA-GMAO.GEOS-5.MERRA.atmos.day.v20200611|esgf.nccs.nasa.gov'
FYI, other reanalysis data downloaded from CREATE-IP (CFSR, ERA-Interim, JRA-55, MERRA2) are working well with xcdat.open
. This error occurs only with MERRA among them.
@lee1043 – this arose again for @bonfils2 in #470. Do the workarounds in that thread work (if so, maybe we can close this thread as a duplicate and continue the dialogue on that issue)?
Thank you @pochedls for the workaround. I found both these three commends works.
ds = xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', data_vars="all")
ds = xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', drop_variables="lon_bnds")
Another option suggested by @pochedls yields the same error
ds = xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', coords="all")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xcdat/dataset.py", line 216, in open_mfdataset
ds = xr.open_mfdataset(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/backends/api.py", line 1011, in open_mfdataset
combined = combine_by_coords(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/combine.py", line 976, in combine_by_coords
concatenated = _combine_single_variable_hypercube(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/combine.py", line 634, in _combine_single_variable_hypercube
concatenated = _combine_nd(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/combine.py", line 235, in _combine_nd
combined_ids = _combine_all_along_first_dim(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/combine.py", line 270, in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/combine.py", line 293, in _combine_1d
combined = concat(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/concat.py", line 249, in concat
return _dataset_concat(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/concat.py", line 521, in _dataset_concat
merged_vars, merged_indexes = merge_collected(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/merge.py", line 291, in merge_collected
merged_vars[name] = unique_variable(
File "/home/lee1043/.conda/envs/xcdat_dev_20230424/lib/python3.10/site-packages/xarray/core/merge.py", line 145, in unique_variable
raise MergeError(
xarray.core.merge.MergeError: conflicting values for variable 'lon_bnds' on objects to be combined. You can skip this check by specifying compat='override'.
I am closing this issue to continue the dialogue on https://github.com/xCDAT/xcdat/issues/470.
Below works -- thanks @pochedls
ds = xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', coords="minimal", compat='override')
@lee1043 Are these files available on /p/user_pub
? I would like to try these options out while I update the docs in #473
I am going to omit this option from #473 because we don't handle the extra concatenated time dimension in our APIs:
ds = xcdat.open_mfdataset('/work/ahn6/obs/MERRA/pr/pr_day_reanalysis_MERRA_*.nc', data_vars="all")
@tomvothecoder thanks for following up. The data is not in /p/user_pub
at the moment but I am working on to find a good place and obtain permission to move the data over to it. I will keep you updated when the data is ready in /p/user_pub
@lee1043 No problem. I found some other datasets in old scripts to reproduce this issue so you don't need to add these files to /p/user_pub
anymore!
I just added the data to /p/user_pub/PCMDIobs/obs4MIPs_input/create-ip/MERRA2/pr
.
What happened?
Reported by @msahn
When I tried to use xcdat.open for MERRA data, I got the below error:
What did you expect to happen?
No response
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
No response
Environment
xcdat 0.4.0