Satellite Application Facility for Numerical Weather Prediction › Forums › RTTOV › RTTOV v13 › RTTOV v13 General Discussion › Weighting function
- This topic has 7 replies, 2 voices, and was last updated 3 months, 3 weeks ago by Zongxin Yang.
-
AuthorPosts
-
August 12, 2024 at 7:00 am #49744Zongxin YangParticipant
Hi,
I’m new to RTTOV and I’m trying to use RTTOV to get FY-4B AGRI weighting function. I wonder what should I do to start.Thanks,
ZongxinAugust 19, 2024 at 10:54 am #49755James HockingKeymasterHi Zongxin,
In order to run RTTOV I suggest reading the RTTOV quick start guide (docs/rttov-quick-start.pdf), and section 3 of the user guide. Section 7 of the user guide takes you through the process of running a simulation in more detail.
If by weighting function you mean the rate of change of transmittance with height, you can calculate it using the RTTOV direct model transmittance outputs. For example, if you calculate it as d(transmittance)/d(pressure), you can use:
wfn(1:nlevels-1) = (transmission % tau_levels(1:nlevels-1,i) – transmission % tau_levels(2:nlevels,i)) / (p(2:nlevels) – p(1:nlevels-1))
where wfn is the weighting function, transmission is the RTTOV output transmittance structure, “transmission % tau_levels” contains the level to space transmittances, nlevels is the number of pressure levels in your input profile, i is the channel index, and p(1:nlevels) contains your input pressure levels. Sometimes weighting functions use other vertical coordinates such as log(pressure) or geometric height. These are calculated in a similar way.
Alternatively, if by weighting function you mean Jacobian, then you can run the Jacobian model. I suggest looking at the src/test/example_k.F90 example code (very similar to the direct model example described in the quick start guide and user guide, with the additional inputs/outputs required by the Jacobian calculations) and section 7.9 of the user guide.
Best wishes,
JamesAugust 22, 2024 at 12:38 am #49757Zongxin YangParticipantHi James,
Thank you four your advice, I learned a lot from them.Best wishes,
ZongxinAugust 26, 2024 at 6:34 am #49768Zongxin YangParticipantHi,
Me again. I tried to modify the example_fwd.f90, changing the code:
IF (nchannels <= 20) THEN
DO np = 1, nprint
WRITE(ioout,*)’ ‘
WRITE(ioout,*)’Level to space transmittances for channels’
WRITE(ioout,1115) (chanprof(j+joff) % chan, &
j = 1+(np-1)*10, MIN(np*10, nchannels))
DO ilev = 1, nlevels
DO j = 1 + (np-1)*10, MIN(np*10, nchannels)
! Select transmittance based on channel type (VIS/NIR or IR)
IF (coefs % coef % ss_val_chn(chanprof(j+joff) % chan) == 2) THEN
trans_out(j – (np-1)*10) = transmission % tausun_levels_path1(ilev,j+joff)
ELSE
trans_out(j – (np-1)*10) = transmission % tau_levels(ilev,j+joff)
ENDIF
ENDDO
WRITE(ioout,4445) ilev, trans_out(1:j-1-(np-1)*10)
ENDDO
WRITE(ioout,1115) (chanprof(j+joff) % chan, &
j = 1+(np-1)*10, MIN(np*10, nchannels))
ENDDO
ENDIF
to:
IF (nchannels <= 20) THEN
DO np = 1, nprint
WRITE(ioout,*)’ ‘
WRITE(ioout,*)’WEIGHTING FUNCTION’
WRITE(ioout,1115) (chanprof(j+joff) % chan, &
j = 1+(np-1)*10, MIN(np*10, nchannels))
DO ilev = 1, nlevels
DO j = 1 + (np-1)*10, MIN(np*10, nchannels)
IF (coefs % coef % ss_val_chn(chanprof(j+joff) % chan) == 2) THEN
wfn(j – (np-1)*10) = (transmission % tausun_levels_path1(ilev,j+joff)-transmission % tausun_levels_path1(ilev-1,j+joff)) / (profiles(iprof) % p(ilev-1)-profiles(iprof) % p(ilev))
ELSE
wfn(j – (np-1)*10) = (transmission % tau_levels(ilev,j+joff)-transmission % tau_levels(ilev-1,j+joff)) / (profiles(iprof) % p(ilev-1)-profiles(iprof) % p(ilev))
ENDIF
ENDDO
WRITE(ioout,4445) ilev, wfn(1:j-1-(np-1)*10)
ENDDO
WRITE(ioout,1115) (chanprof(j+joff) % chan, &
j = 1+(np-1)*10, MIN(np*10, nchannels))
ENDDO
ENDIFThe code works ,but the result seems to be incorrect. I wonder whether there is something wrong with the code or I should get a 54 levels input profile instead of the default 51 levels prof.dat, and where I can find that 54 levels profile .
Best wishes,
ZongxinAugust 27, 2024 at 7:52 am #49772James HockingKeymasterHi Zongxin,
Looking at the code you posted, I don’t see anything obviously incorrect. It will work for any set of pressure levels.
Can you be more specific – what exactly seems to be incorrect about the outputs?
Best wishes,
JamesAugust 27, 2024 at 9:36 am #49775Zongxin YangParticipantHi James,
Here are 10 channels’ output:
1 2 3 4 5 6 7 8 9 10
1********-36.0713-19.4250-14.1296******** -4.6268********-35.0355-35.0355********
2 0.0002 0.0002 0.0016 0.0008 0.0001 0.0001 0.0085 0.0085 0.0111 0.0037
3 0.0002 0.0001 0.0003 0.0001 0.0000 0.0000 0.0003 0.0003 0.0018 0.0007
4 0.0002 0.0002 0.0006 0.0004 0.0000 0.0001 0.0004 0.0004 0.0042 0.0020
5 0.0002 0.0001 0.0002 0.0002 0.0000 0.0000 0.0002 0.0002 0.0016 0.0009
6 0.0002 0.0002 0.0002 0.0003 0.0000 0.0000 0.0002 0.0002 0.0017 0.0011
7 0.0002 0.0002 0.0002 0.0002 0.0000 0.0000 0.0002 0.0002 0.0010 0.0007
8 0.0002 0.0003 0.0002 0.0003 0.0000 0.0000 0.0002 0.0002 0.0010 0.0007
9 0.0002 0.0003 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0007 0.0004
10 0.0002 0.0003 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0005 0.0003
11 0.0003 0.0005 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0006 0.0004
12 0.0003 0.0004 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0005 0.0003
13 0.0003 0.0005 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0006 0.0003
14 0.0003 0.0005 0.0001 0.0002 0.0000 0.0000 0.0002 0.0002 0.0005 0.0003
15 0.0003 0.0005 0.0001 0.0001 0.0000 0.0000 0.0002 0.0002 0.0005 0.0002
16 0.0003 0.0005 0.0001 0.0001 0.0000 0.0000 0.0002 0.0002 0.0005 0.0002
17 0.0003 0.0004 0.0001 0.0001 0.0000 0.0000 0.0002 0.0002 0.0005 0.0002
18 0.0003 0.0003 0.0001 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
19 0.0002 0.0003 0.0001 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
20 0.0002 0.0002 0.0001 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
21 0.0002 0.0002 0.0000 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
22 0.0002 0.0002 0.0000 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
23 0.0002 0.0001 0.0000 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
24 0.0002 0.0001 0.0000 0.0001 0.0000 0.0000 0.0001 0.0001 0.0005 0.0002
25 0.0002 0.0001 0.0000 0.0001 0.0000 0.0000 0.0001 0.0001 0.0007 0.0003
26 0.0002 0.0001 0.0000 0.0002 0.0000 0.0000 0.0001 0.0001 0.0010 0.0005
27 0.0002 0.0001 0.0000 0.0002 0.0000 0.0000 0.0001 0.0001 0.0013 0.0006
28 0.0002 0.0001 0.0000 0.0003 0.0000 0.0000 0.0001 0.0001 0.0017 0.0009
29 0.0002 0.0001 0.0000 0.0004 0.0000 0.0000 0.0001 0.0001 0.0020 0.0011
30 0.0002 0.0001 0.0000 0.0005 0.0000 0.0000 0.0001 0.0001 0.0023 0.0013
31 0.0002 0.0001 0.0000 0.0007 0.0000 0.0000 0.0001 0.0001 0.0025 0.0015
32 0.0002 0.0001 0.0000 0.0009 0.0000 0.0000 0.0001 0.0001 0.0029 0.0019
33 0.0002 0.0001 0.0000 0.0011 0.0000 0.0000 0.0001 0.0001 0.0032 0.0024
34 0.0002 0.0001 0.0000 0.0014 0.0000 0.0001 0.0001 0.0001 0.0031 0.0028
35 0.0002 0.0001 0.0000 0.0017 0.0000 0.0001 0.0001 0.0001 0.0027 0.0029
36 0.0002 0.0001 0.0001 0.0019 0.0000 0.0001 0.0001 0.0001 0.0019 0.0028
37 0.0002 0.0001 0.0001 0.0021 0.0000 0.0001 0.0001 0.0001 0.0012 0.0025
38 0.0002 0.0001 0.0001 0.0022 0.0000 0.0001 0.0001 0.0001 0.0006 0.0019
39 0.0002 0.0001 0.0001 0.0021 0.0000 0.0001 0.0001 0.0001 0.0003 0.0012
40 0.0002 0.0001 0.0001 0.0019 0.0000 0.0001 0.0002 0.0002 0.0001 0.0007
41 0.0002 0.0001 0.0001 0.0018 0.0000 0.0001 0.0002 0.0002 0.0000 0.0004
42 0.0002 0.0001 0.0001 0.0015 0.0000 0.0001 0.0002 0.0002 0.0000 0.0002
43 0.0002 0.0001 0.0001 0.0011 0.0000 0.0001 0.0002 0.0002 0.0000 0.0001
44 0.0002 0.0001 0.0001 0.0007 0.0000 0.0001 0.0003 0.0003 0.0000 0.0000
45 0.0002 0.0001 0.0001 0.0005 0.0000 0.0001 0.0003 0.0003 0.0000 0.0000
46 0.0002 0.0001 0.0001 0.0003 0.0000 0.0002 0.0003 0.0003 0.0000 0.0000
47 0.0002 0.0001 0.0001 0.0002 0.0000 0.0002 0.0003 0.0003 0.0000 0.0000
48 0.0002 0.0001 0.0001 0.0001 0.0000 0.0002 0.0004 0.0004 0.0000 0.0000
49 0.0002 0.0001 0.0001 0.0001 0.0000 0.0002 0.0004 0.0004 0.0000 0.0000
50 0.0002 0.0001 0.0001 0.0000 0.0000 0.0002 0.0004 0.0004 0.0000 0.0000
51 0.0002 0.0001 0.0001 0.0000 0.0000 0.0002 0.0003 0.0003 0.0000 0.0000The COEF_FILENAME is rtcoef_fy4_2_agri_o3co2.dat, and the input profile is the defalut prof.dat in rttov13/rttov_test/test_example.1.
I don’t understand why the ******** shows up, and the rest levels’ results are much smaller than the first level. So I thought the outputs were incorrect. Can you give me some opinions about this?
Thank you for your help no matter what.
Best wishes,
ZongxinAugust 27, 2024 at 10:03 am #49782James HockingKeymasterHi Zongxin,
Having looked more closely I see there is a minor problem in your code: when calculating/printing the weighting functions, your “ilev” loop over levels should run from 2 to nlevels because you are looking at the difference in values between levels ilev-1 and ilev so you cannot consider the case ilev=1.
Other than that I think it is fine. Some people compute weighting function using the difference in LOG(pressure) instead of the difference in pressure in the denominator, and you might find the resulting shapes of the weighting functions more intuitive/useful if you use LOG(pressure).
Best wishes,
James- This reply was modified 3 months, 3 weeks ago by James Hocking.
August 27, 2024 at 10:36 am #49786Zongxin YangParticipantHi Jamse,
Thank you for your advice again. I finally make it out with your help.
Wish you all well,
Zongxin -
AuthorPosts
- You must be logged in to reply to this topic.