| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| struct motiv{ | |
| char name[4]; | |
| int found; | |
| }motives[64]; | |
| int maximum[5]; | |
| char sequence[15]; | |
| double counter=0,natural_count[64]; | |
| int get_counting(char mot[],char *filename) | |
| { | |
| char temp[4],ch; | |
| int counting=0; | |
| FILE *stream; | |
| stream=fopen(filename,"r+"); | |
| if(stream == NULL) | |
| { | |
| printf("can not open the file %s.",filename); | |
| getchar(); | |
| exit(0); | |
| } | |
| do | |
| { | |
| /* read a char from the file */ | |
| ch = fgetc(stream); | |
| temp[0] = ch; | |
| ch = fgetc(stream); | |
| temp[1] = ch; | |
| ch = fgetc(stream); | |
| temp[2] = ch; | |
| temp[3] = '\0'; | |
| if(temp[0] == mot[0] && temp[1] == mot[1] && temp[2] == mot[2]) | |
| { | |
| counting=counting+1; | |
| } | |
| } while (ch != EOF); | |
| fclose(stream); | |
| return counting; | |
| } | |
| int count_motives(char *filename) | |
| { | |
| int count =0,i,j=0,sum=0; | |
| int qinput[5]={}; | |
| for (i=0;i<15;i = i + 3) | |
| { | |
| motives[count].name[0] = sequence[i]; | |
| motives[count].name[1] = sequence[i+1] ; | |
| motives[count].name[2] = sequence[i+2] ; | |
| motives[count].name[3] = '\0' ; | |
| motives[count].found = get_counting(motives[count].name,filename); | |
| //printf("\n\n\tThe pattern %s has %d number of occurence",motives[count].name,motives[count].found); | |
| qinput[j]=motives[count].found; | |
| j++; | |
| } | |
| for (j=0;j<5;j++) | |
| { | |
| sum = sum+qinput[j]; | |
| } | |
| //printf("Qoutput is %d.\n",sum); | |
| return sum; | |
| } | |
| int calculate_q(char *filename) | |
| { | |
| char temp[1],ch; | |
| int qinput=0; | |
| FILE *stream; | |
| stream=fopen(filename,"r+"); | |
| if(stream == NULL) | |
| { | |
| printf("can not open the file %s.",filename); | |
| getchar(); | |
| exit(0); | |
| } | |
| while (ch != EOF) | |
| { | |
| ch = fgetc(stream); | |
| temp[0] = ch; | |
| qinput=qinput+1; | |
| } | |
| fclose(stream); | |
| qinput=qinput-1; | |
| //printf("\nQinput is %d.\n",qinput); | |
| return qinput; | |
| } | |
| int enthropy(char *filename) | |
| { | |
| float x=0,y=0,en=0; | |
| x=(float)(calculate_q(filename)); | |
| y=(float)(count_motives(filename)); | |
| en=1-(y/x); | |
| printf("\n\n\t| %12s | %d | %6d | %f |\n",filename,calculate_q(filename),count_motives(filename),en); | |
| } |
In our solution SPOTFIRE we attempt to predict trees that are heating up from their lower band infra-red emission detected by NASA Earth Data satellites. We Begin by zoming on the Sumatran Forest that is prone to forest fire. From the lower band infra-red colour on the NASA Earth Data SPOTFIRE will the tree species that will catch fire. The genetic codes of the tree species will be used as input to the SPOTFIRE which may predict the tree species to be on fire.
The trees have feelings. They may speak out their feelings in their own language. The language that we are plan to understand will be the signal from the genetic code. It is assume when ever human activities happen around the tree the life code will generate our message. Our solution will be to understand this message by determining the depressed message from the tree. This solution can be use by individual in the the local community to understand the depressed signal from the tree that expressed their feeling of a fire that will happen. This is similar to mangrove tree that view a tsunami will happen even a several hour before it hit them. Our solution will suggest the NASA Earth Data must include the life code of this tree, so that the user can download the NASA Earth Data for this solution that will generate message from the trees to warn of upcoming fire.