Changeset 4185


Ignore:
Timestamp:
04/01/11 11:47:01 (9 years ago)
Author:
stefan
Message:

Geomag wave_man2disk looking OK

Location:
branches/geomag
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/geomag/include/earthworm_defs.h

    r2026 r4185  
    8989#define MAX_SUBNET_LEN  10      /* Used in carlsubtrig. Carol 3/21/01 */ 
    9090 
    91 #define MAX_DIR_LEN 150         /* Max path length for directories, etc */ 
     91#define MAX_DIR_LEN 225         /* Max path length for directories, etc */ 
    9292 
    9393#define MAX_EMAIL_MSG_SIZE   32000 
  • branches/geomag/src/archiving/waveman2disk/waveman2disk.c

    r4170 r4185  
    130130static char    wsIp[MAX_WAVESERVERS][MAX_ADRLEN]; 
    131131static char    wsPort[MAX_WAVESERVERS][MAX_ADRLEN]; 
    132 static char    OutDir[MAXTXT];      /*base output data directory*/ 
     132static char    OutDir[MAX_DIR_LEN];      /*base output data directory*/ /* was  OutDir[MAXTXT]; But since RecursiveCreateDir is called which uses MAX_DIR_LEN, this should match that */ 
    133133static double  GapThresh; 
    134134static int     MinDuration;         /* minimum duration of data files for 
     
    702702 
    703703            if (ret != WS_ERR_NONE ) { 
    704                 logit ("e", "problem retrieving %s %s %s %s ", TraceReq[iTrReq].sta, 
    705                        TraceReq[iTrReq].chan, TraceReq[iTrReq].net, 
    706                        TraceReq[iTrReq].loc); 
    707  
     704                logit ("e", "while retrieving %s %s %s %s ", TraceReq[iTrReq].sta, 
     705                           TraceReq[iTrReq].chan, TraceReq[iTrReq].net, 
     706                           TraceReq[iTrReq].loc); 
     707             
    708708                switch( ret ) { 
    709709                case WS_WRN_FLAGGED: 
  • branches/geomag/src/libsrc/util/iagaputaway.c

    r4171 r4185  
    489489  } else if ((samprate > .0002) && (samprate < .0003)){ /* 0.0002777 */ 
    490490      strcpy(interval, "hor"); 
    491       sprintf(date_string, "04%d%02d", timeout.Year, timeout.Month); 
     491      /* The IAGA specification says we should just do year and month, but since we can do day files of hour data, we need to differentiate */ 
     492      sprintf(date_string, "%04d%02d%02d", timeout.Year, timeout.Month, timeout.Day); 
    492493  } else if ((samprate > 0.00001) && (samprate < 0.00002)){ /* 0.00001157 */ 
    493494      strcpy(interval, "day"); /* doubt we'll see this one */ 
     
    868869        if (WaveMsg2MakeLocal(wf) < 0) 
    869870        { 
    870           logit("e", "IAGAPA_next: just did WaveMsg2MakeLocal; unknown trace data type, after we advanced to next:  %c%c\n", 
    871               wf->datatype[0], wf->datatype[1]); 
     871            if (debug == 1) { 
     872                logit("e", "IAGAPA_next: just did WaveMsg2MakeLocal; unknown trace data type, after we advanced to next:  %c%c\nProbably beyond last tbuf. Breaking out of loop.", 
     873                    wf->datatype[0], wf->datatype[1]); 
     874            } 
    872875          break; /* Break out of the while(1) loop 'cuz we can't go any further with what we've got */ 
    873876          /* return( EW_FAILURE ); */ 
     
    932935      /* sprintf(sample_string,"           "); */ 
    933936      for (i=0; i<nTrReq;i++) {   
    934         if (IAGABuffer[i][j] != getThis->fill) {         
     937        if ((IAGABuffer[i][j] != getThis->fill) && (IAGABuffer[i][j] < 9999999999) && (IAGABuffer[i][j] > -999999999)) {         
    935938            /* The specification says this should be %9.2f, however, that doesn't seem to work for large neg #s. */ 
    936939            /* %10.2f makes everything line up properly, and allows for an unlikely number like -842150.45 for   */ 
  • branches/geomag/src/libsrc/util/wdcputaway.c

    r4170 r4185  
    230230  char    yr[3]; 
    231231  char    mo[3]; 
     232  char    dy[3]; 
    232233 
    233234  /* Grab the date-related substrings that we need for filenames. */ 
     
    238239  strncpy(mo, EventDate + 4, 2); 
    239240  mo[2] = '\0'; 
     241  strncpy(dy, EventDate + 6, 2); 
     242  dy[2] = '\0'; 
    240243  /* 
    241244    If we have minute data: staYEARm/staYRMOm.wdc 
     
    244247 
    245248  */ 
    246   if (cadence == MINUTE) { 
     249//  if (cadence == MINUTE) { 
    247250      /* Minute: */ 
    248251     /*sprintf(OutDir, "%s/%s%sm",  OutDir, ptrReq->sta, year );*/ 
    249       sprintf (WDCFile, "%s/%s%s%sm.wdc", OutDir, 
    250                         ptrReq->sta,yr, mo); 
    251   } else if (cadence == HOUR){ 
     252//      sprintf (WDCFile, "%s/%s%s%sm.wdc", OutDir, 
     253//                        ptrReq->sta,yr, mo); 
     254//  } else if (cadence == HOUR){ 
    252255      /* Hour: */ 
    253       sprintf (WDCFile, "%s/%s%s.wdc", OutDir, 
    254                     ptrReq->sta, year); 
    255   } else { 
     256//      sprintf (WDCFile, "%s/%s%s.wdc", OutDir, 
     257//                    ptrReq->sta, year); 
     258//  } else { 
     259//      logit ("et", "Unknown cadence. How did you get here anyway?"); 
     260//  } 
     261    // We might be using either hourly or minute format, and still produce day files 
     262    // Thus, gonna label everything with start day too. 
     263   if (cadence == MINUTE) { 
     264    sprintf (WDCFile, "%s/%s%s%s%sm.wdc", OutDir, 
     265                        ptrReq->sta,yr, mo, dy); 
     266   } else if (cadence == HOUR){ 
     267       // only difference is we are taking out the 'm' 
     268    sprintf (WDCFile, "%s/%s%s%s%s.wdc", OutDir, 
     269                            ptrReq->sta,yr, mo, dy); 
     270   }else { 
    256271      logit ("et", "Unknown cadence. How did you get here anyway?"); 
    257   } 
     272   } 
    258273 
    259274  RecursiveCreateDir(OutDir); 
     
    336351  short  *s_data; 
    337352  int    current_int; 
    338   char   bigstring[128]; 
    339353 
    340354  /* Put this in the .d file once we know we want it. */ 
     
    514528 
    515529  if ((sc.sc_name.component == 'D') || (sc.sc_name.component == 'd') || 
     530          (sc.sc_name.component == 'E') || (sc.sc_name.component == 'e') || 
     531          (sc.sc_name.component == 'F') || (sc.sc_name.component == 'f') || 
     532          (sc.sc_name.component == 'G') || (sc.sc_name.component == 'g') || 
     533          (sc.sc_name.component == 'H') || (sc.sc_name.component == 'h') || 
    516534          (sc.sc_name.component == 'I') || (sc.sc_name.component == 'i') || 
    517           (sc.sc_name.component == 'H') || (sc.sc_name.component == 'h') || 
    518535          (sc.sc_name.component == 'X') || (sc.sc_name.component == 'x') || 
    519536          (sc.sc_name.component == 'Y') || (sc.sc_name.component == 'y') || 
    520           (sc.sc_name.component == 'Z') || (sc.sc_name.component == 'z') || 
    521           (sc.sc_name.component == 'F') || (sc.sc_name.component == 'f')) { 
     537          (sc.sc_name.component == 'Z') || (sc.sc_name.component == 'z'))  
     538  { 
    522539                element = toupper(sc.sc_name.component); 
    523540  } else { 
    524                 element = '-'; /* DST will be the '-'. Too bad there isn't another letter. */ 
     541                element = '-'; /* DST will be the '-'. Too bad there isn't another letter. Delta F will be G which isn't ideal either */ 
    525542  } 
    526543 
     
    653670                if (WDCBuffer[j] != getThis->fill) { 
    654671                     sprintf(sixdigits, "      "); /* we want leading spaces */ 
    655                      sprintf(bigstring, "%d", (int)(WDCBuffer[j] * Multiplier)); 
    656                      if (strlen(bigstring) > 6){ 
    657                          logit("et", 
    658                              "Sample beyond the range of the six character wdc format. %f * Muliplier of %f. Substituting 9999 instead.", 
    659                                 WDCBuffer[j], Multiplier); 
    660                          strcpy(sixdigits + 2, "9999"); 
     672                     if (((int)(WDCBuffer[j] * Multiplier) > 999999) || ((int)(WDCBuffer[j] * Multiplier) < -99999)){ 
     673                        sprintf(sample, "9999"); 
     674                          /* prevent out of range string */ 
    661675                     } else { 
    662                          strcpy(sixdigits + 6 - strlen(bigstring), bigstring); 
    663                      } 
     676                         sprintf(sample, "%d", (int)(WDCBuffer[j] * Multiplier)); 
     677                     }              
     678                     strcpy(sixdigits + 6 - strlen(sample), sample); 
    664679                     strcpy(hour_line + s_place, sixdigits); 
    665680                } else { 
     
    695710           *               The average of the preceeding 60 1-minute values. 
    696711           */ 
     712          if ((LineMean > 999999) || (LineMean < -99999)){ 
     713              LineMean = 9999; 
     714              /* prevent out of range string */ 
     715          } 
    697716          if (LineMean != 9999) { 
    698717              LineMean = total/ 60;  /* Mean of the first 60 samples if there are no gaps */ 
    699718          } 
    700719          sprintf(sixdigits, "      "); /* we want leading spaces */ 
     720 
    701721          sprintf(sample, "%d", LineMean); 
    702           if (strlen(bigstring) > 6){ 
    703                 logit("et", 
    704                       "Mean total beyond the range of the six character wdc format %d. Substituting 9999 instead.", 
    705                                 LineMean); 
    706                strcpy(hour_line + 394, "  9999"); 
    707           } else { 
    708               strcpy(sixdigits + 6 - strlen(bigstring), bigstring); 
    709               strcpy(hour_line + 394, sixdigits); 
    710           } 
     722          strcpy(sixdigits + 6 - strlen(sample), sample); 
     723          strcpy(hour_line + 394, sixdigits); 
    711724 
    712725          /* 401-402       Record end marker. 
     
    859872                 if ((current_int > 9999) || (current_int < -999)){ 
    860873                     /* How did this happen? */ 
    861                      logit("et", "current_int out of range for wdc hourly format %d\n", current_int); 
     874                     if (debug == 1){ 
     875                        logit("et", "current_int out of range for wdc hourly format %d\n", current_int); 
     876                     } 
    862877                     current_int = 9999; 
    863878                 } 
     
    897912                 /*                       If any of the hourly mean values for the day are missing               */ 
    898913                 /*                       9999 will appear as the daily mean.            */ 
     914          if ((LineMean > 9999) || (LineMean < -999)){ 
     915              LineMean = 9999; 
     916              /* prevent out of range string */ 
     917          } 
    899918          if (LineMean != 9999) { 
    900919              LineMean = total/ 24;  /* Mean of the first 24 samples if there are no gaps */ 
Note: See TracChangeset for help on using the changeset viewer.