Ticket #748 (closed task: fixed)

Opened 13 years ago

Last modified 13 years ago

[DS] CSML supports XMLBASE (or equivalant)

Reported by: domlowe Owned by: domlowe
Priority: desirable Milestone: Reporting
Component: CSML Version:
Keywords: C-SEKT Cc:


Fix paths so that csml file and netcdf files are bundled together with the correct relative paths.

Change History

comment:1 Changed 13 years ago by domlowe

  • Status changed from new to assigned

comment:2 Changed 13 years ago by domlowe

  • Status changed from assigned to closed
  • Resolution set to fixed

Okay, added a fix for this now. xml:base didn't really do what was wanted so the fix is implemented at the python level (which is probably better than adding more to the CSML schema!)

It has had some impact on the API - you now need to pass a variable called 'outputdir' both to the csml container and to the subsetting methods.

Doing this will ensure that the CSML file and NetCDF files are stored in this same directory with the correct paths for the file extracts. Don't attempt to pass a different 'outputdir' to the container and the subsetting methods or things will break :-)

Here's an example:


#csml file:

#output directory

#define empty container:
csmlContainer=csml.API.csmlContainer.Container(outputdir, csmlname='pointseries.xml',docID="mycsmldoc_1", metadata="mymetadatastring")

#parse csml file:
csmldoc = csml.parser.Dataset()

#get a feature:

#define a selection:   
timerange=('1972-12-31T21:59:60.0' ,'1973-01-01T01:59:60.0')

#perform the subset:
csmlContainer.add(feature.subsetToPointSeries(outputdir, ncname='mypointseries.nc',times=timerange))

#get the finished bundle (csml + netcdf):


comment:3 Changed 13 years ago by spascoe

  • Priority changed from critical to desirable
  • Status changed from closed to reopened
  • Resolution fixed deleted

I think there is a more general problem that will require something like xml:base. However, this is probably no longer a "critical" bug, just very annoying, hence downgrading the priority.

If define a relative path as my data source to csmlscan the CSML API can only use the CSML if sitting in the same directory from which csmlscan was ran. E.g. using this csmlscan config file

type: GridSeries
number: many

root: data
mapping: onetoseveral
output: data/test.csml



srs: EPSG 4326

timedimension: time

Unless I am sitting in the directory containing data I get the following error when looking for a feature's domain:

>>> import csml
>>> d = csml.parser.Dataset()
>>> d.parse('tests/data/test.csml')
(60, 63, 120, 109)
>>> d.getFeatureList()
['TEe1WPeQ', 'R4pBu5iY', 'NsrjEthN', 'PNBhERDn']
>>> f = d.getFeature('TEe1WPeQ')
>>> f.getDomain()['time']
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/research/saturn2/spascoe/svn/csml_trunk/csml/API/ops_GridSeriesFeature.py", line 67, in getDomain
    self.domain[name], fill, axisorder, units=gridOrd.coordAxisValues.insertedExtract.getData()
  File "/research/saturn2/spascoe/svn/csml_trunk/csml/API/ops_FileExtract.py", line 59, in getData
  File "/research/saturn2/spascoe/svn/csml_trunk/csml/csmllibs/csmldataiface.py", line 405, in setAxis
AttributeError: 'cdunifInterface' object has no attribute 'file'

I assume this is because the CSML API fails silently to open the underlying NetCDF. This could be fixed if the CSML file stored the directory in which csmlscan (or a subset operation) was executed in.

Always needing to fix absolute paths in the CSML document means we need to run csmlscan when ever the location of the data changes, even if the CSML doc. moves with the data!

comment:4 Changed 13 years ago by domlowe

  • Milestone changed from BETA+Services to PROD Step2

comment:5 Changed 13 years ago by spascoe

  • Status changed from reopened to closed
  • Resolution set to wontfix

Possible future CSML development.

comment:6 Changed 13 years ago by selatham

  • Status changed from closed to reopened
  • Resolution wontfix deleted
  • Milestone changed from PROD Step2 to Reporting and Futures

comment:7 Changed 13 years ago by selatham

  • Keywords C-SEKT added
  • Status changed from reopened to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.