New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
obs_readsnowdepth.F90 in NEMO/branches/UKMO/NEMO_4.0.4_generic_obs/src/OCE/OBS – NEMO

source: NEMO/branches/UKMO/NEMO_4.0.4_generic_obs/src/OCE/OBS/obs_readsnowdepth.F90 @ 15497

Last change on this file since 15497 was 15286, checked in by dford, 3 years ago

Update comment.

File size: 5.6 KB
Line 
1MODULE obs_readsnowdepth
2   !!======================================================================
3   !!                       ***  MODULE obs_readsnowdepth  ***
4   !! Observation diagnostics: Get the snow depth for freeboard conversion to thickness
5   !!======================================================================
6   !! History :      ! 2018-10 (E. Fiedler) Initial version
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   obs_rea_snowdepth    : Driver for reading MDT
11   !!----------------------------------------------------------------------
12   USE par_kind         ! Precision variables
13   USE par_oce          ! Domain parameters
14   USE in_out_manager   ! I/O manager
15   USE obs_surf_def     ! Surface observation definitions
16   USE obs_inter_sup    ! Interpolation support routines
17   USE obs_inter_h2d    ! 2D interpolation
18   USE obs_utils        ! Various observation tools
19   USE iom_nf90         ! IOM NetCDF
20   USE netcdf           ! NetCDF library
21   USE lib_mpp          ! MPP library
22   USE dom_oce, ONLY : &                  ! Domain variables
23      &                    tmask, tmask_i, e1t, e2t, gphit, glamt
24   USE obs_const, ONLY :   obfillflt      ! Fillvalue
25
26   IMPLICIT NONE
27   PRIVATE
28   
29   PUBLIC   obs_rea_snowdepth     ! called by dia_obs
30
31   !!----------------------------------------------------------------------
32   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
33   !! $Id$
34   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
35   !!----------------------------------------------------------------------
36CONTAINS
37
38   SUBROUTINE obs_rea_snowdepth( fbddata, k2dint, ksnow, thick_s )
39      !!---------------------------------------------------------------------
40      !!
41      !!                   *** ROUTINE obs_rea_snowdepth ***
42      !!
43      !! ** Purpose : Get snowdepth at observation points
44      !!
45      !! ** Method  :
46      !!
47      !! ** Action  :
48      !!----------------------------------------------------------------------
49      USE iom
50      !
51      TYPE(obs_surf), INTENT(inout)  ::   fbddata   ! Sea ice freeboard data
52      INTEGER       , INTENT(in)     ::   k2dint    ! ?
53      INTEGER       , INTENT(in)    ::    ksnow     ! Index of snow thickness extra var
54      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: thick_s ! Model snow depth
55     
56      CHARACTER(LEN=12), PARAMETER ::   cpname  = 'obs_rea_snowdepth'
57
58      INTEGER ::   jobs                ! Obs loop variable
59      INTEGER ::   jpi_thick_s, jpj_thick_s      ! Number of grid point in lat/lon for the snow depth
60      INTEGER ::   iico, ijco          ! Grid point indices
61
62      !
63      REAL(wp), DIMENSION(1)     ::   zext, zobsmask
64      REAL(wp), DIMENSION(2,2,1) ::   zweig
65      !
66      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   zmask, z_thick_s_l, zglam, zgphi
67      INTEGER , DIMENSION(:,:,:), ALLOCATABLE ::   igrdi, igrdj
68      !
69      REAL(wp), DIMENSION(jpi,jpj) ::  z_thick_s, thick_s_mask
70         
71      REAL(wp) :: zlam, zphi, zfill, zinfill    ! local scalar
72      !!----------------------------------------------------------------------
73
74      IF(lwp)WRITE(numout,*) 
75      IF(lwp)WRITE(numout,*) ' obs_rea_snowdepth : Get model snow depth for freeboard conversion to sea ice thickness'
76      IF(lwp)WRITE(numout,*) ' ------------- '
77      CALL FLUSH(numout)
78
79      ! Get ice thickness information
80      z_thick_s = thick_s
81
82      ! Setup mask based on tmask
83      thick_s_mask(:,:) = tmask(:,:,1)
84
85      ! Interpolate the snow depth already on the model grid at the observation point
86 
87      ALLOCATE( &
88         & igrdi(2,2,fbddata%nsurf), &
89         & igrdj(2,2,fbddata%nsurf), &
90         & zglam(2,2,fbddata%nsurf), &
91         & zgphi(2,2,fbddata%nsurf), &
92         & zmask(2,2,fbddata%nsurf), &
93         & z_thick_s_l(2,2,fbddata%nsurf)  &
94         & )
95         
96      DO jobs = 1, fbddata%nsurf
97
98         igrdi(1,1,jobs) = fbddata%mi(jobs)-1
99         igrdj(1,1,jobs) = fbddata%mj(jobs)-1
100         igrdi(1,2,jobs) = fbddata%mi(jobs)-1
101         igrdj(1,2,jobs) = fbddata%mj(jobs)
102         igrdi(2,1,jobs) = fbddata%mi(jobs)
103         igrdj(2,1,jobs) = fbddata%mj(jobs)-1
104         igrdi(2,2,jobs) = fbddata%mi(jobs)
105         igrdj(2,2,jobs) = fbddata%mj(jobs)
106
107      END DO
108
109      CALL obs_int_comm_2d( 2, 2, fbddata%nsurf, jpi, jpj, igrdi, igrdj, glamt  , zglam )
110      CALL obs_int_comm_2d( 2, 2, fbddata%nsurf, jpi, jpj, igrdi, igrdj, gphit  , zgphi )
111      CALL obs_int_comm_2d( 2, 2, fbddata%nsurf, jpi, jpj, igrdi, igrdj, thick_s_mask, zmask )
112      CALL obs_int_comm_2d( 2, 2, fbddata%nsurf, jpi, jpj, igrdi, igrdj, z_thick_s  , z_thick_s_l )
113
114      DO jobs = 1, fbddata%nsurf
115           
116         zlam = fbddata%rlam(jobs)
117         zphi = fbddata%rphi(jobs)
118
119         CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         &
120            &                   zglam(:,:,jobs), zgphi(:,:,jobs), &
121            &                   zmask(:,:,jobs), zweig, zobsmask )
122           
123         CALL obs_int_h2d( 1, 1, zweig, z_thick_s_l(:,:,jobs),  zext )
124 
125         fbddata%rext(jobs,ksnow) = zext(1)
126
127! mark any masked data with a QC flag
128         IF( zobsmask(1) == 0 )   fbddata%nqc(jobs) = IBSET(fbddata%nqc(jobs),15)
129
130         END DO
131         
132      DEALLOCATE( &
133         & igrdi, &
134         & igrdj, &
135         & zglam, &
136         & zgphi, &
137         & zmask, &
138         & z_thick_s_l  &
139         & )
140
141      IF(lwp)WRITE(numout,*) ' ------------- '
142      !
143   END SUBROUTINE obs_rea_snowdepth
144   
145   !!======================================================================
146END MODULE obs_readsnowdepth
Note: See TracBrowser for help on using the repository browser.