source: TI02-CSML/trunk/Examples/ScanningStuff/filemaptest.py @ 1460

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/Examples/ScanningStuff/filemaptest.py@1460
Revision 1460, 1.9 KB checked in by domlowe, 15 years ago (diff)

Moving various non-core scripts etc out of scanner directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/env python
2
3#test code to test filemapmaker class
4#08 december 2005
5
6import csmllibs
7import sys
8               
9#main - using the class
10
11
12#topdir ='/home/users/domlowe/CSML/Coapec/testfiles'
13topdir='/home/users/domlowe/CSML/Examples'
14
15ft='GridSeriesFeature'
16
17#To use mixedft need to find a way of creating a feature type dictionary to map files to featuret types (could be automated or interactive)
18#feature type dictionary should take the form {fullfilename:featuretypename}
19ftdictionary = {'/home/users/domlowe/CSML/Coapec/testfiles/xaaqda@pxr99c1.nc':'GridSeriesFeature','/home/users/domlowe/CSML/Coapec/testfiles/xaaqda@pxs09c1.nc':'PointFeature', '/home/users/domlowe/CSML/Coapec/testfiles/xaaqda@pxs19c1.nc':'ProfileFeature','/home/users/domlowe/CSML/Coapec/testfiles/xaaqda@pxt09c1.nc':'GridFeature'}
20
21
22fmm = csmllibs.csmlfiles.FileMapMaker(topdir,ft)
23
24print "************************************"
25print ''
26print "ONE TO MANY:"
27ffmap=fmm.onetomany()
28#print to check:
29for repfile in ffmap.getRepresentativeFiles():
30        print 'representative file:'
31        print repfile.getRepresentativeFileName()
32        print 'feature type:'
33        print repfile.getFeatureType() 
34       
35        for relfile in repfile.getRelatedFiles():
36                print 'related file:'
37                print relfile.getRelatedFileName()
38                print 'feature type:'
39                print relfile.getFeatureType()
40       
41print "************************************"
42print ''
43print "ONE TO ONE:"
44ffmap=fmm.onetoone()
45for repfile in ffmap.getRepresentativeFiles():
46        print 'representative file:'
47        print repfile.getRepresentativeFileName()
48        print 'feature type:'
49        print repfile.getFeatureType() 
50
51
52#new handler required to handle mixed feature types
53fmm = csmllibs.csmlfiles.FileMapMaker(topdir,ftdictionary)
54
55
56sys.exit()
57
58
59print "************************************"
60print ''
61print "MIXED FEATURETYPES:"
62ffmap=fmm.mixedft()
63for repfile in ffmap.getRepresentativeFiles():
64        print 'representative file:'
65        print repfile.getRepresentativeFileName()
66        print 'feature type:'
67        print repfile.getFeatureType() 
Note: See TracBrowser for help on using the repository browser.