-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcreate_region
More file actions
executable file
·69 lines (46 loc) · 2.24 KB
/
create_region
File metadata and controls
executable file
·69 lines (46 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import argparse
from limited_area.limited_area import LimitedArea
if __name__ == "__main__":
description = ("Create regional subsets of global MPAS meshes using "
"a regional specification .pts file that specifies the "
"regions boundary.")
epilog = ("For more information please see: "
"https://github.com/MiCurry/MPAS-Limited-Area")
parser = argparse.ArgumentParser(description=description,
epilog=epilog)
required_description = ("create_region requires a MPAS mesh file that "
"contains mesh connectivity fields and a file for "
"specifying a regional area (.pts file). ")
required = parser.add_argument_group('Required', required_description)
options = parser.add_argument_group('Options')
required.add_argument('points',
help='Points file specifying the MPAS regional area',
type=str)
required.add_argument('files',
help=('Global MPAS file(s) to be subset. If multiple '
'meshes are given, the first must contain mesh '
'connectivity infromation that will be used to '
'subset all files.'),
nargs='+',
type=str)
options.add_argument('-v', '--verbose',
help='Turn on verbose setting 0-5',
type=int,
default=0)
args, unkown = parser.parse_known_args()
DEBUG = args.verbose
if DEBUG > 0:
print("DEBUG: DEBUG set to verbose level ", DEBUG, '\n')
if DEBUG > 1:
print("DEBUG: Mesh Files: ", args.files)
print("DEBUG: Points File: ", args.points)
kwargs = { 'DEBUG' : DEBUG }
regional_area = LimitedArea(args.files,
args.points,
format='NETCDF3_64BIT_OFFSET',
**kwargs)
regional_area.gen_region(**kwargs)
if DEBUG > 0:
print("DEBUG: Limited Area Creation Finished")