52 open_namelist_file, close_file, stdlog, &
53 mpp_pe, mpp_root_pe, write_version_number, &
97 character(len=128) ::
topog_file =
'DATA/navy_topography.data', &
137 #include<file_version.h> 151 call write_version_number(
"TOPOGRAPHY_MOD", version)
196 real,
intent(in),
dimension(:) :: blon, blat
197 real,
intent(out),
dimension(:,:) :: zmean
203 if ( any(shape(zmean(:,:)) /= (/
size(blon(:))-1,
size(blat(:))-1/)) ) &
204 call error_mesg(
'get_topog_mean_1d',
'shape(zmean) is not& 205 & equal to (/size(blon)-1,size(blat)-1/))', fatal)
222 real,
intent(in),
dimension(:,:) :: blon, blat
223 real,
intent(out),
dimension(:,:) :: zmean
229 if ( any(shape(zmean(:,:)) /= (/
size(blon,1)-1,
size(blon,2)-1/)) .or. &
230 any(shape(zmean(:,:)) /= (/
size(blat,1)-1,
size(blat,2)-1/)) ) &
231 call error_mesg(
'get_topog_mean_2d',
'shape(zmean) is not& 232 & equal to (/size(blon,1)-1,size(blon,2)-1/))', fatal)
281 real,
intent(in),
dimension(:) :: blon, blat
282 real,
intent(out),
dimension(:,:) :: stdev
288 if ( any(shape(stdev(:,:)) /= (/
size(blon(:))-1,
size(blat(:))-1/)) ) &
289 call error_mesg(
'get_topog_stdev',
'shape(stdev) is not& 290 & equal to (/size(blon)-1,size(blat)-1/))', fatal)
307 real,
intent(in),
dimension(:,:) :: blon, blat
308 real,
intent(out),
dimension(:,:) :: stdev
314 if ( any(shape(stdev(:,:)) /= (/
size(blon,1)-1,
size(blon,2)-1/)) .or. &
315 any(shape(stdev(:,:)) /= (/
size(blat,1)-1,
size(blat,2)-1/)) ) &
316 call error_mesg(
'get_topog_stdev_2d',
'shape(stdev) is not& 317 & equal to (/size(blon,1)-1,size(blon,2)-1/))', fatal)
363 real,
intent(in),
dimension(:) :: blon, blat
364 real,
intent(out),
dimension(:,:) :: ocean_frac
370 if ( any(shape(ocean_frac(:,:)) /= (/
size(blon(:))-1,
size(blat(:))-1/)) ) &
371 call error_mesg(
'get_ocean_frac',
'shape(ocean_frac) is not& 372 & equal to (/size(blon)-1,size(blat)-1/))', fatal)
389 real,
intent(in),
dimension(:,:) :: blon, blat
390 real,
intent(out),
dimension(:,:) :: ocean_frac
396 if ( any(shape(ocean_frac(:,:)) /= (/
size(blon,1)-1,
size(blon,2)-1/)) .or. &
397 any(shape(ocean_frac(:,:)) /= (/
size(blat,1)-1,
size(blat,2)-1/)) ) &
398 call error_mesg(
'get_ocean_frac_2d',
'shape(ocean_frac) is not& 399 & equal to (/size(blon,1)-1,size(blon,2)-1/))', fatal)
444 real ,
intent(in),
dimension(:) :: blon, blat
445 logical,
intent(out),
dimension(:,:) :: ocean_mask
448 real,
dimension(size(ocean_mask,1),size(ocean_mask,2)) :: ocean_frac
453 where (ocean_frac > 0.50)
471 real ,
intent(in),
dimension(:,:) :: blon, blat
472 logical,
intent(out),
dimension(:,:) :: ocean_mask
475 real,
dimension(size(ocean_mask,1),size(ocean_mask,2)) :: ocean_frac
480 where (ocean_frac > 0.50)
529 real,
intent(in),
dimension(:) :: blon, blat
530 real,
intent(out),
dimension(:,:) :: water_frac
536 if ( any(shape(water_frac(:,:)) /= (/
size(blon(:))-1,
size(blat(:))-1/)) ) &
537 call error_mesg(
'get_water_frac_1d',
'shape(water_frac) is not& 538 & equal to (/size(blon)-1,size(blat)-1/))', fatal)
555 real,
intent(in),
dimension(:,:) :: blon, blat
556 real,
intent(out),
dimension(:,:) :: water_frac
562 if ( any(shape(water_frac(:,:)) /= (/
size(blon,1)-1,
size(blon,2)-1/)) .or. &
563 any(shape(water_frac(:,:)) /= (/
size(blat,1)-1,
size(blat,2)-1/)) ) &
564 call error_mesg(
'get_water_frac_2d',
'shape(water_frac) is not& 565 & equal to (/size(blon,1)-1,size(blon,2)-1/))', fatal)
610 real ,
intent(in),
dimension(:) :: blon, blat
611 logical,
intent(out),
dimension(:,:) :: water_mask
614 real,
dimension(size(water_mask,1),size(water_mask,2)) :: water_frac
619 where (water_frac > 0.50)
637 real ,
intent(in),
dimension(:,:) :: blon, blat
638 logical,
intent(out),
dimension(:,:) :: water_mask
641 real,
dimension(size(water_mask,1),size(water_mask,2)) :: water_frac
646 where (water_frac > 0.50)
667 character(len=*),
intent(in) :: filename
669 real :: r_ipts, r_jpts
672 namelen = len(trim(filename))
673 if ( file_exist(filename) .AND. filename(namelen-2:namelen) ==
'.nc')
then 674 if (mpp_pe() == mpp_root_pe())
call mpp_error (
'topography_mod', &
675 'Reading NetCDF formatted input data file: '//filename, note)
676 call read_data(filename,
'ipts', r_ipts, no_domain=.true.)
677 call read_data(filename,
'jpts', r_jpts, no_domain=.true.)
682 if ( file_exist(filename) )
then 683 if (mpp_pe() == mpp_root_pe())
call mpp_error (
'topography_mod', &
684 'Reading native formatted input data file: '//filename, note)
685 unit = open_ieee32_file(trim(filename),
'read')
698 real ,
intent(in) :: blon(:), blat(:)
699 real ,
intent(out) :: zout(:,:)
700 integer,
intent(in),
optional :: flag
702 real :: xdat(ipts+1), ydat(jpts+1)
703 real :: zdat(ipts,jpts)
704 real :: zout2(size(zout,1),size(zout,2))
708 call horiz_interp ( zdat, xdat, ydat, blon, blat, zout )
711 if (
present(flag))
then 714 call horiz_interp ( zdat, xdat, ydat, blon, blat, zout2 )
715 zout = zout2 - zout*zout
729 real ,
intent(in) :: blon(:,:), blat(:,:)
730 real ,
intent(out) :: zout(:,:)
731 integer,
intent(in),
optional :: flag
733 real :: xdat(ipts+1), ydat(jpts+1)
734 real :: zdat(ipts,jpts)
735 real :: zout2(size(zout,1),size(zout,2))
737 type(horiz_interp_type) :: interp
740 call find_indices ( minval(blat), maxval(blat), ydat, js, je )
746 if (
present(flag))
then 750 zout = zout2 - zout*zout
766 real,
intent(in) :: ybeg, yend, ydat(:)
767 integer,
intent(out) :: js, je
771 do j = 1,
size(ydat(:))-1
772 if (ybeg >= ydat(j) .and. ybeg <= ydat(j+1))
then 779 do j = js,
size(ydat(:))-1
780 if (yend >= ydat(j) .and. yend <= ydat(j+1))
then 792 subroutine input_data ( ifile, xdat, ydat, zdat )
793 character(len=*),
intent(in) :: ifile
794 real,
intent(out) :: xdat(ipts+1), ydat(jpts+1), zdat(ipts,jpts)
801 if ( file_exist(trim(ifile)) .AND. ifile(nc-2:nc) ==
'.nc')
then 802 call read_data(trim(ifile),
'xdat', xdat, no_domain=.true.)
803 call read_data(trim(ifile),
'ydat', ydat, no_domain=.true.)
804 call read_data(trim(ifile),
'zdat', zdat, no_domain=.true.)
806 read (unit) xdat, ydat
808 call close_file (unit)
816 real ,
intent(in) :: blon(:), blat(:)
817 real ,
intent(out) :: zout(:,:)
818 logical,
intent(in),
optional :: do_ocean
820 real :: xdat(ipts+1), ydat(jpts+1), zdat(ipts,jpts)
825 if (
present(do_ocean))
then 830 call horiz_interp ( zdat, xdat, ydat, blon, blat, zout )
837 real ,
intent(in) :: blon(:,:), blat(:,:)
838 real ,
intent(out) :: zout(:,:)
839 logical,
intent(in),
optional :: do_ocean
841 real :: xdat(ipts+1), ydat(jpts+1), zdat(ipts,jpts)
846 if (
present(do_ocean))
then 851 call horiz_interp ( zdat, xdat, ydat, blon, blat, zout )
858 real,
intent(inout) :: pctwater(:,:)
859 logical :: ocean(size(pctwater,1),size(pctwater,2))
860 integer :: i, j, m, n, im, ip, jm, jp, new
862 real :: ocean_pct_crit = .500
873 ocean = (pctwater > .999)
885 if (.not.ocean(i,j) .and. pctwater(i,j) > ocean_pct_crit)
then 886 im = i-1; ip = i+1; jm = j-1; jp = j+1
888 if (ip == m+1) ip = 1
890 if (jp == n+1) jp = n
892 if (ocean(im,j ) .or. ocean(ip,j ) .or. ocean(i ,jm) .or. ocean(i ,jp) .or. &
893 ocean(im,jm) .or. ocean(ip,jm) .or. ocean(ip,jp) .or. ocean(im,jp))
then 905 where (.not.ocean) pctwater = 0.
915 integer :: unit, ierr, io
919 #ifdef INTERNAL_FILE_NML 923 if ( file_exist(
'input.nml'))
then 924 unit = open_namelist_file( )
925 ierr=1;
do while (ierr /= 0)
926 read (unit, nml=topography_nml, iostat=io, end=10)
929 10
call close_file (unit)
935 if (mpp_pe() == mpp_root_pe())
then 937 write (unit, nml=topography_nml)
subroutine interp_water_1d(blon, blat, zout, do_ocean)
subroutine, public topography_init()
logical function get_water_mask_2d(blon, blat, water_mask)
logical function get_topog_stdev_1d(blon, blat, stdev)
logical function get_ocean_frac_1d(blon, blat, ocean_frac)
subroutine, public horiz_interp_del(Interp)
logical module_is_initialized
logical function get_water_frac_2d(blon, blat, water_frac)
logical function get_ocean_mask_1d(blon, blat, ocean_mask)
subroutine interp_topog_2d(blon, blat, zout, flag)
integer function, public check_nml_error(IOSTAT, NML_NAME)
logical function get_water_frac_1d(blon, blat, water_frac)
logical function get_topog_mean_2d(blon, blat, zmean)
logical function get_ocean_mask_2d(blon, blat, ocean_mask)
character(len=input_str_length), dimension(:), allocatable, target, public input_nml_file
subroutine find_indices(ybeg, yend, ydat, js, je)
subroutine, public gaussian_topog_init(lon, lat, zsurf)
logical function get_water_mask_1d(blon, blat, water_mask)
logical function get_topog_stdev_2d(blon, blat, stdev)
logical function open_topog_file(filename)
logical function get_topog_mean_1d(blon, blat, zmean)
real function, dimension(size(lon, 1), size(lat, 1)), public get_gaussian_topog(lon, lat, height, olond, olatd, wlond, wlatd, rlond, rlatd)
character(len=128) topog_file
subroutine interp_topog_1d(blon, blat, zout, flag)
integer, parameter compute_stdev
subroutine input_data(ifile, xdat, ydat, zdat)
character(len=128) water_file
subroutine interp_water_2d(blon, blat, zout, do_ocean)
subroutine, public error_mesg(routine, message, level)
logical function get_ocean_frac_2d(blon, blat, ocean_frac)
subroutine determine_ocean_points(pctwater)
real(fp), parameter, public pi