-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_adams_data.m
106 lines (93 loc) · 2.98 KB
/
get_adams_data.m
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function [tcme,tcmp]= get_adams_data(oblateness_factor,data_directory,suffix)
%oblateness factor==ratio of polar to equatorial radius.
%data directory==relative path name where the data is stored
%suffix==filename.* where * is the suffix ie (mixrat.jup_test suffix=jup_test)
name=strcat(data_directory,'/mixrat.',suffix);
file_handle=fopen(name,'r');
oblateness_factor
%skip over the header
buffer_line1=fgetl(file_handle);
buffer_line2=fgetl(file_handle);
buffer_line3=fgetl(file_handle);
buffer_line4=fgetl(file_handle);
buffer_line5=fgetl(file_handle);
buffer_line6=fgetl(file_handle);
buffer_line7=fgetl(file_handle);
%read the data file 7c used to get rid of garbage fortran output
raw_data=fscanf(file_handle,'%f %7c %f %f %f %f %f %f %f %f %f %f %f %f %f ',[21 inf]);
raw_data=raw_data';
fclose(file_handle);
%filter out garbage Temperature output
data=[raw_data(:,1),zeros(length(raw_data),1),raw_data(:,9:21)];
z=data(:,1);
%pressure=data(:,3);
XH2O=data(:,4);
%DH2O=data(:,5);
XNH3=data(:,6);
%DNH3=data(:,7);
XH2S=data(:,8);
%DH2S=data(:,9);
XCH4=data(:,10);
%DCH4=data(:,11);
XAr=data(:,12);
DAr=data(:,13);
XPH3=data(:,14);
%DPH3=data(:,15);
%Now get pressure and Temperature from initial model input file (need to
%for precision, and garbage fortran output in Temperature.
name2=strcat(data_directory,'/model.',suffix);
file_handle=fopen(name2,'r');
%Skip header
buffer_line1=fgetl(file_handle);
buffer_line2=fgetl(file_handle);
%read file
raw_data2=fscanf(file_handle,'%f %f %f %f %f %f %f %f %f %f',[10 inf]);
raw_data2=raw_data2';
fclose(file_handle);
temperature=raw_data2(:,3);
pressure=raw_data2(:,4);
XH2=raw_data2(:,5);
XHe=raw_data2(:,6);
zpp=oblateness_factor*z;
%flag to indicate "1 bar" pressure level has been found
located=0;
for ii=1:length(z)
if(located==0)
if((pressure(ii)-1.0)< 0.01)
ze_offset=z(ii);
zp_offset=zpp(ii);
pressure(ii)-1.0
located=1;
end
end
end
for ii=1:length(z)
ze(ii)=z(ii)-ze_offset;
zp(ii)=zpp(ii)-zp_offset;
end
%Now get cloud properties
name3=strcat(data_directory,'/cldden.',suffix);
file_handle=fopen(name3,'r');
%
buffer_line1=fgetl(file_handle);
buffer_line2=fgetl(file_handle);
buffer_line3=fgetl(file_handle);
buffer_line4=fgetl(file_handle);
buffer_line5=fgetl(file_handle);
buffer_line6=fgetl(file_handle);
buffer_line7=fgetl(file_handle);
raw_data3=fscanf(file_handle,'%f %f %f %f %f %f %f %f',[8 inf]);
raw_data3=raw_data3';
fclose(file_handle);
DSOL=raw_data3(:,4);
DH2O=raw_data3(:,5);
DNH4SH=raw_data3(:,6);
DNH3=raw_data3(:,7);
DH2S=raw_data3(:,8);
blank_col=zeros(length(raw_data),1);
tcme=[pressure,temperature,ze',XH2,XHe,XH2S,XNH3,XH2O,XCH4,XPH3,blank_col,DNH4SH,DH2S,DNH3,DH2O,blank_col,blank_col,DSOL,blank_col,blank_col,blank_col,blank_col];
tcmp=[pressure,temperature,zp',XH2,XHe,XH2S,XNH3,XH2O,XCH4,XPH3,blank_col,DNH4SH,DH2S,DNH3,DH2O,blank_col,blank_col,DSOL,blank_col,blank_col,blank_col,blank_col];
size(tcme)
size(tcmp)
%tcme=tcme(75:486,:)
%tcmp=tcmp(75:486,:)