darothen / xbpch

xarray interface for bpch files
MIT License
17 stars 5 forks source link

Xarray Error while implementing bpch_to_nc script of xbpch: conflicting sizes for dimension #13

Open mulgamulgi33 opened 5 years ago

mulgamulgi33 commented 5 years ago

Hello everyone,

I am facing an error of " conflicting sizes for dimension time " when I am implementing bpch_to_nc script of xbpch. If anyone knows the solution for this error please let me know.

In the terminal after executing the command I get:

Reading in file(s)... /usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py:710: UserWarning: Duplicate names specified. This will raise an error in the future. return _read(filepath_or_buffer, kwds) Traceback (most recent call last): File "/usr/local/bin/bpch_to_nc", line 4, in import('pkg_resources').run_script('xbpch==0.3.3', 'bpch_to_nc') File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 657, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1437, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/xbpch-0.3.3.dist-info/scripts/bpch_to_nc", line 77, in ds = open_bpchdataset(args.bpch_files[0], **open_kws) File "/usr/local/lib/python2.7/dist-packages/xbpch/core.py", line 82, in open_bpchdataset ds = xr.Dataset.load_store(store) File "/usr/local/lib/python2.7/dist-packages/xarray/core/dataset.py", line 397, in load_store obj = cls(variables, attrs=attributes) File "/usr/local/lib/python2.7/dist-packages/xarray/core/dataset.py", line 365, in init self._set_init_vars_and_dims(data_vars, coords, compat) File "/usr/local/lib/python2.7/dist-packages/xarray/core/dataset.py", line 383, in _set_init_vars_and_dims data_vars, coords, compat=compat) File "/usr/local/lib/python2.7/dist-packages/xarray/core/merge.py", line 365, in merge_data_and_coords indexes=indexes) File "/usr/local/lib/python2.7/dist-packages/xarray/core/merge.py", line 443, in merge_core dims = calculate_dimensions(variables) File "/usr/local/lib/python2.7/dist-packages/xarray/core/dataset.py", line 109, in calculate_dimensions (dim, size, k, dims[dim], last_used[dim])) ValueError: conflicting sizes for dimension 'time': length 38 on 'IJ-SOA-$_POA' and length 19 on 'PL-SUL=$_SO2dms'

Thank you

-Pritanjali Shende

darothen commented 5 years ago

Hi @mulgamulgi33, can you please post a link to a sample bpch file and your tracerinfo.dat/diaginfo.dat files?

r-pound commented 5 years ago

Hi, I've also had an identical issue however this only occurs for runs longer than 1 month. Version 12.1.1 of GEOS-Chem with no modifications to the code. I'm on version 0.3.4 of xbpch.

This isn't a big issue as the netcdf diagnostics are working fine in 12.1.1 and as far as I can tell I'm unable to replicate the error with older versions of GEOS-Chem bpch output. It looks like the time dimensions for IJ-SOA-$_POA are always doubled so it might be an issue with the actual bpch file that is being output?

darothen commented 5 years ago

Hi @r-pound... also a very peculiar edge case. If y'all can get me those sample outputs I can try to debug it myself but without them, there's not a lot that I can do.

peterivatt commented 5 years ago

Hi @darothen I have spotted the issue here, in V11 in the tracerinfo.dat file ND42 has two duplicated names "POA" and "OPOA", these get concatenated on the time dimension. This has been fixed in V12. I spotted this as a similar things happens when tracer names exceed 8 characters and then truncate to identical names.

Thanks, Peter

darothen commented 5 years ago

Thanks @peterivatt, that's helpful - it's the same issue as #17. I think I'm going to implement the "brute force" option and force users to specify if their tracerinfo.dat is from before GC v12.2.0 and just deal with it that way. Hopefully will be able to cut a patch this weekend.