forked from NOAA-GFDL/FMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_data_4d.inc
55 lines (48 loc) · 2.03 KB
/
read_data_4d.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
! -*-f90-*-
!***********************************************************************
!* GNU Lesser General Public License
!*
!* This file is part of the GFDL Flexible Modeling System (FMS).
!*
!* FMS is free software: you can redistribute it and/or modify it under
!* the terms of the GNU Lesser General Public License as published by
!* the Free Software Foundation, either version 3 of the License, or (at
!* your option) any later version.
!*
!* FMS is distributed in the hope that it will be useful, but WITHOUT
!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
!* for more details.
!*
!* You should have received a copy of the GNU Lesser General Public
!* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
!***********************************************************************
if((size(data,1)== ied-isd+1).and.(size(data,2)==jed-jsd+1)) then
no_halo = .false.
elseif ((size(data,1)== ie-is+1).and.(size(data,2)==je-js+1)) then
no_halo = .true.
else
call mpp_error(FATAL,'fms_io read_data_4d, data must be either data or compute domain')
endif
if (.not.module_is_initialized) call fms_io_init ( )
if (.not.associated(Current_domain)) call mpp_error &
(FATAL,'set_domain not called')
if (present(end)) end = .false.
if (do_read()) read (unit,end=10) gdata
if (.not.read_all_pe) then
! did not read on all PEs need to broadcast data
len = size(gdata,1)*size(gdata,2)*size(gdata,3)*size(gdata,4)
! call mpp_transmit ( gdata, len, ALL_PES, &
! gdata, len, 0 )
call mpp_broadcast ( gdata, len, mpp_root_pe() )
endif
! return data for compute domain
if(.not. no_halo .or. read_data_bug) then
! data defined on data domain
data(is:ie,js:je,:,:) = gdata(is:ie,js:je,:,:)
else
! data defined on compute domain
data(:,:,:,:) = gdata(is:ie,js:je,:,:)
endif
return
10 call read_eof (end)