Changeset 1178


Ignore:
Timestamp:
14/06/06 17:04:45 (13 years ago)
Author:
domlowe
Message:

fixed problem with axis ordering in csml api

Location:
TI02-CSML/trunk/parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/parser/API/ops_AbstractFileExtract.py

    r1086 r1178  
    3535        DI.setVariable(self.variableName) 
    3636        if kwargs: 
     37            print 'getting data for %s'%kwargs 
    3738            data = DI.getSubsetOfDataForVar(**kwargs) 
    3839        else: 
  • TI02-CSML/trunk/parser/API/ops_GridSeriesFeature.py

    r1146 r1178  
    7777        listPosition=domainref['t'].split().index(time) 
    7878        strTimes= strTimes + ' ' + time  
     79        print self.rangeSet.aggregatedArray.component 
    7980        for comp in self.rangeSet.aggregatedArray.component: 
    8081            data=comp.getData(fileposition=listPosition, **kwargs) 
    8182            self.files.append(comp.fileName.split()[listPosition]) 
     83            #sys.exit() 
     84             
    8285            if fulldata ==[]: 
    8386                fulldata = data.tolist() 
     87                print shape(fulldata) 
     88            #    sys.exit() 
    8489            else: 
    8590                for item in data.tolist(): 
    8691                    fulldata.append(item) 
    87      #get the calendar type 
     92        axisorder = data.getAxisIds()  #will need later! 
     93    #get the calendar type 
    8894    try: 
    8995        caltype, calunits = ops_AbstractFileExtract.__calendar(self.rangeSet.aggregatedArray.component[0].fileName.split()[0], 't')    #TODO should accept any time dim!! 
     
    126132    domain.domainComplement=grid 
    127133    rangeSet=Parser.RangeSet() 
    128     rangeSet.arrayDescriptor=Parser.NetCDFExtract(id=self.id,fileName='temp.nc',variableName=self.id,arraySize=[arraySize]) 
     134    rangeSet.arrayDescriptor=Parser.NetCDFExtract(id=self.id,fileName=pathToSubsetCSML,variableName=self.id,arraySize=[arraySize]) 
    129135 
    130136    #### write csml document ##### -move this to the csmldocument module? 
     
    157163        for val in ordinate.axisValues.split(','): 
    158164            vals.append(float(val)) 
    159         ordinate.axisValues=vals 
     165        print ordinate.definesAxis 
     166        if ordinate.definesAxis=='latitude': 
     167            #this is just a fix till I work out what's going wrong 
     168            vals.reverse() 
     169        print vals 
    160170        item_var[:]=vals[:] 
    161         print ordinate.definesAxis 
    162171    #this needs reconsidering - do the shapes always match up?? 
     172    for ordinate in ordinates: 
     173        if ordinate.definesAxis in axisorder: 
     174            print axisorder 
     175            #(ordinate.definesAxis) 
     176        #print ordinate.definesAxis 
     177    #print axisorder 
     178     
     179     
    163180    if len(ordinates)==3: 
    164         feature_var = ncfile.createVariable (self.id, Float, ('time',ordinates[0].definesAxis,ordinates[1].definesAxis,ordinates[2].definesAxis)) 
     181        #feature_var = ncfile.createVariable (self.id, Float, ('time',ordinates[1].definesAxis,ordinates[0].definesAxis,ordinates[2].definesAxis)) 
     182        feature_var = ncfile.createVariable (self.id, Float, ('time',axisorder[1],axisorder[2],axisorder[3])) 
    165183    elif len(grid.ordinates)==2: 
    166         feature_var = ncfile.createVariable (self.id, Float, ('time',ordinates[0].definesAxis,ordinates[1].definesAxis)) 
     184        #feature_var = ncfile.createVariable (self.id, Float, ('time',ordinates[0].definesAxis,ordinates[1].definesAxis)) 
     185        feature_var = ncfile.createVariable (self.id, Float, ('time',axisorder[1],axisorder[2])) 
    167186    print shape(feature_var) 
    168187    print shape(fulldata) 
     188    #print fulldata 
    169189    feature_var[:]=fulldata[:] 
    170190    ncfile.close() 
  • TI02-CSML/trunk/parser/example.xml

    r1147 r1178  
    33XMLSchemas/CSMLAppSchema.xsd" gml:id="TestDataset"> 
    44        <gml:metaDataProperty xlink:href="http://ndg.nerc.ac.uk/Metadata/TestDataset"/> 
     5        <metaDataProperty xlink:href="http://ndg.nerc.ac.uk/Metadata/TestDataset"/> 
    56        <gml:description>Test CSML Dataset.</gml:description> 
    67        <gml:name codeSpace="http://ndg.nerc.ac.uk/NDGData">DataEntity0000001</gml:name> 
Note: See TracChangeset for help on using the changeset viewer.