save_img Subroutine

private subroutine save_img(tab)

Note

Function that save an array tab as a digital surf file.

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(:,:) :: tab

a surface to save as a .sur file


Calls

proc~~save_img~~CallsGraph proc~save_img save_img init_scal init_scal proc~save_img->init_scal write_surf write_surf proc~save_img->write_surf

Called by

proc~~save_img~~CalledByGraph proc~save_img save_img proc~read_job read_job proc~read_job->proc~save_img proc~prg_surf prg_surf proc~prg_surf->proc~read_job program~main main program~main->proc~prg_surf

Source Code

   subroutine save_img(tab)
   !================================================================================================
   !<@note Function that save an array *tab* as a digital surf file.
   !
   !<@endnote
   !------------------------------------------------------------------------------------------------
   implicit none
   real(kind=R8), intent(in), dimension(:,:) :: tab !! *a surface to save as a .sur file*

      integer(kind=I4) :: w ! image width
      integer(kind=I4) :: h ! image height

      integer(kind=I4), dimension(1:2) :: shape_tab

      character(len=512) :: nom_surf

      type(SCALE_SURF) :: scale_img

      shape_tab = shape( tab )
      w = shape_tab(1)
      h = shape_tab(2)

      nom_surf = repeat (" ", len(nom_surf) )

      read(JOB,*) nom_surf ; LINE_READ = LINE_READ + 1 ; write(SPY,*) "line: ", LINE_READ, trim(nom_surf)

      call init_scal( scal = scale_img,          &           ! out; creates a surface type, containing ...
                        nx = w,                  &           !  in; ... the number of points along x ...
                        ny = h,                  &           !  in; ... the number of points along y ...
                        lx = PARAM%surf_width,   &           !  in; ... the length (default unit : m) ...
                        ly = PARAM%surf_height,  &           !  in; ... the width ...
                    unit_z = 'm'        )                    !  in; ... and the unit along z.

      call write_surf( nom_fic = trim(nom_surf),          &  !
                         tab_s = tab(1:w, 1:h),           &  !
                          scal = scale_img )                 !

   return
   endsubroutine save_img