-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdd.py
66 lines (57 loc) · 1.69 KB
/
dd.py
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
from gribby import GRIB
from gribby import sections
indicator_section = {
'signature': b'GRIB',
'reserved': b' ',
'master_tables_version_number': 0,
'edition': 3
}
originator_section = {
'centre': 54,
'subcentre': 0,
'local_tables_version_number': 0,
'identification_of_project': 255,
'production_status': 2,
'originator_local_template_number': 255,
'length_of_originator_local_template': 0
}
repetitions_and_index_section = {
'total_number_of_repetitions': 1,
'distinct_section3_greater_than_7_bytes': 1,
'distinct_section4_greater_than_7_bytes': 1,
'distinct_section5_greater_than_7_bytes': 1,
'distinct_section6_greater_than_7_bytes': 1,
'distinct_section7_greater_than_7_bytes': 1,
'distinct_section8_greater_than_7_bytes': 1,
'distinct_section9_greater_than_7_bytes': 1
}
time_domain_section = {
'significance_of_reference_date_and_time': 3,
'type_of_calendar': 0,
'year': 2019,
'month': 7,
'day': 18,
'hour': 14,
'minute': 44,
'second': 16,
'time_domain_template_number': 65535,
}
horizontal_domain_section = {
'number_of_points_in_domain': 5,
'horizontal_domain_template_number': 0,
}
# Thu Jul 18 14:44:16 GMT 2019
#s0 = sections.Section0(b'GRIB', b' ', 0, 3, 12345)
s0 = sections.Section0(**indicator_section)
s1 = sections.Section1(**originator_section)
s2 = sections.Section2(**repetitions_and_index_section)
s3 = sections.Section3(**time_domain_section)
s11 = sections.Section11(b'7777')
with open('jjj.grib3', 'wb') as fh:
g = GRIB(fh)
g.sections.append(s0)
g.sections.append(s1)
g.sections.append(s2)
g.sections.append(s3)
g.sections.append(s11)
g.write()