30 use kinds, only: r_kind, i_kind, r_single
37 integer :: npe, mype, mypelocal,ierror
47 character*180 :: geofile
48 character*2 :: workpath
51 integer :: map_proj, nlon, nlat
52 integer :: fv3lon, fv3lat, fv3times
53 integer :: lbclon, lbclat, lbctimes
54 integer :: i, j, t1, t2
55 integer :: num_args, ix
57 real :: rad2deg = 180.0/3.1415926
58 real :: userdx, userdy, cen_lat, cen_lon
59 real :: usertruelat1, usertruelat2, moad_cen_lat, stand_lon
60 real :: truelat1, truelat2, stdlon, lat1, lon1, r_earth
61 real :: knowni, knownj, dx
62 real :: one, pi, deg2rad
64 character(len=180) :: fv3file
65 character(len=180) :: fvcomfile
66 character(len=180),
dimension(:),
allocatable :: args
68 real(r_kind),
allocatable :: fv3ice(:,:), fv3sst(:,:)
69 real(r_kind),
allocatable :: fv3sfct(:,:), fv3mask(:,:)
70 real(r_kind),
allocatable :: fv3icet(:,:)
71 real(r_kind),
allocatable :: lbcice(:,:), lbcsst(:,:)
72 real(r_kind),
allocatable :: lbcsfct(:,:), lbcmask(:,:)
73 real(r_kind),
allocatable :: lbcicet(:,:)
78 integer :: update_type
84 call mpi_comm_size(mpi_comm_world,npe,ierror)
85 call mpi_comm_rank(mpi_comm_world,mype,ierror)
93 num_args = command_argument_count()
94 allocate(args(num_args))
97 call get_command_argument(ix,args(ix))
100 fv3file=trim(args(1))
101 write(*,*) trim(fv3file)
102 fvcomfile=trim(args(2))
103 write(*,*) trim(fvcomfile)
109 write(geofile,
'(a,a)') trim(workpath), trim(fv3file)
110 write(*,*)
'sfc data file', trim(geofile)
111 call geo%open(trim(geofile),
'r',200)
112 call geo%get_dim(
"xaxis_1",nlon)
113 call geo%get_dim(
"yaxis_1",nlat)
114 write(*,*)
'NLON,NLAT:', nlon, nlat
117 write(*,*)
'Finished reading sfc_data grid information.'
122 allocate(fv3ice(nlon,nlat))
123 allocate(fv3sfct(nlon,nlat))
124 allocate(fv3sst(nlon,nlat))
125 allocate(fv3mask(nlon,nlat))
126 allocate(fv3icet(nlon,nlat))
128 allocate(lbcice(nlon,nlat))
129 allocate(lbcsfct(nlon,nlat))
130 allocate(lbcsst(nlon,nlat))
131 allocate(lbcmask(nlon,nlat))
132 allocate(lbcicet(nlon,nlat))
139 call fcst%initial(
'FV3LAM')
140 call fcst%list_initial
141 call fcst%read_n(trim(fv3file),
'FV3LAM',fv3lon,fv3lat,fv3times,t1,fv3mask,fv3sst,fv3ice,fv3sfct,fv3icet)
145 write(*,*)
'fv3times: ', fv3times
146 write(*,*)
'time to use: ', t1
152 call fcst%initial(
' FVCOM')
153 call fcst%list_initial
154 call fcst%read_n(trim(fvcomfile),
' FVCOM',lbclon,lbclat,lbctimes,t2,lbcmask,lbcsst,lbcice,lbcsfct,lbcicet)
159 if (lbclon .ne. nlon .or. lbclat .ne. nlat)
then
160 write(*,*)
'ERROR: FVCOM/FV3 dimensions do not match:'
161 write(*,*)
'lbclon: ', lbclon
162 write(*,*)
'nlon: ', nlon
163 write(*,*)
'lbclat: ', lbclat
164 write(*,*)
'nlat: ', nlat
168 write(*,*)
'lbctimes: ', lbctimes
169 write(*,*)
'time to use: ', t2
178 if (lbcmask(i,j) > 0. .and. lbcsst(i,j) .ge. -90.0)
then
180 if (lbcice(i,j) < 0.15)
then
183 fv3ice(i,j) = lbcice(i,j)
185 if (lbcice(i,j) > 0. .and. fv3mask(i,j) == 0.)
then
189 if (fv3mask(i,j) == 2. .and. lbcice(i,j) == 0.)
then
192 fv3sst(i,j) = lbcsst(i,j) + 273.15
193 fv3sfct(i,j) = lbcsst(i,j) + 273.15
194 fv3icet(i,j) = lbcsst(i,j) + 273.15
196 if (lbcice(i,j) > 0.)
then
197 fv3icet(i,j) = lbcicet(i,j) + 273.15
205 call geo%open(trim(fv3file),
'w',300)
206 call geo%replace_var(
"tsea",nlon,nlat,fv3sst)
207 call geo%replace_var(
"fice",nlon,nlat,fv3ice)
208 call geo%replace_var(
"slmsk",nlon,nlat,fv3mask)
209 call geo%replace_var(
"tisfc",nlon,nlat,fv3icet)
211 call geo%add_new_var(
'glmsk',
'xaxis_1',
'yaxis_1',
'Time',
'glmsk',
'none')
212 call geo%replace_var(
'glmsk',nlon,nlat,lbcmask)
215 write(6,*)
"=== LOWBC UPDATE SUCCESS ==="
219 call mpi_finalize(ierror)
Module to hold specification kinds for variable declaration.
Functions to read and write netcdf files.
This module defines FV3LAM and FVCOM forecast data structure and the method to read and write observa...
program process_fvcom
Put lake surface temperature and aerial ice concentration from GLERL-provided FVCOM forecast files (w...