OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
mediqr.f
Go to the documentation of this file.
1  subroutine mediqr(dat,ndat,xmed,xiqr)
2 c
3 c purpose: this routine computes the median and interquartile range
4 c for an input data array.
5 c
6 c calling arguments:
7 c
8 c name Type i/o description
9 c -------- ---- --- -----------
10 c dat r*4 i input data array
11 c ndat i*4 i number of items in input data array
12 c xmed r*4 o median of data
13 c xiqr r*4 o interquartile range of data
14 c
15 c by: frederick s. patt, gsc, january 4, 1994
16 c
17 c notes: uses Select routine from numerical recipes for fortran, p334.
18 c
19 c modification history:
20 c
21  implicit none
22 
23 #include "nav_cnst.fin"
24  real*4 dat(3*maxlin),xmed,xiqr
25  real*4 da1(3*maxlin),select
26  integer*4 ndat,i,iq,ir,im,im1
27 
28 c initialize index array
29  do i=1,ndat
30  da1(i) = dat(i)
31  end do
32 
33 c compute median and iqr by calling function select
34 
35  im = ndat/2
36  im1 = im + 1
37  iq = (ndat-1)/4 + 1
38  ir = ndat - iq + 1
39  if (ndat.eq.(2*im)) then
40  xmed = (select(im,ndat,da1)+select(im1,ndat,da1))/2.
41  else
42  xmed = select(im1,ndat,da1)
43  end if
44  xiqr = select(ir,ndat,da1) - select(iq,ndat,da1)
45 
46  return
47  end
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame index(0-based) was previously being used the frame number(1-based) should have been used. There were only a few minor changes to the uncertainty index(maximum of 1 digit). 3. Some inefficient arrays(Sigma_RVS_norm_sq) were eliminated and some code lines in Preprocess_L1A_Data were moved into Process_OBCEng_Emiss. There were no changes to the product. Required RAM was reduced by 20 MB. Now
void initialize(int pixref_flag, int blkref_flag)
Definition: Usds.c:1371
#define real
Definition: DbAlgOcean.cpp:26
real *4 function select(k, n, arr)
Definition: select.f:2
===========================================================================V5.0.48(Terra) 03/20/2015 Changes shown below are differences from MOD_PR02 V5.0.46(Terra)============================================================================Changes noted for V6.1.20(Terra) below were also instituted for this version.============================================================================V6.1.20(Terra) 03/12/2015 Changes shown below are differences from MOD_PR02 V6.1.18(Terra)============================================================================Changes from v6.1.18 which may affect scientific output:A situation can occur in which a scan which contains sector rotated data has a telemetry value indicating the completeness of the sector rotation. This issue is caused by the timing of the instrument command to perform the sector rotation and the recording of the telemetry point that reports the status of sector rotation. In this case a scan is considered valid by L1B and pass through the calibration - reporting extremely high radiances. Operationally the TEB calibration uses a 40 scan average coefficient, so the 20 scans(one mirror side) after the sector rotation are contaminated with anomalously high radiance values. A similar timing issue appeared before the sector rotation was fixed in V6.1.2. Our analysis indicates the ‘SET_FR_ENC_DELTA’ telemetry correlates well with the sector rotation encoder position. The use of this telemetry point to determine scans that are sector rotated should fix the anomaly occured before and after the sector rotation(usually due to the lunar roll maneuver). The fix related to the sector rotation in V6.1.2 is removed in this version.============================================================================V6.1.18(Terra) 10/01/2014 Changes shown below are differences from MOD_PR02 V6.1.16(Terra)============================================================================Added doi attributes to NRT(Near-Real-Time) product.============================================================================V6.1.16(Terra) 01/27/2014 Changes shown below are differences from MOD_PR02 V6.1.14(Terra)============================================================================Migrate to SDP Toolkit 5.2.17============================================================================V6.1.14(Terra) 06/26/2012 Changes shown below are differences from MOD_PR02 V6.1.12(Terra)============================================================================Added the doi metadata to L1B product============================================================================V6.1.12(Terra) 04/25/2011 Changes shown below are differences from MOD_PR02 V6.1.8(Terra)============================================================================1. The algorithm to calculate uncertainties for reflective solar bands(RSB) is updated. The current uncertainty in L1B code includes 9 terms from prelaunch analysis. The new algorithm regroups them with the new added contributions into 5 terms:u1:the common term(AOI and time independent) and
Definition: HISTORY.txt:126
subroutine mediqr(dat, ndat, xmed, xiqr)
Definition: mediqr.f:2