ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/globalhs/apps/jretile_fewtomany.c
(Generate patch)

Comparing proj/globalhs/apps/jretile_fewtomany.c (file contents):
Revision 1.1 by tplarson, Wed May 9 03:53:35 2012 UTC vs.
Revision 1.2 by tplarson, Tue Sep 18 16:38:29 2012 UTC

# Line 73 | Line 73 | int jretile_fewtomany(void)
73    tstart=cmdparams_save_time(&cmdparams, "TSTART", &newstat);
74    ttotal=(char *)cmdparams_save_str(&cmdparams, "TTOTAL", &newstat);
75    status=drms_names_parseduration(&ttotal, &nseconds, 1);
76 <  if (status)
76 >  if (status != DRMS_SUCCESS)
77    {
78   //    newstat = newstat | CPSAVE_UNKNOWN_ERROR;
79      fprintf(stderr, "ERROR: problem parsing TTOTAL, = %s\n", ttotal);
# Line 83 | Line 83 | int jretile_fewtomany(void)
83    if (strcmp(kNOTSPECIFIED, tchunk))
84    {
85      status=drms_names_parseduration(&tchunk, &chunksecs, 1);
86 <    if (status)
86 >    if (status != DRMS_SUCCESS)
87        newstat = newstat | CPSAVE_UNKNOWN_ERROR;
88    }
89    else
# Line 288 | Line 288 | int jretile_fewtomany(void)
288      return 1;
289    }
290  
291 +  long long calversout, calvers;
292 +  int calversunset=1;
293 +
294 +  int firsttimethrough=1;
295    irecout=0;
296    for (iset=0; iset < ntimechunks; iset++)
297    {
# Line 319 | Line 323 | int jretile_fewtomany(void)
323        }
324   */
325        outrec = outrecset->records[irecout++];
326 <      if (histlink)
326 >      if (histlink != NULL)
327          drms_setlink_static(outrec, histlinkname,  histrecnum);
328  
329        if (verbflag > 1)
# Line 364 | Line 368 | int jretile_fewtomany(void)
368            continue;
369          }
370  
371 +        if (firsttimethrough)
372 +        {
373 +          if (calversunset)
374 +          {
375 +            calversout=drms_getkey_longlong(inrec, "CALVER64", &status);
376 +            if (status != DRMS_SUCCESS)
377 +              calversout = 0;
378 +            calversunset=0;
379 +          }
380 +
381 +          calvers=drms_getkey_longlong(inrec, "CALVER64", &status);
382 +          if (status != DRMS_SUCCESS)
383 +            calvers = 0;
384 +
385 +          if (calvers != calversout)
386 +          {
387 +            fprintf(stderr, "ERROR: input data has mixed CALVER64: %lld and %lld, recnum = %lld, histrecnum = %lld\n", calversout, calvers, inrec->recnum, histrecnum);
388 +            return 0;
389 +          }
390 +        }
391 +
392          tstartin=drms_getkey_time(inrec, "T_START", &status);
393          tstopin=drms_getkey_time(inrec, "T_STOP", &status);
394          lminin=drms_getkey_int(inrec, "LMIN", &status);
# Line 398 | Line 423 | int jretile_fewtomany(void)
423            segin = drms_segment_lookup(inrec, segnamein);
424          else
425            segin = drms_segment_lookupnum(inrec, 0);
426 <        if (segin)
426 >        if (segin != NULL)
427   //          inarr = drms_segment_read(segin, usetype, &status);
428            inarr = drms_segment_readslice(segin, usetype, startind, endind, &status);
429          if (status != DRMS_SUCCESS || inarr == NULL || segin == NULL)
# Line 428 | Line 453 | int jretile_fewtomany(void)
453  
454          drms_free_array(inarr);
455        }
456 +      firsttimethrough=0;
457  
458        if (nskip == nrecsin)
459        {
# Line 446 | Line 472 | int jretile_fewtomany(void)
472            fprintf(stderr, "ERROR: problem writing output segment: status = %d, T_START = %s, LMIN = %d, LMAX = %d, histrecnum = %lld\n", status, tstartstr, lminout, lmaxout, histrecnum);
473            drms_close_records(inrecset, DRMS_FREE_RECORD);
474            drms_close_records(outrecset, DRMS_FREE_RECORD);
475 <         return 0;
475 >          return 0;
476          }
477        }
478        drms_free_array(outarr);
479  
480 +      drms_copykeys(outrec, inrec, 0, kDRMS_KeyClass_Explicit);
481 + // copykeys takes care of MAPMMAX, SINBDIVS, CALVER64, etc. that should be constant across the input
482        skip2:
483  
456      drms_copykeys(outrec, inrec, 0, kDRMS_KeyClass_Explicit);
484        drms_setkey_int(outrec, "LMIN", lminout);
485        drms_setkey_int(outrec, "LMAX", lmaxout);
486        drms_setkey_time(outrec, "T_START", tstartout);
# Line 470 | Line 497 | int jretile_fewtomany(void)
497          drms_setkey_int(outrec, "QUALITY", 0);
498        }
499  
473      // these could be constant, but set them just in case
474      drms_setkey_int(outrec, "MAPMMAX", mapmmax);
475      drms_setkey_int(outrec, "SINBDIVS", sinbdivs);
476
500        tnow = (double)time(NULL);
501        tnow += UNIX_epoch;
502        drms_setkey_time(outrec, "DATE", tnow);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines