(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.26 and 1.29

version 1.26, 2014/03/19 20:37:18 version 1.29, 2014/06/02 19:47:10
Line 1936  void computeSWIndex(struct swIndex *swKe
Line 1936  void computeSWIndex(struct swIndex *swKe
  
     // convert cdelt1_orig from degrees to arcsec     // convert cdelt1_orig from degrees to arcsec
     float cdelt1       = (atan((rsun_ref*cdelt1_orig*RADSINDEG)/(dsun_obs)))*(1/RADSINDEG)*(3600.);     float cdelt1       = (atan((rsun_ref*cdelt1_orig*RADSINDEG)/(dsun_obs)))*(1/RADSINDEG)*(3600.);
     int nx1 = nx*cdelt1/2;  
     int ny1 = ny*cdelt1/2;  
   
           //if (nx1 > floor((nx-1)/scale + 1) )
           //      DIE("X-dimension of output array in fsample() is too large.");
           //if (ny1 > floor((ny-1)/scale + 1) )
           //      DIE("Y-dimension of output array in fsample() is too large.");
  
         // Temp arrays         // Temp arrays
         float *bh      = (float *) (malloc(nxny * sizeof(float)));         float *bh      = (float *) (malloc(nxny * sizeof(float)));
Line 1962  void computeSWIndex(struct swIndex *swKe
Line 1967  void computeSWIndex(struct swIndex *swKe
     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)));
  
     // malloc some arrays for the R parameter calculation          // define some values for the R calculation
           int scale = round(2.0/cdelt1);
           int nx1 = nx/scale;
           int ny1 = ny/scale;
           int nxp = nx1+40;
           int nyp = ny1+40;
     float *rim = (float *)malloc(nx1*ny1*sizeof(float));     float *rim = (float *)malloc(nx1*ny1*sizeof(float));
     float *p1p0 = (float *)malloc(nx1*ny1*sizeof(float));     float *p1p0 = (float *)malloc(nx1*ny1*sizeof(float));
     float *p1n0 = (float *)malloc(nx1*ny1*sizeof(float));     float *p1n0 = (float *)malloc(nx1*ny1*sizeof(float));
     float *p1p = (float *)malloc(nx1*ny1*sizeof(float));     float *p1p = (float *)malloc(nx1*ny1*sizeof(float));
     float *p1n = (float *)malloc(nx1*ny1*sizeof(float));     float *p1n = (float *)malloc(nx1*ny1*sizeof(float));
     float *p1 = (float *)malloc(nx1*ny1*sizeof(float));     float *p1 = (float *)malloc(nx1*ny1*sizeof(float));
     float *pmap = (float *)malloc(nx1*ny1*sizeof(float));          float *pmap    = (float *)malloc(nxp*nyp*sizeof(float));
           float *p1pad   = (float *)malloc(nxp*nyp*sizeof(float));
           float *pmapn   = (float *)malloc(nx1*ny1*sizeof(float));
  
         //spaceweather quantities computed         //spaceweather quantities computed
         if (computeAbsFlux(bz_err, bz , dims, &(swKeys_ptr->absFlux), &(swKeys_ptr->mean_vf),  &(swKeys_ptr->mean_vf_err),         if (computeAbsFlux(bz_err, bz , dims, &(swKeys_ptr->absFlux), &(swKeys_ptr->mean_vf),  &(swKeys_ptr->mean_vf_err),
Line 1994  void computeSWIndex(struct swIndex *swKe
Line 2006  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, dery_bt, bt_err, &(swKeys_ptr->mean_derivative_btotal_err)))          if (computeBtotalderivative(bt, dims, &(swKeys_ptr->mean_derivative_btotal), mask, bitmask, derx_bt,
                                       dery_bt, bt_err, &(swKeys_ptr->mean_derivative_btotal_err)))
     {     {
                 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), &(swKeys_ptr->mean_derivative_bh_err), mask, bitmask, derx_bh, dery_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 = 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), mask, bitmask, derx_bz, dery_bz))          if (computeBzderivative(bz, bz_err, dims, &(swKeys_ptr->mean_derivative_bz), &(swKeys_ptr->mean_derivative_bz_err),
                                   mask, bitmask, derx_bz, dery_bz))
     {     {
                 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;
Line 2026  void computeSWIndex(struct swIndex *swKe
Line 2041  void computeSWIndex(struct swIndex *swKe
         swKeys_ptr->us_i_err           = DRMS_MISSING_FLOAT;         swKeys_ptr->us_i_err           = DRMS_MISSING_FLOAT;
         }         }
  
         if (computeAlpha(jz_err, bz_err, bz, dims, jz, jz_smooth, &(swKeys_ptr->mean_alpha), &(swKeys_ptr->mean_alpha_err), mask, bitmask, cdelt1, rsun_ref, rsun_obs))          if (computeAlpha(jz_err, bz_err, bz, dims, jz, jz_smooth, &(swKeys_ptr->mean_alpha), &(swKeys_ptr->mean_alpha_err),
                            mask, bitmask, cdelt1, rsun_ref, rsun_obs))
     {     {
                 swKeys_ptr->mean_alpha         = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_alpha         = DRMS_MISSING_FLOAT;
         swKeys_ptr->mean_alpha_err     = DRMS_MISSING_FLOAT;         swKeys_ptr->mean_alpha_err     = DRMS_MISSING_FLOAT;
     }     }
  
         if (computeHelicity(jz_err, jz_rms_err, bz_err, bz, dims, jz, &(swKeys_ptr->mean_ih), &(swKeys_ptr->mean_ih_err), &(swKeys_ptr->total_us_ih), &(swKeys_ptr->total_abs_ih),          if (computeHelicity(jz_err, jz_rms_err, bz_err, bz, dims, jz, &(swKeys_ptr->mean_ih), &(swKeys_ptr->mean_ih_err),
                               &(swKeys_ptr->total_us_ih), &(swKeys_ptr->total_abs_ih),
                         &(swKeys_ptr->total_us_ih_err), &(swKeys_ptr->total_abs_ih_err), mask, bitmask, cdelt1, rsun_ref, rsun_obs))                         &(swKeys_ptr->total_us_ih_err), &(swKeys_ptr->total_abs_ih_err), mask, bitmask, cdelt1, rsun_ref, rsun_obs))
     {     {
                 swKeys_ptr->mean_ih            = DRMS_MISSING_FLOAT;                 swKeys_ptr->mean_ih            = DRMS_MISSING_FLOAT;
Line 2063  void computeSWIndex(struct swIndex *swKe
Line 2080  void computeSWIndex(struct swIndex *swKe
  
         if (computeShearAngle(bx_err, by_err, bz_err, bx, by, bz, bpx, bpy, bpz, dims,         if (computeShearAngle(bx_err, by_err, bz_err, bx, by, bz, bpx, bpy, bpz, dims,
                                                   &(swKeys_ptr->meanshear_angle), &(swKeys_ptr->meanshear_angle_err), &(swKeys_ptr->area_w_shear_gt_45),                                                   &(swKeys_ptr->meanshear_angle), &(swKeys_ptr->meanshear_angle_err), &(swKeys_ptr->area_w_shear_gt_45),
                                                   mask, bitmask)) {                                mask, bitmask))
           {
                 swKeys_ptr->meanshear_angle    = DRMS_MISSING_FLOAT; // If fail, fill in NaN                 swKeys_ptr->meanshear_angle    = DRMS_MISSING_FLOAT; // If fail, fill in NaN
                 swKeys_ptr->area_w_shear_gt_45 = DRMS_MISSING_FLOAT;                 swKeys_ptr->area_w_shear_gt_45 = DRMS_MISSING_FLOAT;
         swKeys_ptr->meanshear_angle_err= DRMS_MISSING_FLOAT;         swKeys_ptr->meanshear_angle_err= DRMS_MISSING_FLOAT;
         }         }
  
         if (computeR(bz_err, los , dims, &(swKeys_ptr->Rparam), cdelt1, rim, p1p0, p1n0,         if (computeR(bz_err, los , dims, &(swKeys_ptr->Rparam), cdelt1, rim, p1p0, p1n0,
                  p1p, p1n, p1, pmap, nx1, ny1))                       p1p, p1n, p1, pmap, nx1, ny1, scale, p1pad, nxp, nyp, pmapn))
         {         {
                 swKeys_ptr->Rparam = DRMS_MISSING_FLOAT;                // If fail, fill in NaN                 swKeys_ptr->Rparam = DRMS_MISSING_FLOAT;                // If fail, fill in NaN
         }         }
Line 2105  void computeSWIndex(struct swIndex *swKe
Line 2123  void computeSWIndex(struct swIndex *swKe
         free(p1n);         free(p1n);
         free(p1);         free(p1);
         free(pmap);         free(pmap);
           free(p1pad);
           free(pmapn);
 } }
  
 /* /*
Line 2236  void setKeys(DRMS_Record_t *outRec, DRMS
Line 2255  void setKeys(DRMS_Record_t *outRec, DRMS
         // Mar 19 XS         // Mar 19 XS
         if (fullDisk) {         if (fullDisk) {
                 drms_setkey_int(outRec, "AMBPATCH", 0);                 drms_setkey_int(outRec, "AMBPATCH", 0);
                   drms_setkey_int(outRec, "AMBWEAK", 2);
         } else {         } else {
                 drms_setkey_int(outRec, "AMBPATCH", 1);                 drms_setkey_int(outRec, "AMBPATCH", 1);
         }         }
Line 2275  float nnb (float *f, int nx, int ny, dou
Line 2295  float nnb (float *f, int nx, int ny, dou
  
 } }
  
   
 /* ################## Wrapper for Jesper's rebin code ################## */ /* ################## Wrapper for Jesper's rebin code ################## */
  
 void frebin (float *image_in, float *image_out, int nx, int ny, int nbin, int gauss) void frebin (float *image_in, float *image_out, int nx, int ny, int nbin, int gauss)


Legend:
Removed from v.1.26  
changed lines
  Added in v.1.29

Karen Tian
Powered by
ViewCVS 0.9.4