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

cdms2.open fails on an xml file with "invalid" attributes #1942

Open
durack1 opened this issue Apr 20, 2016 · 3 comments
Open

cdms2.open fails on an xml file with "invalid" attributes #1942

durack1 opened this issue Apr 20, 2016 · 3 comments
Assignees

Comments

@durack1
Copy link
Member

@durack1 durack1 commented Apr 20, 2016

The following error output from ipython should explain the error enough. The .xml input file was generated using cdscan - same version as the uvcdat:

In [2]: fh = cdm.open('ORAS4_1958-2014.xml')
error near line 17: invalid attribute value positive=unknown of element axis, must be one of ('up', 'down')
---------------------------------------------------------------------------                                
AssertionError                            Traceback (most recent call last)                                
<ipython-input-2-c0e2c24bde85> in <module>()                                                               
----> 1 fh = cdm.open('ORAS4_1958-2014.xml')                                                               

/usr/local/uvcdat/2016-03-09/lib/python2.7/site-packages/cdms2/dataset.pyc in openDataset(uri, mode, template, dods, dpath, hostObj)
...

/usr/local/uvcdat/2016-03-09/lib/python2.7/site-packages/cdms2/cdmsNode.pyc in validate(self, idtable)
    359                 if type(atttype) is TupleType:
    360                     attval=self.getExternalAttr(attname)
--> 361                     assert attval in atttype, 'Invalid attribute %s=%s must be in %s'%(attname,attval,`atttype`)
    362                 elif atttype==CDML.Idref:
    363                     attval=self.getExternalAttr(attname)

AssertionError: Invalid attribute positive=unknown must be in ('up', 'down')
@durack1 durack1 changed the title cdms2.open fails to open a file with "invalid" attributes cdms2.open fails on an xml file with "invalid" attributes Apr 20, 2016
@durack1 durack1 added this to the 2.6 milestone Apr 24, 2016
@durack1
Copy link
Member Author

@durack1 durack1 commented Apr 24, 2016

And another error:

In [1]: f = 'ocerean.ORAS4.historical.r0i0p0.mo.ocn.Omon.thetao.ver-1.latestX.xml'

In [2]: import cdms2 as cdm

In [3]: fh = cdm.open(f)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-196c0ae1c74e> in <module>()
----> 1 fh = cdm.open(f)

/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/cdms2/dataset.pyc in openDataset(uri, mode, template, dods, dpath, hostObj)
    369             dpath = head
    370
--> 371     dataset = Dataset(uri, mode, datanode, None, dpath)
    372     return dataset
    373

/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/cdms2/dataset.pyc in __init__(self, uri, mode, datasetNode, parent, datapath)
    518         # Collect named children (having attribute 'id') into dictionaries
    519         if datasetNode is not None:
--> 520             coordsaux = self._convention_.getDsetnodeAuxAxisIds(datasetNode)
    521
    522             for node in datasetNode.getIdDict().values():

/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/cdms2/convention.pyc in getDsetnodeAuxAxisIds(self, dsetnode)
    135                     # It's not an axis node, so must be a variable, so getDomain is defined.
    136                     # Check the rank, don't include if not 1D or 2D (e.g., scalar coordinate)
--> 137                     domnode = dsetdict[item].getDomain()
    138                     if domnode.getChildCount() not in [1,2]:
    139                         continue

KeyError: 'time'

And the associated ncdump:

[durack1@crunchy 160421_data_density]$ ncdump -h /work/guilyardi/database/ORAS4/so_oras4_1m_1958_grid_T.nc
netcdf so_oras4_1m_1958_grid_T {
dimensions:
        t = UNLIMITED ; // (12 currently)
        z = 42 ;
        y = 292 ;
        x = 362 ;
variables:
        float so(t, z, y, x) ;
                so:units = "psu" ;
                so:_Fillvalue = 9.96921e+36f ;
                so:long_name = "Salinity" ;
                so:interval_write = "monthly" ;
                so:coordinates = "time depth lat lon" ;
                so:offline_operation = "time average" ;
                so:standard_name = "sea_water_salinity" ;
                so:_CoordinateAxes = "time depth lat lon" ;
                so:associate = "time depth lat lon" ;

// global attributes:
                :NCO = "4.0.7" ;
                :Conventions = "CF-1.1" ;
                :title = "ORAS4 ocean reanalysis" ;
                :institution = "ECMWF" ;
                :source = "Native Grid ORCA1 monthly average" ;
                :associated_file = "coordinates_grid_T.nc" ;
                :references = "http://www.ecmwf.int/products/forecasts/d/charts/oras4/" ;
}

@doutriaux1 doutriaux1 added this to the 3.0 milestone May 25, 2016
@doutriaux1 doutriaux1 removed this from the 2.6 milestone May 25, 2016
@dnadeau4
Copy link
Contributor

@dnadeau4 dnadeau4 commented Sep 19, 2016

@durack1 where is those XML files, I cannot find them.

@durack1
Copy link
Member Author

@durack1 durack1 commented Sep 21, 2016

@dnadeau4 take a peek at /work/guilyardi/database/ORAS4/ORAS4_1958-2014.xml

@doutriaux1 doutriaux1 removed this from the 3.0 milestone Mar 29, 2019
@doutriaux1 doutriaux1 added this to the 3.2 milestone Mar 29, 2019
@downiec downiec removed this from the 8.2 milestone Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants