source: trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/Generic_topo/gcm_build.py

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
3import numpy as np
4from math import *
5from struct import *
6from netCDF4 import Dataset
7from array import *
8
9#filename = 'HR_Relief.nc'
10#file=Dataset(filename,mode='r')
11#topo=file.variables['RELIEF'][:]
12
13#res=len(topo)
14res=180
15#topo=topo*1. + 9000.
16topo=0
17topo=topo + 9000.
18
19part2b=[]
20partb=[]
21for 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')
35f = open('00181-00360.00001-00180', 'wb')
36f.write(np.array(part2b))
37        # Western part
38#f = open('00001-00res.00001-00res','wb')
39f = open('00001-00180.00001-00180','wb')
40f.write(np.array(partb))
Note: See TracBrowser for help on using the repository browser.