﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
890	Important: Updated ROMS interpolation Object	arango		"The interpolation module inside '''interpolate.F''' is renamed to '''roms_interpolate_mod''' to differentiate with other interpolation objects inside JEDI.  It now includes the following overloading routines:
 {{{
     INTERFACE roms_datum_interp
       MODULE PROCEDURE roms_datum_interp_2d
       MODULE PROCEDURE roms_datum_interp_3d
       MODULE PROCEDURE roms_datum_column_interp
     END INTERFACE roms_datum_interp
!
     INTERFACE roms_horiz_interp
       MODULE PROCEDURE roms_horiz_interp_2d
       MODULE PROCEDURE roms_horiz_interp_3d
     END INTERFACE roms_horiz_interp
}}}

All these overloading routines use the '''roms_interp_type''' object structure, say '''S''', for the '''ROMS-JEDI''' interface. In the future, it can be used for regridding inside ROMS. They can be used in different ways:

* Interpolate a ROMS 2D state field to observation locations ('''!ObsVetting''' is an optional output argument)
 {{{
CALL roms_datum_interp (S, fld2d, datum(:), method)
}}}

* Interpolate a ROMS 3D state field to observation locations ('''!ObsVetting''' is an optional output argument)
 {{{
CALL roms_datum_interp (S, fld3d, zfld3d, zlocs(:), datum(:), method)
}}}

* Interpolate a ROMS 3D state field to observation locations     level-by-level and returns '''datum(1:nlevs,1:nlocs)'''
 {{{
CALL roms_datum_interp (S, fld3d, zfld3d, datum(:,:), method)
}}}

* Interpolate a ROMS 2D source field to a new destination location (2D remapping)
 {{{
CALL roms_horiz_interp (S, fld2d_src, fld2d_dst, method)
}}}

* Interpolate a ROMS 3D source field to a new destination locations level-by-level (3D remapping)
 {{{
CALL roms_horiz_interp (S, fld2d_src, fld2d_dst, method)
}}}

It also includes managing routines for the ""roms_interp_type"" object.              

* Create a ROMS interpolation object
 {{{
CALL roms_interp_create (ng, S)
}}}
* Destroy interpolation object:
 {{{
CALL roms_interp_delete (S)
}}}
* Compute the horizontal fractional coordinates S%x_dst and S%y_dst of the source cells containing the destination values to facilitate interpolation.
 {{{
CALL roms_interp_fractional (S)
}}}

The adjoint of the interpolation object still needs to be coded when the design of the interpolation object is final.

Currently, the interpolation object has the following declarations:
 {{{
      TYPE :: roms_interp_type

        logical :: rectangular = .FALSE.            ! plaid grid switch
!
        integer :: ng                               ! nested grid number
        integer :: model                            ! model identifier
!
        real(r8):: spval                            ! unbounded value
!
!  Source grid array declaration bounds, tile partition range,
!  longitude/latitude, curvilinear angle, and land/sea mask
!
        integer :: LBi_src, UBi_src, LBj_src, UBj_src
        integer :: Istr_src, Iend_src, Jstr_src, Jend_src
!
        real(r8) :: min_src, max_src
!
        real(r8), pointer, dimension(:,:) :: lon_src   => NULL()
        real(r8), pointer, dimension(:,:) :: lat_src   => NULL()

        real(r8), pointer, dimension(:,:) :: angle_src => NULL()
        real(r8), pointer, dimension(:,:) :: mask_src  => NULL()
!
!  Destination grid array declaration bounds, tile partition range,
!  longitude/latitude, fractional coordinates, and land/sea mask.
!
        integer :: LBi_dst, UBi_dst, LBj_dst, UBj_dst
        integer :: Istr_dst, Iend_dst, Jstr_dst, Jend_dst
!
        real(r8) :: min_dst, max_dst
!
        real(r8), pointer, dimension(:,:) :: lon_dst  => NULL()
        real(r8), pointer, dimension(:,:) :: lat_dst  => NULL()

        real(r8), pointer, dimension(:,:) :: mask_dst => NULL()

        real(r8), allocatable :: x_dst(:,:)
        real(r8), allocatable :: y_dst(:,:)

      END TYPE roms_interp_type
}}}

It can be easily converted to a Fortran 2003 '''CLASS''' object by incorporating the interpolation and managing routines.
"	upgrade	closed	major	Release ROMS/TOMS 4.0	Nonlinear	3.9	Done		
