-
Notifications
You must be signed in to change notification settings - Fork 0
/
turn2geodata.py
35 lines (34 loc) · 1.25 KB
/
turn2geodata.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
#!/usr/bin/env python
"""
Created on Tue Apr 14 18:06:56 2015
@author: John Swoboda
"""
import os, glob
from SimISR.IonoContainer import IonoContainer
from GeoData.GeoData import GeoData
from GeoData.utilityfuncs import readIono
if __name__ == "__main__":
inputdir = '/Users/Bodangles/Documents/Python/PhantomProc/Origparams'
outdir = '/Users/Bodangles/Documents/MATLAB/phantoms/Origparams'
dirlist = glob.glob(os.path.join(inputdir,'*.mat'))
keep = ['Ne','Te','Ti']
for ifile in dirlist:
Ionoin=IonoContainer.readmat(ifile)
GD = GeoData(readIono,[Ionoin])
for ikey in GD.data.keys():
if ikey not in keep:
del GD.data[ikey]
fname = os.path.splitext(os.path.split(ifile)[1])[0]
GD.write_h5(os.path.join(outdir,fname+'.h5'))
print('Saved '+os.path.join(outdir,fname+'.h5'))
def fit2geodata(inputfile):
Ionoin=IonoContainer.readh5(inputfile)
keep = ['Ne','Te','Ti']
GD=GeoData(readIono,[Ionoin])
for ikey in GD.data.keys():
if ikey not in keep:
del GD.data[ikey]
indir,fnameall=os.path.split(inputfile)
fname = os.path.splitext(fnameall)[0]
GD.write_h5(os.path.join(indir,fname+'GEOD.h5'))
print('Saved '+os.path.join(indir,fname+'.h5'))