source: TI01-discovery/branches/ingestion-MEDIN/ingestAutomation-upgrade/OAIBatch/testISO.py @ 6312

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/branches/ingestion-MEDIN/ingestAutomation-upgrade/OAIBatch/testISO.py@6312
Revision 6312, 2.0 KB checked in by sdonegan, 10 years ago (diff)

added method to extract datasetID ..doh

Line 
1from ExtractISO import ExtractISO
2import logging,os
3
4logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s')
5
6#test dif2stubIso xml file - converted from dif via xquery
7dif2stubIso_file = 'data/NEODC/stub_iso/neodc.nerc.ac.uk__stubISO__dataent_11658383444211836_DIF.xml'
8
9isoData = ExtractISO(dif2stubIso_file,'dif2stubIso')
10
11if isoData.createISOdataStructure() is True:
12        logging.info("ISO extractor worked fine! (here are the variables...)")
13elif isoData.createISOdataStructure() is True:
14        logging.info ("Something wrong with ISO extractor... (ExtractISO returned False: xml access problem?)")
15        sys.exit()
16else:
17        logging.info( "Something SERIOUSELY wrong with extractor (couldnt get at ExtractISO class)")
18        sys.exit()
19
20
21
22print "\nTesting for datasetID..."
23for i in isoData.datasetID:
24        print "keywords: " + i
25
26print "\nTesting for keywords..."
27for i in isoData.keywords:
28        print "datasetID: " + i
29       
30print "\nTesting for revision date (List)..."
31for i in isoData.revisionDate:
32        print "revisionDate: " + i
33       
34print "\nTesting for creation date (List) ..."
35for i in isoData.createDate:
36        print "createDate: " + i
37       
38print "\nTesting for dataset name (List) ..."
39for i in isoData.datasetName:
40        print "datasetName: " + i
41       
42print "\nTesting for bounding dates (dictionary) ..."
43for i in isoData.boundingDates.keys():
44        print "boundingDates: " + i + " = " + isoData.boundingDates[i]
45       
46print "\nTesting for original format (List) ..."
47for i in isoData.originalFormat:
48        print "originalFormat: " + i   
49       
50print "\nTesting for authors (List) ..."
51for i in isoData.authors:
52        print "authors: " + i
53               
54print "\nTesting for data centre name (List) ..."
55for i in isoData.datacentreName:
56        print "datacentreName: " + i
57       
58print "\nTesting for parameters (List) ..."
59for i in isoData.parameters:
60        print "parameters: " + i
61       
62print "\nTesting for data centre name (dictionary) ..."
63for i in isoData.boundingBoxCoordinates.keys():
64        print "boundingBoxCoordinates: " + i + " = " + isoData.boundingBoxCoordinates[i]
Note: See TracBrowser for help on using the repository browser.