Changeset 8
- Timestamp:
- 03/10/11 16:51:28 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/meshmask.h
r7 r8 95 95 int neuler=0; //restart file 96 96 97 int nyear=1; // current year 98 int nmonth=1; //current month of the year nyear 99 int nday=1; //current day of the year nyear 100 double ndastp=nyear*10000 + nmonth*100 + nday; //date at the end of the current (previous) run 101 double adatrj=0; //date in days since the beginning of the run 102 double kt=0; //ocean time step 103 104 97 105 # define ze1ur(i,j) e2u(i,j) / e1u(i,j) 98 106 # define ze2vr(i,j) e1v(i,j) / e2v(i,j) … … 208 216 gdepw_0_id=Var_id(mesh_mask_file_id,"gdepw_0"); 209 217 zonclire(0, NZ, mesh_mask_file_id, gdepw_0_id,gdepw_0); 210 218 219 211 220 //gdept_0 212 221 nc_close( mesh_mask_file_id); … … 372 381 YS_gcx2(0,i,j,TU-1)=temp[(j)*(NX)+(i)]; 373 382 } 383 // ndastp 384 temp_id=Var_id(rest_file_id,"ndastp"); 385 scalarlire(rest_file_id,temp_id,&ndastp); 386 387 //adatrj 388 temp_id=Var_id(rest_file_id,"adatrj"); 389 scalarlire(rest_file_id,temp_id,&adatrj); 390 391 //kt 392 temp_id=Var_id(rest_file_id,"kt"); 393 scalarlire(rest_file_id,temp_id,&kt); 394 374 395 } 375 396 … … 412 433 zncwrite(NZ,"nav_lev",ncid,dimids,vect); 413 434 435 //time_counter 436 twrite(0,"time_counter",ncid,dimids[0],kt); 437 438 414 439 //gcx 415 440 for(int j=0;j<NY;j++) … … 440 465 soncwrite(0,NY,NX,"sshn",ncid,dimids,vect); 441 466 467 //rdt 468 scalarwrite(ncid,"rdt",rdt); 469 470 //rdttra1 471 scalarwrite(ncid,"rdttra1",rdt); 472 442 473 //ub 443 474 for(int k=0;k<NZ;k++) … … 535 566 } 536 567 voncwrite(0,NZ,NY,NX,"hdivn",ncid,dimids,vect); 568 569 //kt 570 scalarwrite(ncid,"kt",kt); 571 572 //ndastp 573 scalarwrite(ncid,"ndastp",ndastp); 574 575 //adatrk 576 scalarwrite(ncid,"adatrj",adatrj); 537 577 538 578 -
trunk/include/ncutil.cpp
r7 r8 51 51 } 52 52 53 void twrite(int t, char *var_name,int ncid,int tid,int var) 54 { 55 //Ecrire un scalaire au temps t 56 //le parametre t commence de 0. 57 // ecrit la variable var_name au point (t) 58 int status; 59 60 int var_id; 61 static size_t start[] = {0}; //3D+t 62 static size_t count[] = {1}; //3D+t 63 count[0]= (size_t) t+1; 64 start[0]=t; //temps commence de 0; 65 66 //Define the netCDF variable 67 status=nc_redef(ncid); 68 if (status != NC_NOERR) 69 { 70 handle_error (status, "Erreur change to def mode NetCDF ::voncwrite"); 71 } 72 73 status=nc_def_var(ncid,var_name,NC_INT,1,&tid,&var_id); 74 75 if (status != NC_NOERR) 76 { 77 printf("variable %s:",var_name); 78 handle_error (status, "Erreur define NetCDF variable ::voncwrite"); 79 } 80 nc_enddef(ncid); 81 status=nc_put_vara_int(ncid,var_id,start,count,&var); 82 if (status != NC_NOERR) 83 { 84 handle_error (status, "Erreur writing NetCDF variable ::voncwrite"); 85 } 86 } 87 88 void twrite(int t, char *var_name,int ncid,int tid,float var) 89 { 90 //Ecrire un scalaire au temps t 91 //le parametre t commence de 0. 92 // ecrit la variable var_name au point (t) 93 int status; 94 95 int var_id; 96 static size_t start[] = {0}; //3D+t 97 static size_t count[] = {1}; //3D+t 98 count[0]= (size_t) t+1; 99 start[0]=t; //temps commence de 0; 100 101 //Define the netCDF variable 102 status=nc_redef(ncid); 103 if (status != NC_NOERR) 104 { 105 handle_error (status, "Erreur change to def mode NetCDF ::voncwrite"); 106 } 107 108 status=nc_def_var(ncid,var_name,NC_FLOAT,1,&tid,&var_id); 109 110 if (status != NC_NOERR) 111 { 112 printf("variable %s:",var_name); 113 handle_error (status, "Erreur define NetCDF variable ::voncwrite"); 114 } 115 nc_enddef(ncid); 116 status=nc_put_vara_float(ncid,var_id,start,count,&var); 117 if (status != NC_NOERR) 118 { 119 handle_error (status, "Erreur writing NetCDF variable ::voncwrite"); 120 } 121 } 122 123 void twrite(int t, char *var_name,int ncid,int tid,double var) 124 { 125 //Ecrire un scalaire au temps t 126 //le parametre t commence de 0. 127 // ecrit la variable var_name au point (t) 128 int status; 129 130 int var_id; 131 static size_t start[] = {0}; //3D+t 132 static size_t count[] = {1}; //3D+t 133 count[0]= (size_t) t+1; 134 start[0]=t; //temps commence de 0; 135 136 //Define the netCDF variable 137 status=nc_redef(ncid); 138 if (status != NC_NOERR) 139 { 140 handle_error (status, "Erreur change to def mode NetCDF ::voncwrite"); 141 } 142 143 status=nc_def_var(ncid,var_name,NC_DOUBLE,1,&tid,&var_id); 144 145 if (status != NC_NOERR) 146 { 147 printf("variable %s:",var_name); 148 handle_error (status, "Erreur define NetCDF variable ::voncwrite"); 149 } 150 nc_enddef(ncid); 151 status=nc_put_vara_double(ncid,var_id,start,count,&var); 152 if (status != NC_NOERR) 153 { 154 handle_error (status, "Erreur writing NetCDF variable ::voncwrite"); 155 } 156 } 157 158 53 159 void voncwrite(int t,int znbval,int ynbval, int xnbval, char const *var_name,int ncid,int dimids[], YREAL vect[]) 54 160 { //Ecrrire le volume 3D au temps t … … 432 538 } 433 539 540 void scalarlire (int ncid,int varid, int *var) { 541 int status; 542 status=nc_get_var_int (ncid,varid,var); 543 if (status != NC_NOERR) 544 { 545 handle_error (status, "Erreur lecture fichier NetCDF::scalarlire"); 546 } 547 } 548 549 void scalarlire (int ncid,int varid, float *var) { 550 int status; 551 status=nc_get_var_float (ncid,varid,var); 552 if (status != NC_NOERR) 553 { 554 handle_error (status, "Erreur lecture fichier NetCDF::scalarlire"); 555 } 556 } 557 558 void scalarlire (int ncid,int varid, double *var) { 559 int status; 560 status=nc_get_var_double (ncid,varid,var); 561 if (status != NC_NOERR) 562 { 563 handle_error (status, "Erreur lecture fichier NetCDF::scalarlire"); 564 } 565 } 566 567 void scalarwrite (int ncid,char const *var_name,int var) { 568 int status; 569 int var_id; 570 status=nc_redef(ncid); 571 if (status != NC_NOERR) 572 { 573 handle_error (status, "Erreur change to def mode NetCDF ::scalarwrite"); 574 } 575 576 status=nc_def_var(ncid,var_name,NC_INT,0,NULL,&var_id); 577 578 if (status != NC_NOERR) 579 { 580 printf("variable %s:",var_name); 581 handle_error (status, "Erreur define NetCDF variable ::scalarwrite"); 582 } 583 nc_enddef(ncid); 584 status=nc_put_var_int(ncid,var_id,&var); 585 if (status != NC_NOERR) 586 { 587 handle_error (status, "Erreur writing NetCDF variable ::scalarwrite"); 588 } 589 } 590 void scalarwrite (int ncid,char const *var_name,float var) { 591 int status; 592 int var_id; 593 status=nc_redef(ncid); 594 if (status != NC_NOERR) 595 { 596 handle_error (status, "Erreur change to def mode NetCDF ::scalarwrite"); 597 } 598 599 status=nc_def_var(ncid,var_name,NC_FLOAT,0,NULL,&var_id); 600 601 if (status != NC_NOERR) 602 { 603 printf("variable %s:",var_name); 604 handle_error (status, "Erreur define NetCDF variable ::scalarwrite"); 605 } 606 nc_enddef(ncid); 607 status=nc_put_var_float(ncid,var_id,&var); 608 if (status != NC_NOERR) 609 { 610 handle_error (status, "Erreur writing NetCDF variable ::scalarwrite"); 611 } 612 } 613 void scalarwrite (int ncid,char const *var_name,double var) { 614 int status; 615 int var_id; 616 status=nc_redef(ncid); 617 if (status != NC_NOERR) 618 { 619 handle_error (status, "Erreur change to def mode NetCDF ::scalarwrite"); 620 } 621 622 status=nc_def_var(ncid,var_name,NC_DOUBLE,0,NULL,&var_id); 623 624 if (status != NC_NOERR) 625 { 626 printf("variable %s:",var_name); 627 handle_error (status, "Erreur define NetCDF variable ::scalarwrite"); 628 } 629 nc_enddef(ncid); 630 status=nc_put_var_double(ncid,var_id,&var); 631 if (status != NC_NOERR) 632 { 633 handle_error (status, "Erreur writing NetCDF variable ::scalarwrite"); 634 } 635 } 636 434 637 void sncwrite(int ynbval, int xnbval, char const *var_name,int ncid,int dimids[], YREAL vect[]) 435 638 { //Ecrrire le volume 2D -
trunk/include/ncutil.h
r7 r8 64 64 void znclire(int znbval, int ncid, int varid, double vect[]); 65 65 66 void scalarlire (int ncid,int varid, int *var); 67 void scalarlire (int ncid,int varid, float *var); 68 void scalarlire (int ncid,int varid, double *var); 69 70 void scalarwrite (int ncid,char const *var_name,int var); 71 void scalarwrite (int ncid,char const *var_name,float var); 72 void scalarwrite (int ncid,char const *var_name,double var); 73 66 74 void zoncwrite(int t,int znbval,char const *var_name,int ncid,int dimids[], YREAL vect[]); 67 75 68 76 void zncwrite(int znbval,char const *var_name,int ncid,int dimids[], YREAL vect[]); 69 77 void sncwrite(int ynbval, int xnbval, char const *var_name,int ncid,int dimids[], YREAL vect[]); 78 79 void twrite(int t, char *var_name,int ncid,int tid,int var); 80 void twrite(int t, char *var_name,int ncid,int tid,float var); 81 void twrite(int t, char *var_name,int ncid,int tid,double var); 82 70 83 #endif 71 84 -
trunk/src/sinobad.d
r7 r8 790 790 insert_fct arg true_target_in_tab 791 791 insert_fct arg xrst_save 792 insert_fct arg xchangesavemode 793 792 794 #insert_fct arg load_shape_func 793 795 #insert_fct arg load_stdev_pca -
trunk/src/sinobad.h
r7 r8 62 62 //latitude for the Coriolis or Beta parameter 63 63 64 //mode de sauvegarde (==0 3D, ==1 2D surface) 65 short savemode=0; 66 64 67 65 68 int n_zdfexp=3; … … 70 73 nday_year : current day of the year nyea 71 74 ndastp : = nyear*10000 + nmonth*100 + nday*/ 72 int nyear=1; // a revoir73 74 75 75 76 void cal_ff(); … … 369 370 xistate_rest_file(rest_file_id); 370 371 nc_close( rest_file_id); 372 //printf("kt=%f, ndastp=%f, adatrj=%f",kt,ndastp,adatrj); 373 371 374 for(int i=0;i<NX;i++) 372 375 for(int j=0;j<NY;j++){ … … 454 457 } 455 458 } 459 460 void xchangesavemode(int argc, char *argv[]){ 461 short newmode=atoi(argv[1]); 462 savemode=newmode; 463 464 } 465 456 466 //_____________________________________________________________________________ 457 467 void xistate_yao_file(char * pth_file_yao){ // a faire
Note: See TracChangeset
for help on using the changeset viewer.