/********************************************************************/ /* A short demo program demonstrating the use of K_index.h file */ /* This program assumes that the data file is named as 'demo.dat' */ /* and is located in the same directory as the program itself. */ /* The computed K indices and Ak value should be: */ /* 1 1 1 2 3 3 5 3 14 */ /********************************************************************/ #include #include "K_index.h" #define SampleStep 60 /* Interval between data points in seconds */ #define Size 3*24*3600/SampleStep /* Size of data arrays */ #define Longitude 27 /* Longitude of the observatory */ #define K9limit 7500 /* K=9 limit, here 750 nT */ #define MissingData 999999 /* Marker for missing data point */ int main() { long i; /* Dummy index */ FILE *DataFile; /* File variable */ char *FileName = "demo.dat"; /* In real life one should read */ /* this from command line or ask user */ /* In Unix one could also use 'stdin' */ long X[Size]; /* Array for X component data */ long Y[Size]; /* Array for Y component data */ long K_array[8]; /* Computed K indices */ /* Read the data into the X and Y arrays */ if ((DataFile = fopen(FileName,"r")) == NULL) return(1); for (i=0;i