-
Notifications
You must be signed in to change notification settings - Fork 10
/
create_region
executable file
·66 lines (43 loc) · 2.12 KB
/
create_region
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
#!/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 a limited area MPAS grid from a global MPAS grid"
" and a file that specifies the regional area boundary.")
epilog = ("For more information please see: "
"https://github.com/MiCurry/MPAS-Limited-Area")
parser = argparse.ArgumentParser(description=description,
epilog=epilog)
required = parser.add_argument_group('Required', "Limited Area requires a"
" MPAS Grid as well as a"
" file specifying the"
" limited area.")
options = parser.add_argument_group('Options', "Options to generating the"
" MPAS limited area.")
required.add_argument('points',
help='Points file specifying the MPAS regional area',
type=str)
required.add_argument('grid',
help=('Global MPAS grid file. Either a grid.nc or'
' static.nc file'),
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: Grid File: ", args.grid)
print("DEBUG: Points File: ", args.points)
kwargs = { 'DEBUG' : DEBUG }
regional_area = LimitedArea(args.grid,
args.points,
format='NETCDF3_64BIT_OFFSET',
**kwargs)
regional_area.gen_region(**kwargs)
if DEBUG > 0:
print("DEBUG: Limited Area Creation Finished")