#include <iostream>
#include <stdio.h>
#include <string.h>
#include "ibldl1.h"
#include "nrlin1.h"
int main()
{
//double ir[]={};
//our variables
double al,p1;
int M,N,Nsred,k;
char *s1,*s2,*ss;
FILE *ff;
//Assign the constant part of the filename to the string
s1="CAR1837_Ch1 _";
//Assign wavelenth (could be a cycle)
al=0.340;
//put in to the memory string s2 for the filename
s2 = new char[60];
//
sprintf(s2,"%s% 5.3lf_extract", s1,al);
//printf("%s\n",s 2);
//opening file
ff=fopen(s2,"rt ");
if(ff==NULL) {printf("Cannot open file %s\n"); goto m1;}
//putting in memory the string ss for reading
ss = new char[200];
//skipping 2 rows
fgets(ss,199,ff );
fgets(ss,199,ff );
//reading the next one
fgets(ss,199,ff );
int i;
for (i=1;i<171;i++)
{
int n=1;
for (i=1;i<6;i++)
{
/* ir[i]=ir[i]+ss[i]; */
}
printf("%s\n",s s[i]);
}
printf("%s\n",s s);
//deleting the spaces
ibldl1(ss);
//reading the fifth value
p1=drlin1(ss,5) ;
printf("%lf\n", p1);
//reading the sixth value
p1=drlin1(ss,6) ;
//reading the next row
fgets(ss,199,ff );
ibldl1(ss);
//First value (blue)
p1=drlin1(ss,1) ;
// and etc
//closing file
fclose(ff);
//releasing the memory
delete s2; delete ss;
m1: ;
//system("PAUSE") ;
return 0;
}
the file type looks as below
utctime Aircraft_lat Aircraft_lon Aircraft_headin g SolarZenith SolarAzimuth Aircraft_alt CAR radiance in reflectance Units (in 1degree interval from 0-180)
90600.1 -21.73304 13.70252 335.27869 37.59740 51.64328 799.2631 0.34641710 0.36110711 0.37472874 0.38434401 0.39609602 0.40010238 0.41132021 0.42093548 0.43161914 0.44657621 0.45405477 0.46527258 0.48450315 0.50159699 0.50667173 0.52884030 0.54833794 0.56489754 0.57371157 0.59828389 0.61858284 0.64262104 0.65998197 0.68134922 0.70805836 0.73343199 0.75479925 0.78391224 0.81168973 0.83866590 0.87018263 0.89876139 0.93909210 0.97327977 1.00853586 1.05607808 1.11376965 1.17867279 1.26280653 1.38646960 1.54725838 1.77081358 2.09613061 2.40328526 2.48261118 2.23955846 1.90622878 1.65436196 1.48075283 1.35388446 1.26387477 1.19282854 1.13620532 1.08599210 1.05607808 1.01921940 0.99170905 0.96713668 0.94309849 0.91825902 0.88887900 0.86991554 0.85976607 0.83412534 0.80955297 0.79352748 0.77750206 0.75800443 0.73530161 0.72274840 0.71233183 0.69684058 0.67467201 0.66078323 0.65704399 0.63808048 0.61991835 0.61430937 0.60282445 0.59080535 0.57504702 0.55982286 0.55688483 0.54940629 0.53444922 0.53204536 0.51869082 0.51014394 0.49251589 0.48610568 0.47088152 0.46553969 0.45485604 0.45806116 0.46233457 0.44737750 0.48984498 0.50159699 0.49224880 0.50587046 0.46687514 0.45111677 0.46580678 0.46073204 0.45672569 0.43989894 0.45111677 0.45378768 0.46260169 0.47328532 0.44657621 0.43348879 0.44711041 0.44657621 0.44737750 0.43322167 0.43055078 0.43963185 0.42948240 0.42654440 0.41425821 0.40811512 0.41132021 0.41238856 0.43135205 0.42414057 0.42387348 0.41906583 0.41960004 0.42707857 0.41826457 0.40731385 0.40304038 0.40304038 0.40731385 0.39636311 0.39208966 0.38781619 0.37125656 0.37232494 0.35362855 0.36110711 0.35683364 0.34321201 0.35309437 0.34160945 0.33840436 0.33680180 0.32638526 0.32585105 0.31249651 0.31623578 0.32184473 0.32131052 0.33519927 0.32611817 0.32451561 0.33252835 0.34054109 0.34641710 0.34534872 0.34561583 0.34267780 0.34374616 0.34454745 0.33706889 0.32718652 0.32291305 0.31623578 0.32558399 0.31917378 0.32024217 0.32344726 0.31436616 0.32504979 0.31516743 0.31062689 0.30982563 0.30715469 0.30154580 0.30448380 0.30261415
90600.7 -21.73304 13.70252 335.04456 37.59740 51.64328 799.2631 0.34775254 0.36324382 0.38007057 0.38567948 0.39556184 0.40384167 0.42307222 0.42440766 0.43562552 0.44737750 0.46046495 0.47675753 0.48904368 0.50079572 0.52510101 0.54005808 0.54726952 0.56836975 0.58733320 0.61163849 0.62926650 0.64716160 0.67280233 0.69710767 0.72408384 0.74384856 0.77830327 0.79940349 0.82157207 0.85282171 0.89021444 0.92146409 0.95378214 0.98316216 1.03150558 1.08545804 1.12899387 1.21205926 1.31195116 1.44843471 1.62791991 1.91076934 2.29431224 2.61588979 2.59692645 2.26600051 1.90970099 1.64260995 1.46793234 1.35415161 1.25666344 1.18134367 1.13219893 1.09106696 1.04592860 1.01174092 0.98850393 0.96419871 0.93748957 0.91451979 0.89341950 0.87445611 0.85015076 0.82504427 0.80661494 0.79432875 0.77563238 0.75159419 0.73102814 0.72301543 0.70378488 0.68428725 0.67387068 0.66639215 0.64342237 0.62819809 0.62739688 0.60549539 0.59320921 0.57932049 0.57745081 0.56890392 0.54913914 0.53765428 0.53444922 0.52536809 0.51067805 0.50373369 0.49198169 0.48744115 0.47008026 0.45832825 0.45806116 0.45806116 0.44711041 0.44791168 0.50106281 0.49438551 0.49465263 0.49251589 0.45832825 0.45912951 0.46500552 0.45271930 0.46180043 0.45672569 0.45512316 0.46553969 0.46447131 0.46206751 0.44550788 0.43348879 0.43829641 0.44791168 0.44684333 0.44096732 0.44657621 0.43615967 0.42814696 0.42921531 0.42894822 0.42040130 0.41986710 0.40758094 0.40651256 0.39449346 0.38327563 0.38274148 0.38835037 0.39395931 0.38300857 0.37713256 0.37098947 0.37633127 0.37686548 0.37846801 0.37953636 0.37446162 0.36992109 0.36618182 0.35683364 0.35389563 0.34641710 0.33306253 0.31863964 0.31196237 0.31356490 0.30368251 0.30368251 0.30234706 0.29059505 0.29246467 0.29086214 0.29780653 0.29727232 0.30181289 0.31142816 0.30768889 0.31676999 0.33733600 0.32985744 0.32959035 0.32772073 0.32104343 0.31303069 0.31035978 0.32104343 0.31276363 0.31703705 0.30902436 0.31516743 0.33706889 0.33787015 0.33439800 0.33413088 0.34401327 0.34267780 0.33867145 0.34027401 0.34080815 0.33947274 0.35149184
90601.3 -21.73304 13.70252 334.82599 37.59436 51.63861 799.2631 0.34827253 0.36643401 0.37524766 0.39047122 0.39981902 0.40756434 0.41664505 0.42652702 0.44362015 0.44548973 0.45697415 0.47673810 0.48822254 0.50024116 0.51973802 0.53416032 0.55339009 0.57261986 0.58463848 0.61294895 0.62790549 0.64740229 0.67010415 0.70001715 0.71817857 0.74061334 0.76812255 0.80017221 0.82047027 0.85519069 0.88537073 0.93024021 0.95561284 0.98979908 1.03733933 1.09315920 1.14657521 1.22937000 1.33326411 1.46707129 1.66364241 1.96971631 2.39651036 2.81529212 2.83104992 2.43657255 2.01511979 1.70023227 1.50526381 1.37305915 1.26943207 1.19732046 1.13375533 1.09182370 1.05282998 1.01944506 0.99300402 0.96282399 0.94225883 0.92115951 0.88323414 0.86854470 0.84931493 0.82634604 0.81245786 0.78975606 0.77239585 0.75663811 0.73901081 0.72138351 0.70696121 0.69093645 0.67624700 0.66823459 0.64847064 0.63084334 0.62256390 0.61909181 0.59906083 0.58624095 0.57261986 0.56968200 0.55766338 0.53629696 0.53602993 0.52881873 0.51386225 0.50424737 0.49730328 0.48528466 0.47059524 0.46231577 0.46017915 0.45563877 0.45189965 0.44655803 0.48394924 0.50050825 0.49676913 0.49997407 0.47006109 0.45457044 0.46231577 0.45350215 0.45884374 0.46658906 0.45804250 0.46258286 0.46151453 0.45777541 0.45483753 0.44842762 0.45537168 0.45964497 0.44842762 0.44362015 0.43774438 0.43507361 0.42999908 0.43480650 0.43053323 0.42625993 0.41664505 0.41424134 0.41477552 0.41263887 0.41370717 0.40062025 0.39875069 0.38406128 0.37551472 0.36403024 0.35975701 0.35788742 0.35815451 0.34907377 0.34426633 0.34880671 0.34426633 0.34853962 0.35174459 0.34934086 0.34453341 0.34533465 0.33358315 0.33358315 0.33331603 0.33839056 0.34960794 0.34026015 0.33999306 0.34132844 0.34453341 0.34266385 0.33999306 0.33892474 0.34026015 0.33865765 0.34693715 0.33491853 0.34079430 0.33278191 0.32877567 0.34186262 0.33545268 0.32770738 0.32637197 0.32610491 0.32930985 0.32583779 0.32930985 0.32984403 0.33304897 0.34453341 0.33438438 0.33491853 0.33839056 0.33518562 0.34266385 0.33678809 0.34159553 0.33945891
Thanks in advance,
Jeff
#include <stdio.h>
#include <string.h>
#include "ibldl1.h"
#include "nrlin1.h"
int main()
{
//double ir[]={};
//our variables
double al,p1;
int M,N,Nsred,k;
char *s1,*s2,*ss;
FILE *ff;
//Assign the constant part of the filename to the string
s1="CAR1837_Ch1 _";
//Assign wavelenth (could be a cycle)
al=0.340;
//put in to the memory string s2 for the filename
s2 = new char[60];
//
sprintf(s2,"%s% 5.3lf_extract", s1,al);
//printf("%s\n",s 2);
//opening file
ff=fopen(s2,"rt ");
if(ff==NULL) {printf("Cannot open file %s\n"); goto m1;}
//putting in memory the string ss for reading
ss = new char[200];
//skipping 2 rows
fgets(ss,199,ff );
fgets(ss,199,ff );
//reading the next one
fgets(ss,199,ff );
int i;
for (i=1;i<171;i++)
{
int n=1;
for (i=1;i<6;i++)
{
/* ir[i]=ir[i]+ss[i]; */
}
printf("%s\n",s s[i]);
}
printf("%s\n",s s);
//deleting the spaces
ibldl1(ss);
//reading the fifth value
p1=drlin1(ss,5) ;
printf("%lf\n", p1);
//reading the sixth value
p1=drlin1(ss,6) ;
//reading the next row
fgets(ss,199,ff );
ibldl1(ss);
//First value (blue)
p1=drlin1(ss,1) ;
// and etc
//closing file
fclose(ff);
//releasing the memory
delete s2; delete ss;
m1: ;
//system("PAUSE") ;
return 0;
}
the file type looks as below
utctime Aircraft_lat Aircraft_lon Aircraft_headin g SolarZenith SolarAzimuth Aircraft_alt CAR radiance in reflectance Units (in 1degree interval from 0-180)
90600.1 -21.73304 13.70252 335.27869 37.59740 51.64328 799.2631 0.34641710 0.36110711 0.37472874 0.38434401 0.39609602 0.40010238 0.41132021 0.42093548 0.43161914 0.44657621 0.45405477 0.46527258 0.48450315 0.50159699 0.50667173 0.52884030 0.54833794 0.56489754 0.57371157 0.59828389 0.61858284 0.64262104 0.65998197 0.68134922 0.70805836 0.73343199 0.75479925 0.78391224 0.81168973 0.83866590 0.87018263 0.89876139 0.93909210 0.97327977 1.00853586 1.05607808 1.11376965 1.17867279 1.26280653 1.38646960 1.54725838 1.77081358 2.09613061 2.40328526 2.48261118 2.23955846 1.90622878 1.65436196 1.48075283 1.35388446 1.26387477 1.19282854 1.13620532 1.08599210 1.05607808 1.01921940 0.99170905 0.96713668 0.94309849 0.91825902 0.88887900 0.86991554 0.85976607 0.83412534 0.80955297 0.79352748 0.77750206 0.75800443 0.73530161 0.72274840 0.71233183 0.69684058 0.67467201 0.66078323 0.65704399 0.63808048 0.61991835 0.61430937 0.60282445 0.59080535 0.57504702 0.55982286 0.55688483 0.54940629 0.53444922 0.53204536 0.51869082 0.51014394 0.49251589 0.48610568 0.47088152 0.46553969 0.45485604 0.45806116 0.46233457 0.44737750 0.48984498 0.50159699 0.49224880 0.50587046 0.46687514 0.45111677 0.46580678 0.46073204 0.45672569 0.43989894 0.45111677 0.45378768 0.46260169 0.47328532 0.44657621 0.43348879 0.44711041 0.44657621 0.44737750 0.43322167 0.43055078 0.43963185 0.42948240 0.42654440 0.41425821 0.40811512 0.41132021 0.41238856 0.43135205 0.42414057 0.42387348 0.41906583 0.41960004 0.42707857 0.41826457 0.40731385 0.40304038 0.40304038 0.40731385 0.39636311 0.39208966 0.38781619 0.37125656 0.37232494 0.35362855 0.36110711 0.35683364 0.34321201 0.35309437 0.34160945 0.33840436 0.33680180 0.32638526 0.32585105 0.31249651 0.31623578 0.32184473 0.32131052 0.33519927 0.32611817 0.32451561 0.33252835 0.34054109 0.34641710 0.34534872 0.34561583 0.34267780 0.34374616 0.34454745 0.33706889 0.32718652 0.32291305 0.31623578 0.32558399 0.31917378 0.32024217 0.32344726 0.31436616 0.32504979 0.31516743 0.31062689 0.30982563 0.30715469 0.30154580 0.30448380 0.30261415
90600.7 -21.73304 13.70252 335.04456 37.59740 51.64328 799.2631 0.34775254 0.36324382 0.38007057 0.38567948 0.39556184 0.40384167 0.42307222 0.42440766 0.43562552 0.44737750 0.46046495 0.47675753 0.48904368 0.50079572 0.52510101 0.54005808 0.54726952 0.56836975 0.58733320 0.61163849 0.62926650 0.64716160 0.67280233 0.69710767 0.72408384 0.74384856 0.77830327 0.79940349 0.82157207 0.85282171 0.89021444 0.92146409 0.95378214 0.98316216 1.03150558 1.08545804 1.12899387 1.21205926 1.31195116 1.44843471 1.62791991 1.91076934 2.29431224 2.61588979 2.59692645 2.26600051 1.90970099 1.64260995 1.46793234 1.35415161 1.25666344 1.18134367 1.13219893 1.09106696 1.04592860 1.01174092 0.98850393 0.96419871 0.93748957 0.91451979 0.89341950 0.87445611 0.85015076 0.82504427 0.80661494 0.79432875 0.77563238 0.75159419 0.73102814 0.72301543 0.70378488 0.68428725 0.67387068 0.66639215 0.64342237 0.62819809 0.62739688 0.60549539 0.59320921 0.57932049 0.57745081 0.56890392 0.54913914 0.53765428 0.53444922 0.52536809 0.51067805 0.50373369 0.49198169 0.48744115 0.47008026 0.45832825 0.45806116 0.45806116 0.44711041 0.44791168 0.50106281 0.49438551 0.49465263 0.49251589 0.45832825 0.45912951 0.46500552 0.45271930 0.46180043 0.45672569 0.45512316 0.46553969 0.46447131 0.46206751 0.44550788 0.43348879 0.43829641 0.44791168 0.44684333 0.44096732 0.44657621 0.43615967 0.42814696 0.42921531 0.42894822 0.42040130 0.41986710 0.40758094 0.40651256 0.39449346 0.38327563 0.38274148 0.38835037 0.39395931 0.38300857 0.37713256 0.37098947 0.37633127 0.37686548 0.37846801 0.37953636 0.37446162 0.36992109 0.36618182 0.35683364 0.35389563 0.34641710 0.33306253 0.31863964 0.31196237 0.31356490 0.30368251 0.30368251 0.30234706 0.29059505 0.29246467 0.29086214 0.29780653 0.29727232 0.30181289 0.31142816 0.30768889 0.31676999 0.33733600 0.32985744 0.32959035 0.32772073 0.32104343 0.31303069 0.31035978 0.32104343 0.31276363 0.31703705 0.30902436 0.31516743 0.33706889 0.33787015 0.33439800 0.33413088 0.34401327 0.34267780 0.33867145 0.34027401 0.34080815 0.33947274 0.35149184
90601.3 -21.73304 13.70252 334.82599 37.59436 51.63861 799.2631 0.34827253 0.36643401 0.37524766 0.39047122 0.39981902 0.40756434 0.41664505 0.42652702 0.44362015 0.44548973 0.45697415 0.47673810 0.48822254 0.50024116 0.51973802 0.53416032 0.55339009 0.57261986 0.58463848 0.61294895 0.62790549 0.64740229 0.67010415 0.70001715 0.71817857 0.74061334 0.76812255 0.80017221 0.82047027 0.85519069 0.88537073 0.93024021 0.95561284 0.98979908 1.03733933 1.09315920 1.14657521 1.22937000 1.33326411 1.46707129 1.66364241 1.96971631 2.39651036 2.81529212 2.83104992 2.43657255 2.01511979 1.70023227 1.50526381 1.37305915 1.26943207 1.19732046 1.13375533 1.09182370 1.05282998 1.01944506 0.99300402 0.96282399 0.94225883 0.92115951 0.88323414 0.86854470 0.84931493 0.82634604 0.81245786 0.78975606 0.77239585 0.75663811 0.73901081 0.72138351 0.70696121 0.69093645 0.67624700 0.66823459 0.64847064 0.63084334 0.62256390 0.61909181 0.59906083 0.58624095 0.57261986 0.56968200 0.55766338 0.53629696 0.53602993 0.52881873 0.51386225 0.50424737 0.49730328 0.48528466 0.47059524 0.46231577 0.46017915 0.45563877 0.45189965 0.44655803 0.48394924 0.50050825 0.49676913 0.49997407 0.47006109 0.45457044 0.46231577 0.45350215 0.45884374 0.46658906 0.45804250 0.46258286 0.46151453 0.45777541 0.45483753 0.44842762 0.45537168 0.45964497 0.44842762 0.44362015 0.43774438 0.43507361 0.42999908 0.43480650 0.43053323 0.42625993 0.41664505 0.41424134 0.41477552 0.41263887 0.41370717 0.40062025 0.39875069 0.38406128 0.37551472 0.36403024 0.35975701 0.35788742 0.35815451 0.34907377 0.34426633 0.34880671 0.34426633 0.34853962 0.35174459 0.34934086 0.34453341 0.34533465 0.33358315 0.33358315 0.33331603 0.33839056 0.34960794 0.34026015 0.33999306 0.34132844 0.34453341 0.34266385 0.33999306 0.33892474 0.34026015 0.33865765 0.34693715 0.33491853 0.34079430 0.33278191 0.32877567 0.34186262 0.33545268 0.32770738 0.32637197 0.32610491 0.32930985 0.32583779 0.32930985 0.32984403 0.33304897 0.34453341 0.33438438 0.33491853 0.33839056 0.33518562 0.34266385 0.33678809 0.34159553 0.33945891
Thanks in advance,
Jeff