FG departures for 2D-OI (2m temperature, relative humidity and snow depth analysis) are calculated at fg2obs.F90. Observations are sorted by OBS_RAWTABLE(jpraw_refcoord, jtotal) based on latitude and longitude (prepared at scan_cma_odb.F90).
ssa/sub/scan_cma_odb.F90
izlat = int( zlat * 100.0_JPRB) izlon = int( zlon * 100.0_JPRB) i_refcoord = sign(1,izlat) * (abs(izlat) * 100000 + izlon) OBS_RAWTABLE(jpraw_refcoord, jtotal) =& &sign(1,i_refcoord) * (abs(i_refcoord) +& &1 * 0.01_JPRB)
ssa/sub/fg2obs.F90
!** Used to compute averages (always in the same order) call KEYSORT(irc, POBS, KLEN,key=jpraw_refcoord,transposed=.TRUE.)
The observations should be sorted in ascending order by latitude because FG departures are calculated in turn from south pole to north pole.
ssa/sub/fg2obs.F90
!** (Lat, Lon) of observations jlatN = NDGL + 1 LoopAllObs: do j=1,KLEN iflag = 0 ZOBSLAT = POBS(kplat,j) ZOBSLON = mod(POBS(kplon,j) + 360.0_JPRB, 360.0_JPRB) !** Calculate latitudinal NW-pivot values for each observation (i.e. point#1) WHILE_LOOP: do while (jlatN > 0.and. ZOBSLAT > ALAT(jlatN)) jlatN = jlatN - 1 enddo WHILE_LOOP
However, latitude is rounded down by the third dicimal place in OBS_RAWTABLE(jpraw_refcoord, jtotal). As a results, the index is sometimes not in ascending order precisely. The following table shows the example. ZOBSLAT should be at the latitude between ALAT(jlatN) and ALAT(jlatS) but it is not there.