source: TI03-DataExtractor/branches/old_stuff/dx-0.1.0/shared_data.py @ 793

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/old_stuff/dx-0.1.0/shared_data.py@793
Revision 793, 1.9 KB checked in by astephen, 13 years ago (diff)

Put all the old code in the old_stuff branch.

Line 
1"""
2shared_data.py
3============
4
5Data module for the extractor package.
6
7This module holds the global variables used throughout
8the package.
9
10Version history
11===============
12
13Version 1.0:  - 01/03/2004
14              - Ag Stephens, British Atmospheric Data Centre.
15              - First version.
16
17"""
18
19# Import python modules
20import os
21
22# Set up common functions
23def makeDirsAndPerms(basedir, dirs, permissions, owner, verbose="no"):
24    """
25    A function for making directories recursively and setting permissions/ownership.
26    """
27    if type(dirs)==str: dirs=[dirs]
28    dirs=[basedir]+list(dirs)
29    dir=None
30
31    while len(dirs)>0:
32
33        if dir:
34            dir=os.path.join(dir, dirs[0])
35        else:
36            dir=dirs[0]
37        dirs=dirs[1:]
38
39        if not os.path.exists(dir):
40            if verbose=="yes":   print "Making directory:", dir
41            os.mkdir(dir)
42            os.chmod(dir, permissions)
43            os.system('/bin/chown %s %s' % (owner, dir))
44
45    return
46
47# Set up common classes
48class RedirectStdout:
49
50    def write(self, item):
51         pass
52
53# Set up commmon variables
54basedir="/usr/local/dx"
55
56request_dir=os.path.join(basedir, "requests")
57
58html_dir=os.path.join(basedir, "html")
59
60extras_dir="/dx_extras"
61
62dataset_dir=os.path.join(basedir, "datasets")
63
64http_header="Content-Type: text/html\n\n"
65
66#output_dir=("/var/www/html/nctemp")
67
68BADC_DATA_BROWSER="http://badc.nerc.ac.uk/cgi-bin/data_browser/data_browser"
69
70visualisor="http://cdat.badc.nerc.ac.uk/cgi-bin/splatui.py"
71
72map_applet="http://cdat.badc.nerc.ac.uk/dx_extra/LiveMap_30/extractorMap.html"
73
74pages=["DatasetPage", "SubsetPage", "VariablesPage", "DomainPage", "ResultsPage"]
75
76domainParams=("start_time", "end_time", "time_interval", "horiz_domain", 
77                      "resolution", "vertical_units", "vertical_domain", 
78                       "output_type")
79
80time_keys=("year", "month", "day", "hour", "min", "sec")
81
82horiz_keys=("north", "east", "south", "west")
Note: See TracBrowser for help on using the repository browser.