Changeset 125 for altifloat/src


Ignore:
Timestamp:
06/26/14 09:50:56 (10 years ago)
Author:
jbrlod
Message:

read_bck added

Location:
altifloat/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • altifloat/src/floater.h

    r123 r125  
    177177 
    178178} 
     179 
     180 
     181void read_bck (int argv, char *argc[]) { 
     182/* Read background in a ascii file 
     183   format 
     184   Column 1 (%d) : time step (from 1 to jptfl) 
     185   Column 2 (%d) : lon (Yi) (from 1 to nlon) 
     186   Column 3 (%d) : lat (Yj) (from 1 to nlat) 
     187   Column 4 (%f) : u value 
     188   Column 5 (%f) : v value 
     189*/ 
     190 
     191if (argv!=2) { 
     192  fprintf(stderr,"(read_bck) Error : read_bck with %d (1 nedded)\n",argv-1); 
     193  fprintf(stderr,"No background read\n"); 
     194  return; 
     195 } 
     196 FILE *fid; 
     197 fid=fopen(argc[1],"r"); 
     198 if (fid==NULL) { 
     199   fprintf(stderr,"(read_bck) Error : unable to open %s\n",argc[1]); 
     200   return; 
     201 } 
     202  
     203 int it,ilon,ilat,count; 
     204 count=0; 
     205 YREAL uval,vval; 
     206 int status=5; 
     207 while (status==5) { 
     208   status=fscanf(fid,"%d %d %d %lf %lf",&it,&ilon,&ilat,&uval,&vval); 
     209   if (status!=5) break; 
     210   if (ilon>nlon || ilon<=0 || ilat>nlat || ilat<=0 || it<=0 || it>jptfl) { 
     211     fprintf(stderr,"(read_bck) Error : bad coordinate values in %s (ilon=%d, ilat=%d, it=%d)\n",argc[1],ilon,ilat,it); 
     212     fclose(fid); 
     213     return; 
     214   } 
     215   ubck[ilon-1][ilat-1][it-1]=uval; 
     216   vbck[ilon-1][ilat-1][it-1]=vval; 
     217   count++; 
     218 } 
     219 if (count%(nlon*nlat)!=0)  
     220   fprintf(stderr,"(read_bck) Warning : only %d data was loaded(nlon*nlat=%d)\n",count,nlon*nlat); 
     221 fclose(fid); 
     222  
     223} 
     224  
    179225void read_obs(int argv, char *argc[]) { 
    180226  /* Read observation in a ascii file 
  • altifloat/src/floater_delta.d

    r123 r125  
    234234insert_fct arg save_output_uv 
    235235insert_fct arg save_output_rfloat 
     236insert_fct arg read_bck 
Note: See TracChangeset for help on using the changeset viewer.