#577 closed task (fixed)
Do a proper average of SNRs (via I and Q) [1 d]
Reported by: | Ian Culverwell | Owned by: | Ian Culverwell |
---|---|---|---|
Priority: | normal | Milestone: | ROPP9.1 carry over |
Component: | ropp_io | Version: | 9.0 |
Keywords: | Cc: |
Description
https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/ropp/ropp_io.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/ropp/ropp_io_read.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/ropp/ropp_io_read_ncdf_get.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/tools/eum2bufr_ec.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/tools/eum2ropp.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_io/tools/ropp2bufr_ec.f90 (similar/consistent updates to ropp2bufr_mo.f90 has not been made since https://trac.romsaf.org/ropp/changeset/3430)
Original changesets:
Do a proper average of SNRs (via I and Q): https://trac.romsaf.org/ropp/changeset/5344/ropp_src/branches/dev/Share/dmi_trunk_8.1/ropp_io/ropp/ropp_io_read_ncdf_get.f90
Change history (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
It turns out that #584 includes a line
IF (j1==n_olrs) EXIT
in the loop over j1
, which addresses the first concern. Second concern remains.
comment:3 by , 5 years ago
Commit change at r5945. Note that I had to change
IF (sampling_mode .EQ. '/open_loop/') THEN
to
IF (sampling_mode .EQ. 'open_loop') THEN
since the official code doesn't use /
s for these variables. (It also contains an info message if the data are missing, which the dmi_trunk code has somehow omitted.)
comment:4 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Checks out OK in tests - because, as before, there's no rs data in the test file. Take this one on trust. Close ticket.
comment:6 by , 5 years ago
(I'm not sure, incidentally, that we need
angle_iq=ATAN2(q_ca(j),i_ca(j)+TINY(1.0_wp)) i_ca_sum=i_ca_sum+snr_ca(j)*COS(angle_iq) q_ca_sum=q_ca_sum+snr_ca(j)*SIN(angle_iq)
. I think COS(ATAN2(y, x+TINY(1.0_wp))) = x/SQRT(x**2+y**2)
, and sim for SIN
. See
real(KIND(1.d0)) :: theta, theta1, x, x1, y, y1 integer :: i do i=-4,4 theta = i * atan(1.d0) ! -pi to pi in steps of pi/4 x = COS(theta) y = SIN(theta) theta1 = atan2(y, x+tiny(1.d0)) x1 = COS(theta1) y1 = SIN(theta1) write(*,'(a, i2, 6es20.10)') 'i, theta, theta1, x, x1, y, y1 = ', i, theta, theta1, x, x1, y, y1 enddo
which produces
i, theta, theta1, x, x1, y, y1 = -4 -3.1415926536E+00 -3.1415926536E+00 -1.0000000000E+00 -1.0000000000E+00 -1.2246467991E-16 -1.2246467991E-16 i, theta, theta1, x, x1, y, y1 = -3 -2.3561944902E+00 -2.3561944902E+00 -7.0710678119E-01 -7.0710678119E-01 -7.0710678119E-01 -7.0710678119E-01 i, theta, theta1, x, x1, y, y1 = -2 -1.5707963268E+00 -1.5707963268E+00 6.1232339957E-17 6.1232339957E-17 -1.0000000000E+00 -1.0000000000E+00 i, theta, theta1, x, x1, y, y1 = -1 -7.8539816340E-01 -7.8539816340E-01 7.0710678119E-01 7.0710678119E-01 -7.0710678119E-01 -7.0710678119E-01 i, theta, theta1, x, x1, y, y1 = 0 0.0000000000E+00 0.0000000000E+00 1.0000000000E+00 1.0000000000E+00 0.0000000000E+00 0.0000000000E+00 i, theta, theta1, x, x1, y, y1 = 1 7.8539816340E-01 7.8539816340E-01 7.0710678119E-01 7.0710678119E-01 7.0710678119E-01 7.0710678119E-01 i, theta, theta1, x, x1, y, y1 = 2 1.5707963268E+00 1.5707963268E+00 6.1232339957E-17 6.1232339957E-17 1.0000000000E+00 1.0000000000E+00 i, theta, theta1, x, x1, y, y1 = 3 2.3561944902E+00 2.3561944902E+00 -7.0710678119E-01 -7.0710678119E-01 7.0710678119E-01 7.0710678119E-01 i, theta, theta1, x, x1, y, y1 = 4 3.1415926536E+00 3.1415926536E+00 -1.0000000000E+00 -1.0000000000E+00 1.2246467991E-16 1.2246467991E-16
In all cases, x=x1
and y=y1
. The SQRT
formulation might be a bit quicker. Leave it for now - this code is only a stopgap.)
This change is described at r5344. There are two aspects to this that I don't like/understand.
i_ca_avr
is allocated a size ofn_olrs
. But as far as I can see, ifn_rs
is >/~20*n_olrs
then the loop that definesi_ca_avr
could take it out of bounds, couldn't it?dtime(j+1)-dtime(j) > 0.00105_wp
. Might it be safer to check theABS
value of this, as in other parts ofSUBROUTINE ropp_io_read_eumdata
?Ask Stig for advice.