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

Diff for /JSOC/proj/sharp/apps/sw_functions.c between version 1.39 and 1.42

version 1.39, 2021/03/18 01:53:40 version 1.42, 2021/05/26 04:44:14
Line 1 
Line 1 
  
 /*=========================================== /*===========================================
  
  The following 14 functions calculate the following spaceweather indices:   The following functions calculate these spaceweather indices from the vector magnetic field data:
  
  USFLUX Total unsigned flux in Maxwells  USFLUX Total unsigned flux in Maxwells
  MEANGAM Mean inclination angle, gamma, in degrees  MEANGAM Mean inclination angle, gamma, in degrees
Line 18 
Line 18 
  MEANPOT Mean photospheric excess magnetic energy density in ergs per cubic centimeter  MEANPOT Mean photospheric excess magnetic energy density in ergs per cubic centimeter
  TOTPOT Total photospheric magnetic energy density in ergs per cubic centimeter  TOTPOT Total photospheric magnetic energy density in ergs per cubic centimeter
  MEANSHR Mean shear angle (measured using Btotal) in degrees  MEANSHR Mean shear angle (measured using Btotal) in degrees
    CMASK The total number of pixels that contributed to the calculation of all the indices listed above
   
    And these spaceweather indices from the line-of-sight magnetic field data:
    USFLUXL Total unsigned flux in Maxwells
    MEANGBL Mean value of the line-of-sight field gradient, in Gauss/Mm
    CMASKL The total number of pixels that contributed to the calculation of USFLUXL and MEANGBL
  R_VALUE Karel Schrijver's R parameter  R_VALUE Karel Schrijver's R parameter
  
  The indices are calculated on the pixels in which the conf_disambig segment is greater than 70 and  The indices are calculated on the pixels in which the conf_disambig segment is greater than 70 and
Line 1255  int computeLorentz(float *bx, float *by
Line 1261  int computeLorentz(float *bx, float *by
 //  (Gauss/pix^2)(CDELT1)^2(RSUN_REF/RSUN_OBS)^2(100.cm/m)^2 //  (Gauss/pix^2)(CDELT1)^2(RSUN_REF/RSUN_OBS)^2(100.cm/m)^2
 //  =Gauss*cm^2 //  =Gauss*cm^2
  
 int computeAbsFlux_los(float *los, int *dims, float *absFlux,  int computeAbsFlux_los(float *los, int *dims, float *absFlux_los,
                        float *mean_vf_ptr, float *count_mask_ptr,                         float *mean_vf_los_ptr, float *count_mask_los_ptr,
                        int *bitmask, float cdelt1, double rsun_ref, double rsun_obs)                        int *bitmask, float cdelt1, double rsun_ref, double rsun_obs)
  
 { {
Line 1265  int computeAbsFlux_los(float *los, int *
Line 1271  int computeAbsFlux_los(float *los, int *
     int ny = dims[1];     int ny = dims[1];
     int i = 0;     int i = 0;
     int j = 0;     int j = 0;
     int count_mask = 0;      int count_mask_los = 0;
       int countabit = 0;
     double sum = 0.0;     double sum = 0.0;
     *absFlux = 0.0;      *absFlux_los = 0.0;
     *mean_vf_ptr = 0.0;      *mean_vf_los_ptr = 0.0;
  
  
     if (nx <= 0 || ny <= 0) return 1;     if (nx <= 0 || ny <= 0) return 1;
Line 1278  int computeAbsFlux_los(float *los, int *
Line 1285  int computeAbsFlux_los(float *los, int *
            for (j = 0; j < ny; j++)            for (j = 0; j < ny; j++)
            {            {
             if ( bitmask[j * nx + i] < 30 ) continue;             if ( bitmask[j * nx + i] < 30 ) continue;
             if isnan(los[j * nx + i]) continue;              if isnan(los[j * nx + i])
                 {countabit++; continue;}
             sum += (fabs(los[j * nx + i]));             sum += (fabs(los[j * nx + i]));
             count_mask++;              count_mask_los++;
            }            }
         }         }
  
     *mean_vf_ptr     = sum*cdelt1*cdelt1*(rsun_ref/rsun_obs)*(rsun_ref/rsun_obs)*100.0*100.0;      *mean_vf_los_ptr     = sum*cdelt1*cdelt1*(rsun_ref/rsun_obs)*(rsun_ref/rsun_obs)*100.0*100.0;
     *count_mask_ptr  = count_mask;      *count_mask_los_ptr  = count_mask_los;
   
       //printf("USFLUXL=%f\n",*mean_vf_los_ptr);
       //printf("CMASKL=%f\n",*count_mask_los_ptr);
  
     return 0;     return 0;
 } }
Line 1357  int computeLOSderivative(float *los, int
Line 1368  int computeLOSderivative(float *los, int
         for (j = 0; j <= ny-1; j++)         for (j = 0; j <= ny-1; j++)
         {         {
             if ( bitmask[j * nx + i] < 30 ) continue;             if ( bitmask[j * nx + i] < 30 ) continue;
             if ( (derx_los[j * nx + i] + dery_los[j * nx + i]) == 0) continue;  
             if isnan(los[j * nx + i])      continue;             if isnan(los[j * nx + i])      continue;
             if isnan(los[(j+1) * nx + i])  continue;             if isnan(los[(j+1) * nx + i])  continue;
             if isnan(los[(j-1) * nx + i])  continue;             if isnan(los[(j-1) * nx + i])  continue;
Line 1371  int computeLOSderivative(float *los, int
Line 1381  int computeLOSderivative(float *los, int
     }     }
  
     *mean_derivative_los_ptr = (sum)/(count_mask); // would be divided by ((nx-2)*(ny-2)) if shape of count_mask = shape of magnetogram     *mean_derivative_los_ptr = (sum)/(count_mask); // would be divided by ((nx-2)*(ny-2)) if shape of count_mask = shape of magnetogram
     //printf("mean_derivative_los_ptr=%f\n",*mean_derivative_los_ptr);  
       //printf("MEANGBL=%f\n",*mean_derivative_los_ptr);
  
         return 0;         return 0;
 } }


Legend:
Removed from v.1.39  
changed lines
  Added in v.1.42

Karen Tian
Powered by
ViewCVS 0.9.4