Commit fa765c9d authored by saeed's avatar saeed
Browse files

multiple file is added

parent 5937842e
......@@ -55,7 +55,7 @@ struct stn_set{
};
static struct station *stns;
static struct stn_set stns_set;
static struct stn_set stn_set;
struct odbinfo{
char *filename;
......@@ -68,13 +68,13 @@ struct odbinfo{
char *group;
};
static struct odbinfo odbinfo = {NULL,{'\0'},{'\0'},{'\0'},{'\0'},{'\0'},NULL,NULL};
struct odbinfo_set{
struct odbinfo **odb_set;
int icur;
int nt;
};
static struct odbinfo odbinfo = {NULL,{'\0'},{'\0'},{'\0'},{'\0'},{'\0'},NULL,NULL};
static struct odbinfo_set odbinfo_set;
struct Vis{
......@@ -122,6 +122,14 @@ struct obs{
int npy;
};
struct obs_set{
struct obs **obs;
int icur;
int nt;
};
static struct obs_set obs_set;
struct mousepose{
int x;
int y;
......@@ -148,59 +156,13 @@ struct Index {
#include"util.c"
#include"renderer.c"
#include"renderer_thread.c"
#include"run_main.c"
int main(int argc, char *argv[]){
if (argc == 1){
printf("\nUsage %s odb_file\n\n",argv[0]);
}
if (argc == 2){
int width = WIDTH_INIT;
int height = HEIGHT_INIT;
int ncolor = 0;
int status = run_view(argc,argv);
land_color = landcolor;
ocean_color = oceancolor;
stn_color = stncolor;
if (usesrgb) land_color = lineartosrgbi(landcolor);
if (usesrgb) ocean_color = lineartosrgbi(oceancolor);
if (usesrgb) stn_color = lineartosrgbi(stncolor);
struct screen_dim scdim = {0,0,0};
scdim.width = width;
scdim.height = height;
scdim.symbol_radius = SYM_SIZE;
struct Colort *scolor = NULL;
get2dfield_binary("landseamask.bin",&FLD);
struct Vis visu = init_x(width,height);
struct dsp_field dspf = adjusttowindowsize(&visu, &FLD);
stns = getstn(argv[1],&odbinfo);
width = WIDTH_TR1;
height = HEIGHT_TR1;
struct Vis visu_1 = init_x(width,height);
map_window(&visu_1);
map_window(&visu);
movewindow(&visu,(int)(WIDTH_TR1*1.01),0);
pthread_t thread_id[NUM_THREADS];
for (int i=0; i < NUM_THREADS;++i){
pthread_create(&thread_id[i], NULL, handle_event_thread, (void *)&visu_1);
}
handle_event(&visu,&visu_1,&dspf,scolor,ncolor,&scdim);
}
return 0;
return status;
}
......
......@@ -172,6 +172,8 @@ static void getdescandgroup(struct odbinfo *odbinfo){
}
}
}
static struct station *getstn(char *filename, struct odbinfo *odbinfo){
......@@ -219,6 +221,27 @@ static struct station *getstn(char *filename, struct odbinfo *odbinfo){
return result;
}
static struct stn_set getstn_set(int argc, char *argv[], struct odbinfo_set *odbinfo_set){
struct stn_set result = {NULL,0,0};
int nf = 0;
if (argc > 1){
result.nt = argc -1;
result.stns = (struct station **)malloc(sizeof(struct station *) * result.nt);
odbinfo_set->odb_set = (struct odbinfo **)malloc(sizeof(struct odbinfo *) * result.nt);
if (result.stns && odbinfo_set->odb_set){
for (int i=1; i< result.nt;++i){
*(odbinfo_set->odb_set + nf) = (struct odbinfo *)malloc(sizeof(struct odbinfo ));
*(result.stns + nf ) = getstn(argv[i], *(odbinfo_set->odb_set + nf));
nf++;
}
}
}
return result;
}
static struct obs fill_obs(float *lonm, float *latm, int nx, int ny){
struct obs result = {NULL,NULL,stns->ns,stns->ns};
......@@ -244,6 +267,42 @@ static struct obs fill_obs(float *lonm, float *latm, int nx, int ny){
return result;
}
static struct obs_set fill_obs_set(float *lonm, float *latm, int nx, int ny){
struct obs_set result = {NULL,0,stn_set.nt};
result.obs = (struct obs **)malloc(sizeof(struct obs *) *stn_set.nt );
if (result.obs){
for (int k=0; k < stn_set.nt;++k){
result.obs[k] = (struct obs *)malloc(sizeof(struct obs));
result.obs[k]->iindex = (int *)malloc(sizeof(int) * stn_set.stns[k]->ns);
result.obs[k]->jindex = (int *)malloc(sizeof(int) *stn_set.stns[k]->ns);
int im = -1;
for (int i=0; i < stn_set.stns[k]->ns;++i){
im = -1;
for(int j=0; j < ny;++j){
if (stn_set.stns[k]->lat >= latm[j]) im = j;
}
result.obs[k]->jindex[i] = im;
}
for (int i=0; i <stn_set.stns[k]->ns;++i){
im = -1;
for(int j=0; j < nx;++j){
if (stn_set.stns[k]->lon >= lonm[j]) im = j;
}
result.obs[k]->iindex[i] = im;
}
}
}
return result;
}
static struct Index map(int i, int j, int w, int h, int nx, int ny){
struct Index result = {0,0};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment