source: cows_wps/trunk/cows_wps/utils/ukcp09_copyright_file_utils.py @ 5615

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/cows_wps/utils/ukcp09_copyright_file_utils.py@5615
Revision 5615, 1.7 KB checked in by spascoe, 11 years ago (diff)

COWS WPS package copied from
 http://proj.badc.rl.ac.uk/svn/dcip/cows-wps/trunk.

This is a stripped down version of the DDP WPS. Some features are
removed and others have been deactivated until we reimplement them in a
more generic way.

Line 
1"""
2ukcp09_copyright_file_utils
3===========================
4
5Provides the simple function createUKCP09CopyrightFile().
6
7"""
8
9import os
10
11copyright_text = """(c) Crown Copyright 2009.
12
13The UK Climate Projections data have been made available by the
14Department for Environment, Food and Rural Affairs (Defra) and
15Department for Energy and Climate Change (DECC) under licence
16from the Met Office, Newcastle University, University of East
17Anglia and Proudman Oceanographic Laboratory. These organisations
18accept no responsibility for any inaccuracies or omissions in
19the data, nor for any loss or damage directly or indirectly
20caused to any person or body by reason of, or arising out of,
21any use of this data.
22"""
23
24COPYRIGHT_FILE_NAME = "copyright.txt" 
25COPYRIGHT_FILE_INFO = "Copyright information"
26
27def createUKCP09CopyrightFile(output_dir):
28    """
29    Creates a copy of the copyright file at 'output_dir/copyright.txt'.
30    Returns tuple of (file_name, file_size, file_info).
31    """
32    file_name = COPYRIGHT_FILE_NAME
33    file_path = os.path.join(output_dir, file_name)
34
35    fout = open(file_path, "w")
36    fout.write(copyright_text)
37    fout.close()
38
39    file_info = COPYRIGHT_FILE_INFO
40    file_size = os.path.getsize(file_path)
41    return (file_name, file_size, file_info)
42
43
44def getCopyrightFileDetailsForDryRun():
45    """
46    Creates a copy of the copyright file at 'output_dir/copyright.txt'.
47    Returns tuple of (file_name, file_size, file_info).
48    """
49    file_name = COPYRIGHT_FILE_NAME
50    file_size = len(copyright_text)
51    file_info = COPYRIGHT_FILE_INFO
52   
53    return (file_name, file_size, file_info)
54
55if __name__ == "__main__":
56
57    createUKCP09CopyrightFile(".")
Note: See TracBrowser for help on using the repository browser.