Skip to content

cannot infer dimension to concatenate #9

@thomasarsouze

Description

@thomasarsouze

Hi,
I'm quite interested in your package, so I wanted to give it a try.
I've got a regular ORCA1 simulation, and I just want to load some grid_U and grid_V files to begin with.

data_files
[PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20000101_20001231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20010101_20011231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20020101_20021231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20030101_20031231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20040101_20041231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20050101_20051231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20060101_20061231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20070101_20071231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20080101_20081231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20090101_20091231_grid_U.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20000101_20001231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20010101_20011231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20020101_20021231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20030101_20031231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20040101_20041231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20050101_20051231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20060101_20061231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20070101_20071231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20080101_20081231_grid_V.nc'),
 PosixPath('/esnas/exp/ecearth/a13c/original_files/19500101/fc0/outputs/a13c_1m_20090101_20091231_grid_V.nc')]

)
aux_files
[PosixPath('/esnas/releases/models/nemo/v3.6_ecearth/inidata/nemo/ORCA1L75/mesh_mask_nemo.Ec3.2_O1L75.nc')]
netcdf a13c_1m_20000101_20001231_grid_U {
dimensions:
	axis_nbounds = 2 ;
	x = 362 ;
	y = 292 ;
	depthu = 75 ;
	time_counter = UNLIMITED ; // (12 currently)
variables:
	float nav_lat(y, x) ;
	float nav_lon(y, x) ;
	float depthu(depthu) ;
	float depthu_bounds(depthu, axis_nbounds) ;
	float uo(time_counter, depthu, y, x) ;
	double time_centered(time_counter) ;
	double time_centered_bounds(time_counter, axis_nbounds) ;
	double time_counter(time_counter) ;
	double time_counter_bounds(time_counter, axis_nbounds) ;
	float u2o(time_counter, depthu, y, x) ;
	float tauuo(time_counter, y, x) ;
	float umo(time_counter, depthu, y, x) ;
}
netcdf a13c_1m_20000101_20001231_grid_V {
dimensions:
	axis_nbounds = 2 ;
	x = 362 ;
	y = 292 ;
	depthv = 75 ;
	time_counter = UNLIMITED ; // (12 currently)
variables:
	float nav_lat(y, x) ;
	float nav_lon(y, x) ;
	float depthv(depthv) ;
	float depthv_bounds(depthv, axis_nbounds) ;
	float vo(time_counter, depthv, y, x) ;
	double time_centered(time_counter) ;
	double time_centered_bounds(time_counter, axis_nbounds) ;
	double time_counter(time_counter) ;
	double time_counter_bounds(time_counter, axis_nbounds) ;
	float v2o(time_counter, depthv, y, x) ;
	float tauvo(time_counter, y, x) ;
	float vmo(time_counter, depthv, y, x) ;
}

But when I run the load_orca_dataset as in your example :

ds_xorca = load_xorca_dataset(data_files=data_files, aux_files=aux_files,
                              decode_cf=True, 
                              input_ds_chunks={"time_counter": 6, "t": 6,
                                               "z": 23, "Z": 23,
                                               "deptht": 23, "depthu": 23,
                                               "depthv": 23, "depthw": 23,
                                               "y": 511, "Y": 511,
                                               "x": 361, "X": 361},
                              target_ds_chunks={"t": 6,
                                                "z_c": 23, "z_l": 23,
                                                "y_c": 511, "y_r": 511,
                                                "x_c": 360, "x_r": 360})

(actually the chunks don't make sense, but this is not an issue here, and it's the same problem with other chunks or no chunks at all)
then it's failing :

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-29-160e480e9682> in <module>()
     10                                                 "z_c": 23, "z_l": 23,
     11                                                 "y_c": 511, "y_r": 511,
---> 12                                                 "x_c": 360, "x_r": 360})
     13 ##                              input_ds_chunks={"time_counter":12,"depthu":25,"depthv":25,"z":25},
     14 ##                              target_ds_chunks={"t":12,"z_c":25},

~/miniconda3/envs/xorca/lib/python3.6/site-packages/xorca/lib.py in load_xorca_dataset(data_files, aux_files, decode_cf, **kwargs)
    389                     **kwargs),
    390                     data_files, _data_files_chunks)),
--> 391             key=_get_first_time_step_if_any))
    392 
    393     # Add info from aux files

~/miniconda3/envs/xorca/lib/python3.6/site-packages/xarray/core/combine.py in auto_combine(datasets, concat_dim, compat, data_vars, coords)
    434         concatenated = [_auto_concat(ds, dim=dim,
    435                                      data_vars=data_vars, coords=coords)
--> 436                         for ds in grouped]
    437     else:
    438         concatenated = datasets

~/miniconda3/envs/xorca/lib/python3.6/site-packages/xarray/core/combine.py in <listcomp>(.0)
    434         concatenated = [_auto_concat(ds, dim=dim,
    435                                      data_vars=data_vars, coords=coords)
--> 436                         for ds in grouped]
    437     else:
    438         concatenated = datasets

~/miniconda3/envs/xorca/lib/python3.6/site-packages/xarray/core/combine.py in _auto_concat(datasets, dim, data_vars, coords)
    359                                  'concatenate: %s' % concat_dims)
    360             elif len(concat_dims) == 0:
--> 361                 raise ValueError('cannot infer dimension to concatenate: '
    362                                  'supply the ``concat_dim`` argument '
    363                                  'explicitly')

ValueError: cannot infer dimension to concatenate: supply the ``concat_dim`` argument explicitly

I don't see what's different in my test compared to your example...
Thanks in advance.
Thomas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions