(file) Return to sharp.c CVS log (file) (dir) Up to [Development] / JSOC / proj / sharp / apps

Diff for /JSOC/proj/sharp/apps/sharp.c between version 1.30 and 1.35

version 1.30, 2014/06/05 21:27:19 version 1.35, 2015/03/02 21:41:15
Line 1049  int findPosition(DRMS_Record_t *inRec, s
Line 1049  int findPosition(DRMS_Record_t *inRec, s
         float disk_lonc = drms_getkey_float(inRec, "CRLN_OBS", &status);         float disk_lonc = drms_getkey_float(inRec, "CRLN_OBS", &status);
  
         /* Center coord */         /* Center coord */
       // Changed into double Jun 16 2014 XS
  
         float minlon = drms_getkey_float(inRec, "LONDTMIN", &status); if (status) return 1;             // Stonyhurst lon          double minlon = drms_getkey_double(inRec, "LONDTMIN", &status); if (status) return 1;           // Stonyhurst lon
         float maxlon = drms_getkey_float(inRec, "LONDTMAX", &status); if (status) return 1;          double maxlon = drms_getkey_double(inRec, "LONDTMAX", &status); if (status) return 1;
         float minlat = drms_getkey_float(inRec, "LATDTMIN", &status); if (status) return 1;          double minlat = drms_getkey_double(inRec, "LATDTMIN", &status); if (status) return 1;
         float maxlat = drms_getkey_float(inRec, "LATDTMAX", &status); if (status) return 1;          double maxlat = drms_getkey_double(inRec, "LATDTMAX", &status); if (status) return 1;
  
         // A bug fixer for HARP (per M. Turmon)         // A bug fixer for HARP (per M. Turmon)
         // When AR is below threshold, "LONDTMIN", "LONDTMAX" will be wrong         // When AR is below threshold, "LONDTMIN", "LONDTMAX" will be wrong
Line 1084  int findPosition(DRMS_Record_t *inRec, s
Line 1085  int findPosition(DRMS_Record_t *inRec, s
         mInfo->yc = (maxlat + minlat) / 2.;         mInfo->yc = (maxlat + minlat) / 2.;
  
         /* Size */         /* Size */
       // Rounded to 1.d3 precision first. Jun 16 2014 XS
  
         mInfo->ncol = round((maxlon - minlon) / mInfo->xscale);          mInfo->ncol = round(round((maxlon - minlon) * 1.e3) / 1.e3 / mInfo->xscale);
         mInfo->nrow = round((maxlat - minlat) / mInfo->yscale);          mInfo->nrow = round(round((maxlat - minlat) * 1.e3) / 1.e3 / mInfo->yscale);
  
         return 0;         return 0;
  
Line 1971  void computeSWIndex(struct swIndex *swKe
Line 1973  void computeSWIndex(struct swIndex *swKe
         float *jz_err_squared = (float *) (malloc(nxny * sizeof(float)));         float *jz_err_squared = (float *) (malloc(nxny * sizeof(float)));
         float *jz_err_squared_smooth = (float *) (malloc(nxny * sizeof(float)));         float *jz_err_squared_smooth = (float *) (malloc(nxny * sizeof(float)));
         float *jz_rms_err = (float *) (malloc(nxny * sizeof(float)));         float *jz_rms_err = (float *) (malloc(nxny * sizeof(float)));
           float *err_term1   = (float *) (calloc(nxny, sizeof(float)));
           float *err_term2   = (float *) (calloc(nxny, sizeof(float)));
           float *err_termA   = (float *) (calloc(nxny, sizeof(float)));
           float *err_termB   = (float *) (calloc(nxny, sizeof(float)));
           float *err_termAt  = (float *) (calloc(nxny, sizeof(float)));
           float *err_termBt  = (float *) (calloc(nxny, sizeof(float)));
           float *err_termAh  = (float *) (calloc(nxny, sizeof(float)));
           float *err_termBh  = (float *) (calloc(nxny, sizeof(float)));
  
         // define some values for the R calculation         // define some values for the R calculation
         int scale = round(2.0/cdelt1);         int scale = round(2.0/cdelt1);
Line 2018  void computeSWIndex(struct swIndex *swKe
Line 2028  void computeSWIndex(struct swIndex *swKe
         computeB_total(bx_err, by_err, bz_err, bt_err, bx, by, bz, bt, dims, mask, bitmask);         computeB_total(bx_err, by_err, bz_err, bt_err, bx, by, bz, bt, dims, mask, bitmask);
  
         if (computeBtotalderivative(bt, dims, &(swKeys_ptr->mean_derivative_btotal), mask, bitmask, derx_bt,         if (computeBtotalderivative(bt, dims, &(swKeys_ptr->mean_derivative_btotal), mask, bitmask, derx_bt,
                                     dery_bt, bt_err, &(swKeys_ptr->mean_derivative_btotal_err)))                                      dery_bt, bt_err, &(swKeys_ptr->mean_derivative_btotal_err), err_termAt, err_termBt))
         {         {
                 swKeys_ptr->mean_derivative_btotal = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_derivative_btotal = DRMS_MISSING_FLOAT;
                 swKeys_ptr->mean_derivative_btotal_err = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_derivative_btotal_err = DRMS_MISSING_FLOAT;
         }         }
  
         if (computeBhderivative(bh, bh_err, dims, &(swKeys_ptr->mean_derivative_bh),         if (computeBhderivative(bh, bh_err, dims, &(swKeys_ptr->mean_derivative_bh),
                                 &(swKeys_ptr->mean_derivative_bh_err), mask, bitmask, derx_bh, dery_bh))                                  &(swKeys_ptr->mean_derivative_bh_err), mask, bitmask, derx_bh, dery_bh, err_termAh, err_termBh))
         {         {
                 swKeys_ptr->mean_derivative_bh = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_derivative_bh = DRMS_MISSING_FLOAT;
                 swKeys_ptr->mean_derivative_bh_err = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_derivative_bh_err = DRMS_MISSING_FLOAT;
         }         }
  
         if (computeBzderivative(bz, bz_err, dims, &(swKeys_ptr->mean_derivative_bz), &(swKeys_ptr->mean_derivative_bz_err),         if (computeBzderivative(bz, bz_err, dims, &(swKeys_ptr->mean_derivative_bz), &(swKeys_ptr->mean_derivative_bz_err),
                                 mask, bitmask, derx_bz, dery_bz))                                  mask, bitmask, derx_bz, dery_bz, err_termA, err_termB))
         {         {
                 swKeys_ptr->mean_derivative_bz = DRMS_MISSING_FLOAT; // If fail, fill in NaN                 swKeys_ptr->mean_derivative_bz = DRMS_MISSING_FLOAT; // If fail, fill in NaN
                 swKeys_ptr->mean_derivative_bz_err = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_derivative_bz_err = DRMS_MISSING_FLOAT;
         }         }
  
         computeJz(bx_err, by_err, bx, by, dims, jz, jz_err, jz_err_squared, mask, bitmask, cdelt1, rsun_ref, rsun_obs,         computeJz(bx_err, by_err, bx, by, dims, jz, jz_err, jz_err_squared, mask, bitmask, cdelt1, rsun_ref, rsun_obs,
               derx, dery);                    derx, dery, err_term1, err_term2);
  
  
         if(computeJzsmooth(bx, by, dims, jz, jz_smooth, jz_err, jz_rms_err, jz_err_squared_smooth, &(swKeys_ptr->mean_jz),         if(computeJzsmooth(bx, by, dims, jz, jz_smooth, jz_err, jz_rms_err, jz_err_squared_smooth, &(swKeys_ptr->mean_jz),
Line 2118  void computeSWIndex(struct swIndex *swKe
Line 2128  void computeSWIndex(struct swIndex *swKe
  
         }         }
  
   
         // Clean up the arrays         // Clean up the arrays
  
         drms_free_array(bitmaskArray);          // Dec 18 2012 Xudong         drms_free_array(bitmaskArray);          // Dec 18 2012 Xudong
Line 2141  void computeSWIndex(struct swIndex *swKe
Line 2150  void computeSWIndex(struct swIndex *swKe
         free(jz_err_squared); free(jz_rms_err);         free(jz_err_squared); free(jz_rms_err);
         free(jz_err_squared_smooth);         free(jz_err_squared_smooth);
  
           // free the arrays that are related to the numerical derivatives
           free(err_term2);
           free(err_term1);
           free(err_termB);
           free(err_termA);
           free(err_termBt);
           free(err_termAt);
           free(err_termBh);
           free(err_termAh);
   
         // free the arrays that are related to the r calculation         // free the arrays that are related to the r calculation
         free(rim);         free(rim);
         free(p1p0);         free(p1p0);


Legend:
Removed from v.1.30  
changed lines
  Added in v.1.35

Karen Tian
Powered by
ViewCVS 0.9.4