Last change
on this file was
2070,
checked in by mlefevre, 6 years ago
|
Add necessary files to create start state for generic mesoscale model
|
-
Property svn:executable set to
*
|
File size:
903 bytes
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | import numpy as np |
---|
4 | from math import * |
---|
5 | from struct import * |
---|
6 | from netCDF4 import Dataset |
---|
7 | from array import * |
---|
8 | |
---|
9 | #filename = 'HR_Relief.nc' |
---|
10 | #file=Dataset(filename,mode='r') |
---|
11 | #topo=file.variables['RELIEF'][:] |
---|
12 | |
---|
13 | #res=len(topo) |
---|
14 | res=180 |
---|
15 | #topo=topo*1. + 9000. |
---|
16 | topo=0 |
---|
17 | topo=topo + 9000. |
---|
18 | |
---|
19 | part2b=[] |
---|
20 | partb=[] |
---|
21 | for j in range(res) : |
---|
22 | a=[] |
---|
23 | b=[] |
---|
24 | for i in range(res) : |
---|
25 | a.append(pack('>h',topo)) |
---|
26 | #a.append(pack('>h',topo[j][i])) |
---|
27 | #a.append(pack('>h',topo[j][2*res-1-i])) |
---|
28 | b.append(pack('>h',topo)) |
---|
29 | #b.append(pack('>h',topo[j][i+res])) |
---|
30 | #b.append(pack('>h',topo[j][res-i])) |
---|
31 | partb.append(a) |
---|
32 | part2b.append(b) |
---|
33 | # Eastern part |
---|
34 | #f = open('00res-00res*2.00001-00res', 'wb') |
---|
35 | f = open('00181-00360.00001-00180', 'wb') |
---|
36 | f.write(np.array(part2b)) |
---|
37 | # Western part |
---|
38 | #f = open('00001-00res.00001-00res','wb') |
---|
39 | f = open('00001-00180.00001-00180','wb') |
---|
40 | f.write(np.array(partb)) |
---|
Note: See
TracBrowser
for help on using the repository browser.