From e09a5c3e75dac51e28d65c7c267f213065b965d9 Mon Sep 17 00:00:00 2001 From: jswhit Date: Fri, 7 Dec 2018 15:47:01 +0000 Subject: [PATCH 001/155] update --- src/enkf/gridinfo_gfs.f90 | 2 +- src/enkf/params.f90 | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/enkf/gridinfo_gfs.f90 b/src/enkf/gridinfo_gfs.f90 index f217f027f6..ae26035fbe 100644 --- a/src/enkf/gridinfo_gfs.f90 +++ b/src/enkf/gridinfo_gfs.f90 @@ -7,7 +7,7 @@ module gridinfo ! ! prgmmr: whitaker org: esrl/psd date: 2009-02-23 ! -! abstract: This module reads gfg_YYYYMMDDHH_fhr06_ensmean, and +! abstract: This module reads the ensemble mean background file and ! extracts information about the analysis grid, including the ! longitudes and latitudes of the analysis grid points and ! the pressure on each grid point/vertical level. diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index b3717b712a..86a5c86140 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -183,6 +183,12 @@ module params ! if true, use netcdf diag files, otherwise use binary diags logical,public :: netcdf_diag = .false. +! use fv3 cubed-sphere tiled restart files +logical,public :: fv3_native = .false. +character(len=500),public :: fv3fixpath = ' ' +integer(i_kind),public :: ntiles=6 +integer(i_kind),public :: res=0 + namelist /nam_enkf/datestring,datapath,iassim_order,nvars,& covinflatemax,covinflatemin,deterministic,sortinc,& corrlengthnh,corrlengthtr,corrlengthsh,& @@ -202,13 +208,13 @@ module params save_inflation,nobsl_max,lobsdiag_forenkf,netcdf_diag,& letkf_flag,massbal_adjust,use_edges,emiss_bc,iseed_perturbed_obs,npefiles,& getkf,getkf_inflation,denkf,modelspace_vloc,dfs_sort,write_spread_diag,& - fso_cycling,fso_calculate,imp_physics,lupp + fso_cycling,fso_calculate,imp_physics,lupp,fv3_native namelist /nam_wrf/arw,nmm,nmm_restart +namelist /nam_fv3/fv3fixpath,res,ntiles namelist /satobs_enkf/sattypes_rad,dsis namelist /ozobs_enkf/sattypes_oz - contains subroutine read_namelist() @@ -282,7 +288,7 @@ subroutine read_namelist() sortinc = .true. ! type of GFS microphyics. ! 99: Zhao-Carr, 11: GFDL -imp_physics = 99 +imp_physics = 11 ! lupp, if true output extra variables lupp = .false. ! these are all mandatory. @@ -338,6 +344,10 @@ subroutine read_namelist() if (regional) then read(912,nam_wrf) endif +if (fv3_native) then + read(912,nam_fv3) + nlons = res; nlats = res ! (total number of pts = ntiles*res*res) +endif close(912) ! find number of satellite files @@ -465,6 +475,10 @@ subroutine read_namelist() print *, 'must select either arw, nmm or nmmb regional dynamical core' call stop2(19) endif + if (fv3_native .and. (fv3fixpath == ' ' .or. res == 0)) then + print *, 'must specify res and fv3fixpath when fv3_native is true' + call stop2(19) + endif if (letkf_flag .and. univaroz) then print *,'univaroz is not supported in LETKF!' call stop2(19) @@ -474,6 +488,7 @@ subroutine read_namelist() print *,'warning: no time localization in LETKF!' endif + print *, trim(adjustl(datapath)) if (datestring .ne. '0000000000') print *, 'analysis time ',datestring if (neigv > 0) then From b28ea8dc7728aaa1448d9a5dd287fcf0f56661c9 Mon Sep 17 00:00:00 2001 From: jswhit Date: Fri, 7 Dec 2018 15:52:39 +0000 Subject: [PATCH 002/155] update --- src/enkf/fv3_netcdf_mod.F90 | 38 +++++ src/enkf/gridinfo_fv3.f90 | 226 +++++++++++++++++++++++++++++ src/enkf/read_fv3_restart_data.f90 | 8 + src/enkf/read_fv3_restarts.f90 | 165 +++++++++++++++++++++ 4 files changed, 437 insertions(+) create mode 100644 src/enkf/fv3_netcdf_mod.F90 create mode 100644 src/enkf/gridinfo_fv3.f90 create mode 100644 src/enkf/read_fv3_restart_data.f90 create mode 100644 src/enkf/read_fv3_restarts.f90 diff --git a/src/enkf/fv3_netcdf_mod.F90 b/src/enkf/fv3_netcdf_mod.F90 new file mode 100644 index 0000000000..05da48e973 --- /dev/null +++ b/src/enkf/fv3_netcdf_mod.F90 @@ -0,0 +1,38 @@ +module fv3_netcdf_mod + +use kinds, only: r_kind, i_kind, r_double, r_single +use netcdf, only: nf90_get_var,nf90_inq_varid +use netcdf_mod, only: nc_check + +implicit none + +private +public :: read_fv3_restart_data1d, read_fv3_restart_data2d, & + read_fv3_restart_data3d, read_fv3_restart_data4d +contains + + subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data1d + + subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data2d + + subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data3d + + subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data4d + +end module fv3_netcdf_mod diff --git a/src/enkf/gridinfo_fv3.f90 b/src/enkf/gridinfo_fv3.f90 new file mode 100644 index 0000000000..0ea1fb3939 --- /dev/null +++ b/src/enkf/gridinfo_fv3.f90 @@ -0,0 +1,226 @@ +module gridinfo +!$$$ module documentation block +! +! module: gridinfo read horizontal (lons, lats) and +! vertical (pressure) information from +! ensemble mean first guess file. +! +! prgmmr: whitaker org: esrl/psd date: 2009-02-23 +! +! abstract: This module reads the ensemble mean background file and +! extracts information about the analysis grid, including the +! longitudes and latitudes of the analysis grid points and +! the pressure on each grid point/vertical level. +! +! Public Subroutines: +! getgridinfo: read latitudes, longitudes, pressures and orography for analysis grid, +! broadcast to each task. Compute spherical cartesian coordinate values +! for each analysis horizontal grid point. +! gridinfo_cleanup: deallocate allocated module variables. +! +! Public Variables: +! npts: number of analysis grid points in the horizontal (from module params). +! nlevs: number of analysis vertical levels (from module params). +! specific humidity, ozone and cloud condensate). +! ptop: (real scalar) pressure (hPa) at top model layer interface. +! lonsgrd(npts): real array of analysis grid longitudes (radians). +! latsgrd(npts): real array of analysis grid latitudes (radians). +! logp(npts,ndim): -log(press) for all 2d analysis grids. Assumed invariant +! in assimilation window, computed fro ensemble mean at middle of window. +! gridloc(3,npts): spherical cartesian coordinates (x,y,z) for analysis grid. +! +! Modules Used: mpisetup, params, kinds +! +! program history log: +! 2009-02-23 Initial version. +! 2016-05-02: shlyaeva: Modification for reading state vector from table +! 2016-04-20 Modify to handle the updated nemsio sig file (P, DP & DPDT removed) +! +! attributes: +! language: f95 +! +!$$$ + +use mpisetup, only: nproc, mpi_integer, mpi_real4, mpi_comm_world +use params, only: datapath,nlevs,nlons,nlats,use_gfs_nemsio, fgfileprefixes, & + fv3fixpath, res, ntiles +use kinds, only: r_kind, i_kind, r_double, r_single +use constants, only: one,zero,pi,cp,rd,grav,rearth,max_varname_length +use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr +use netcdf, only: nf90_inq_dimid,nf90_inq_varid +use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension +use netcdf_mod, only: nc_check + +implicit none +private +public :: getgridinfo, gridinfo_cleanup +integer(i_kind),public :: nlevs_pres, idvc +real(r_single),public :: ptop +real(r_single),public, allocatable, dimension(:) :: lonsgrd, latsgrd +! arrays passed to kdtree2 routines must be single +real(r_single),public, allocatable, dimension(:,:) :: gridloc +real(r_single),public, allocatable, dimension(:,:) :: logp +integer,public :: npts +integer,public :: ntrunc +! supported variable names in anavinfo +character(len=max_varname_length),public, dimension(10) :: vars3d_supported = (/'u ', 'v ', 'tv ', 'q ', 'oz ', 'cw ', 'tsen', 'prse', 'ql ', 'qi '/) +character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) +! supported variable names in anavinfo +contains + +subroutine getgridinfo(fileprefix, reducedgrid) +! read latitudes, longitudes and pressures for analysis grid, +! broadcast to each task. +use fv3_netcdf_mod, only: read_restart_data2d +implicit none + +character(len=120), intent(in) :: fileprefix +logical, intent(in) :: reducedgrid + +integer(i_kind) nlevsin, ierr, iunit, k, nn, idvc +character(len=500) filename +integer(i_kind) iret,i,j,nlonsin,nlatsin +real(r_kind), allocatable, dimension(:) :: spressmn,tmpspec +real(r_kind), allocatable, dimension(:,:) :: pressimn,presslmn +real(r_single),allocatable,dimension(:,:,:) :: nems_vcoord +real(r_kind) kap,kapr,kap1 + +integer(i_kind) i,j,nn,file_id,var_id,dim_id,nlevsp1 +real(r_single), allocatable, dimension(:,:) :: ak,bk,lat_tile,lon_tile,ps +real(r_single), allocatable, dimension(:,:,:,:) :: delp +real(r_single) ptop +character(len=4) char_res +character(len=1) char_tile + +nlevsp1 = nlevs + 1 +nlevs_pres = nlevsp1 +npts = ntiles*res*res +kap = rd/cp +kapr = cp/rd +kap1 = kap + one + +! read data on root task +if (nproc .eq. 0) then + + ! read ak,bk from ensmean fv_core.res.nc + filename = trim(adjustl(fileprefix))//'/ensmean/INPUT/fv_core.res.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& + myname_,'inq_dimid xaxis_1 '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1),& + myname_,'inquire_dimension xaxis_1 '//trim(filename) ) + allocate(ak(nlevsp1,1),bk(nlevsp1,1)) + call read_fv3_restart_data2d('ak',filename,file_id,ak) + call read_fv3_restart_data2d('bk',filename,file_id,bk) + ptop = ak(1,1) + + ! read lats/lons from C###_oro_data.tile#.nc + ! (this requires path to FV3 fix dir) + write(char_res, '(i4)') res + allocate(lat_tile(res,res),lon_tile(res,res)) + nn = 0 + allocate(latsgrd(npts),lonsgrd(npts)) + do ntile=1,ntiles + nn = nn + 1 + write(char_tile, '(i1)') ntile + filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call read_fv3_restart_data2d('geolon',filename,file_id,lon_tile) + !print *,'min/max lon_tile',ntile,minval(lon_tile),maxval(lon_tile) + call read_fv3_restart_data2d('geolat',filename,file_id,lat_tile) + !print *,'min/max lat_tile',ntile,minval(lat_tile),maxval(lat_tile) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + do j=1,res + do i=1,res + latsgrd(nn) = lats_tile(i,j) + lonsgrd(nn) = lons_tile(i,j) + enddo + enddo + latsgrd = pi*latsgrd/180._r_single + lonsgrd = pi*lonsgrd/180._r_single + enddo + + allocate(delp(res,res,nlevs,1),ps(res,nres)) + allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) + nn = 0 + do ntile=1,ntiles + nn = nn + 1 + write(char_tile, '(i1)') ntile + filename = trim(adjustl(datapath))//'/ensmean/fv_core.res.tile'//char_tile//'.nc' + !print *,trim(adjustl(filename)) + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call read_fv3_restart_data4d('delp',filename,file_id,delp) + !print *,'min/max delp',ntile,minval(delp),maxval(delp) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + ps = sum(delp,3) + ptop + !print *,'min/max ps',ntile,minval(ps),maxval(ps) + do j=1,res + do i=1,res + spressmn(nn) = ps(i,j) + enddo + enddo + enddo + ! pressure at interfaces + do k=1,nlevsp1 + pressimn(:,k) = ak(nlevs-k,1)+bk(nlevs-k,1)*spressmn(:) + enddo + deallocate(delp,ak,bk,ps) + do k=1,nlevs + ! layer pressure from Phillips vertical interpolation. + presslmn(:,k) = ((pressimn(:,k)**kap1-pressimn(:,k+1)**kap1)/& + (kap1*(pressimn(:,k)-pressimn(:,k+1))))**kapr + end do + print *,'ensemble mean first guess surface pressure:' + print *,minval(spressmn),maxval(spressmn) + ! logp holds log(pressure) or pseudo-height on grid, for each level/variable. + allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers + do k=1,nlevs + ! all variables to be updated are on mid-layers, not layer interfaces. + logp(:,k) = -log(presslmn(:,k)) + !print *,'min/max presslmn',k,minval(presslmn(:,k)),maxval(presslmn(:,k)),minval(logp(:,k)),maxval(logp(:,k)) + end do + logp(:,nlevs_pres) = -log(spressmn(:)) + deallocate(spressmn,presslmn,pressimn) + +endif ! root task + +if (nproc .ne. 0) then + ! allocate arrays on other (non-root) tasks + allocate(latsgrd(npts),lonsgrd(npts)) + allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers + allocate(gridloc(3,npts)) + ! initialize reducedgrid_mod on other tasks. + if (reducedgrid) then + call reducedgrid_init(nlons,nlats,asin_gaulats) + end if +endif +!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +do k=1,nlevs_pres + call mpi_bcast(logp(1,k),npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +enddo +call mpi_bcast(lonsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +call mpi_bcast(latsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +call mpi_bcast(ptop,1,mpi_real4,0,MPI_COMM_WORLD,ierr) + +!==> precompute cartesian coords of analysis grid points. +do nn=1,npts + gridloc(1,nn) = cos(latsgrd(nn))*cos(lonsgrd(nn)) + gridloc(2,nn) = cos(latsgrd(nn))*sin(lonsgrd(nn)) + gridloc(3,nn) = sin(latsgrd(nn)) +end do + +end subroutine getgridinfo + +subroutine gridinfo_cleanup() +if (allocated(lonsgrd)) deallocate(lonsgrd) +if (allocated(latsgrd)) deallocate(latsgrd) +if (allocated(logp)) deallocate(logp) +if (allocated(gridloc)) deallocate(gridloc) +end subroutine gridinfo_cleanup + +end module gridinfo diff --git a/src/enkf/read_fv3_restart_data.f90 b/src/enkf/read_fv3_restart_data.f90 new file mode 100644 index 0000000000..39a25cf6a6 --- /dev/null +++ b/src/enkf/read_fv3_restart_data.f90 @@ -0,0 +1,8 @@ + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& + myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) + call nc_check( nf90_get_var(file_id,var_id,data_arr),& + myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) diff --git a/src/enkf/read_fv3_restarts.f90 b/src/enkf/read_fv3_restarts.f90 new file mode 100644 index 0000000000..1542516f2e --- /dev/null +++ b/src/enkf/read_fv3_restarts.f90 @@ -0,0 +1,165 @@ + program read_fv3_restarts + +! ifort -I${NETCDF}/include -O2 -traceback read_fv3_restarts.f90 kinds.o +! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff + +! read data from FV3 restart files. + + use kinds, only: i_kind,r_single,r_kind + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf_mod, only: nc_check + + implicit none + character(len=120) datapath,filename,fv3fixpath + character(len=24),parameter :: myname_ = 'read_fv3_restarts' + character(len=4) char_res + character(len=1) char_tile + integer(i_kind):: file_id,var_id,dim_id + integer(i_kind):: nlevsp1,ntile,ntiles,nx,ny,res,nlevs + real(r_single), allocatable, dimension(:,:) :: ak,bk,lon_tile,lat_tile + real(r_single), allocatable, dimension(:,:,:) :: ps,zs + real(r_single), allocatable, dimension(:,:,:,:) :: & + delp,u,v,temp,q,oz,cwmr,icmr + real(r_single) ptop + real(r_single) :: grav=9.806 + + + ! these need to be input from namelist + ntiles = 6 + res = 192 + datapath='/scratch3/BMC/gsienkf/whitaker/C192C192_modloc/2016010606/mem001/INPUT' + fv3fixpath='/scratch4/NCEPDEV/global/save/glopara/svn/fv3gfs/fix/fix_fv3_gmted2010' + +! read ak,bk from fv_core.res.nc + filename = trim(adjustl(datapath))//'/fv_core.res.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& + myname_,'inq_dimid xaxis_1 '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1),& + myname_,'inquire_dimension xaxis_1 '//trim(filename) ) + nlevs = nlevsp1-1 + print *,'nlevsp1 = ',nlevsp1 + allocate(ak(nlevsp1,1),bk(nlevsp1,1)) + + call read_fv3_restart_data2d('ak',filename,file_id,ak) + call read_fv3_restart_data2d('bk',filename,file_id,bk) + ptop = ak(1,1) + print *,'ak=',ak + print *,'bk=',bk + +! read lats/lons from C###_oro_data.tile#.nc +! (this requires path to FV3 fix dir) + write(char_res, '(i4)') res + allocate(lat_tile(res,res),lon_tile(res,res)) + do ntile=1,ntiles + write(char_tile, '(i1)') ntile + filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' + print *,trim(adjustl(filename)) + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + call read_fv3_restart_data2d('geolon',filename,file_id,lon_tile) + print *,'min/max lon_tile',minval(lon_tile),maxval(lon_tile) + + call read_fv3_restart_data2d('geolat',filename,file_id,lat_tile) + print *,'min/max lat_tile',minval(lat_tile),maxval(lat_tile) + + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + enddo + +! read data from fv_core + allocate(delp(res,res,nlevs,1),u(res,res,nlevs,1),v(res,res,nlevs,1),temp(res,res,nlevs,1)) + allocate(ps(res,res,1),zs(res,res,1)) + do ntile=1,ntiles + + write(char_tile, '(i1)') ntile + filename = trim(adjustl(datapath))//'/fv_core.res.tile'//char_tile//'.nc' + print *,trim(adjustl(filename)) + + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + call read_fv3_restart_data4d('delp',filename,file_id,delp) + print *,'min/max delp',minval(delp),maxval(delp) + + call read_fv3_restart_data4d('u',filename,file_id,u) + print *,'min/max u',minval(u),maxval(u) + + call read_fv3_restart_data4d('v',filename,file_id,v) + print *,'min/max v',minval(v),maxval(v) + + call read_fv3_restart_data4d('T',filename,file_id,temp) + print *,'min/max T',minval(temp),maxval(temp) + + call read_fv3_restart_data3d('phis',filename,file_id,zs) + zs = zs/grav + print *,'min/max zs',minval(zs),maxval(zs) + ps = sum(delp,3) + ptop + print *,'min/max ps',minval(ps),maxval(ps) + + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + + enddo + +! read data from fv_tracer + allocate(q(res,res,nlevs,1),oz(res,res,nlevs,1),cwmr(res,res,nlevs,1),icmr(res,res,nlevs,1)) + do ntile=1,ntiles + + write(char_tile, '(i1)') ntile + filename = trim(adjustl(datapath))//'/fv_tracer.res.tile'//char_tile//'.nc' + print *,trim(adjustl(filename)) + + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + call read_fv3_restart_data4d('sphum',filename,file_id,q) + print *,'min/max spfhum',minval(q),maxval(q) + + call read_fv3_restart_data4d('o3mr',filename,file_id,oz) + print *,'min/max o3mr',minval(oz),maxval(oz) + + call read_fv3_restart_data4d('liq_wat',filename,file_id,cwmr) + print *,'min/max cwmr',minval(cwmr),maxval(cwmr) + + call read_fv3_restart_data4d('ice_wat',filename,file_id,icmr) + print *,'min/max icmr',minval(icmr),maxval(icmr) + + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + + enddo + + deallocate(ak,bk,lon_tile,lat_tile,delp,u,v,temp,zs,ps,q,oz,cwmr,icmr) + + contains + + subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data1d + + subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data2d + + subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data3d + + subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data4d + + end program read_fv3_restarts From 7b0d26efc7a314960a0a6864fabea916bad33099 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 21 Feb 2019 17:17:54 +0000 Subject: [PATCH 003/155] check in the initial version of the EnKF incorporating FV3 regional ensembles on developing mod. --- src/enkf/1 | 56 ++ src/enkf/CMakeCache.txt | 313 +++++++++ .../CMakeFiles/2.8.12.2/CMakeCCompiler.cmake | 56 ++ .../2.8.12.2/CMakeCXXCompiler.cmake | 57 ++ .../CMakeFiles/2.8.12.2/CMakeSystem.cmake | 15 + .../2.8.12.2/CompilerIdC/CMakeCCompilerId.c | 389 ++++++++++++ .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 377 +++++++++++ .../CMakeDirectoryInformation.cmake | 16 + src/enkf/CMakeFiles/CMakeOutput.log | 263 ++++++++ .../CMakeFiles/MODS1.dir/DependInfo.cmake | 38 ++ src/enkf/CMakeFiles/MODS1.dir/build.make | 88 +++ .../CMakeFiles/MODS1.dir/cmake_clean.cmake | 8 + src/enkf/CMakeFiles/MODS1.dir/depend.make | 2 + src/enkf/CMakeFiles/MODS1.dir/flags.make | 10 + src/enkf/CMakeFiles/MODS1.dir/progress.make | 2 + .../CMakeFiles/MODS2.dir/DependInfo.cmake | 38 ++ src/enkf/CMakeFiles/MODS2.dir/build.make | 88 +++ .../CMakeFiles/MODS2.dir/cmake_clean.cmake | 8 + src/enkf/CMakeFiles/MODS2.dir/depend.make | 2 + src/enkf/CMakeFiles/MODS2.dir/flags.make | 10 + src/enkf/CMakeFiles/MODS2.dir/progress.make | 2 + src/enkf/CMakeFiles/Makefile.cmake | 66 ++ src/enkf/CMakeFiles/Makefile2 | 67 ++ src/enkf/CMakeFiles/TargetDirectories.txt | 0 src/enkf/CMakeFiles/cmake.check_cache | 1 + .../enkf_gfs.x.dir/DependInfo.cmake | 43 ++ src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make | 167 +++++ .../enkf_gfs.x.dir/cmake_clean.cmake | 10 + .../CMakeFiles/enkf_gfs.x.dir/depend.make | 2 + src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make | 10 + src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt | 1 + .../CMakeFiles/enkf_gfs.x.dir/progress.make | 2 + .../enkfdeplib.dir/DependInfo.cmake | 60 ++ src/enkf/CMakeFiles/enkfdeplib.dir/build.make | 494 +++++++++++++++ .../enkfdeplib.dir/cmake_clean.cmake | 32 + .../enkfdeplib.dir/cmake_clean_target.cmake | 3 + .../CMakeFiles/enkfdeplib.dir/depend.make | 2 + src/enkf/CMakeFiles/enkfdeplib.dir/flags.make | 54 ++ src/enkf/CMakeFiles/enkfdeplib.dir/link.txt | 2 + .../CMakeFiles/enkfdeplib.dir/progress.make | 24 + .../CMakeFiles/enkflib.dir/DependInfo.cmake | 50 ++ src/enkf/CMakeFiles/enkflib.dir/build.make | 318 ++++++++++ .../CMakeFiles/enkflib.dir/cmake_clean.cmake | 22 + .../enkflib.dir/cmake_clean_target.cmake | 3 + src/enkf/CMakeFiles/enkflib.dir/depend.make | 2 + src/enkf/CMakeFiles/enkflib.dir/flags.make | 34 + src/enkf/CMakeFiles/enkflib.dir/link.txt | 2 + src/enkf/CMakeFiles/enkflib.dir/progress.make | 14 + src/enkf/CMakeFiles/progress.marks | 1 + src/enkf/CMakeLists.txt | 10 +- src/enkf/CTestTestfile.cmake | 6 + src/enkf/Makefile | 490 ++++----------- src/enkf/cmake_install.cmake | 44 ++ src/enkf/d0 | 1 + src/enkf/d1 | 1 + src/enkf/d2 | 1 + src/enkf/dd0 | 17 + src/enkf/fv3_netcdf_mod.F90 | 18 +- src/enkf/gridinfo_fv3.f90 | 2 +- src/enkf/gridinfo_fv3reg.f90 | 306 +++++++++ src/enkf/gridio_fv3reg.f90 | 594 ++++++++++++++++++ src/enkf/gridio_nmmb.f90 | 2 + src/enkf/observer_fv3reg.f90 | 156 +++++ src/enkf/params.f90 | 10 +- src/enkf/read_fv3_restart_data.f90 | 4 - src/enkf/read_fv3regional_restart_data.f90 | 8 + src/enkf/read_fv3regional_restarts.f90 | 60 ++ src/enkf/smooth_fv3reg.f90 | 23 + src/enkf/test.dot | 5 + src/enkf/write_fv3_restart_data.f90 | 4 + src/enkf/write_fv3regional_restarts.f90 | 60 ++ 71 files changed, 4760 insertions(+), 386 deletions(-) create mode 100644 src/enkf/1 create mode 100644 src/enkf/CMakeCache.txt create mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake create mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake create mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake create mode 100644 src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c create mode 100644 src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100644 src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake create mode 100644 src/enkf/CMakeFiles/CMakeOutput.log create mode 100644 src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake create mode 100644 src/enkf/CMakeFiles/MODS1.dir/build.make create mode 100644 src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake create mode 100644 src/enkf/CMakeFiles/MODS1.dir/depend.make create mode 100644 src/enkf/CMakeFiles/MODS1.dir/flags.make create mode 100644 src/enkf/CMakeFiles/MODS1.dir/progress.make create mode 100644 src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake create mode 100644 src/enkf/CMakeFiles/MODS2.dir/build.make create mode 100644 src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake create mode 100644 src/enkf/CMakeFiles/MODS2.dir/depend.make create mode 100644 src/enkf/CMakeFiles/MODS2.dir/flags.make create mode 100644 src/enkf/CMakeFiles/MODS2.dir/progress.make create mode 100644 src/enkf/CMakeFiles/Makefile.cmake create mode 100644 src/enkf/CMakeFiles/Makefile2 create mode 100644 src/enkf/CMakeFiles/TargetDirectories.txt create mode 100644 src/enkf/CMakeFiles/cmake.check_cache create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt create mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/build.make create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/depend.make create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/flags.make create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/link.txt create mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/progress.make create mode 100644 src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake create mode 100644 src/enkf/CMakeFiles/enkflib.dir/build.make create mode 100644 src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake create mode 100644 src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake create mode 100644 src/enkf/CMakeFiles/enkflib.dir/depend.make create mode 100644 src/enkf/CMakeFiles/enkflib.dir/flags.make create mode 100644 src/enkf/CMakeFiles/enkflib.dir/link.txt create mode 100644 src/enkf/CMakeFiles/enkflib.dir/progress.make create mode 100644 src/enkf/CMakeFiles/progress.marks create mode 100644 src/enkf/CTestTestfile.cmake create mode 100644 src/enkf/cmake_install.cmake create mode 100644 src/enkf/d0 create mode 100644 src/enkf/d1 create mode 100644 src/enkf/d2 create mode 100644 src/enkf/dd0 create mode 100644 src/enkf/gridinfo_fv3reg.f90 create mode 100644 src/enkf/gridio_fv3reg.f90 create mode 100644 src/enkf/observer_fv3reg.f90 create mode 100644 src/enkf/read_fv3regional_restart_data.f90 create mode 100644 src/enkf/read_fv3regional_restarts.f90 create mode 100644 src/enkf/smooth_fv3reg.f90 create mode 100644 src/enkf/test.dot create mode 100644 src/enkf/write_fv3_restart_data.f90 create mode 100644 src/enkf/write_fv3regional_restarts.f90 diff --git a/src/enkf/1 b/src/enkf/1 new file mode 100644 index 0000000000..cc20fa0646 --- /dev/null +++ b/src/enkf/1 @@ -0,0 +1,56 @@ +dd.f90:integer(i_kind),public :: nlevs_pres, idvc +dd.f90:nlevs_pres = nlevsp1 +dd.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +dd.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +dd.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +dd.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +dd.f90:do k=1,nlevs_pres +enkf.f90:use gridinfo, only: nlevs_pres +enkf.f90:real(r_single),dimension(nlevs_pres):: taperv +enkf.f90: do nn=1,nlevs_pres +enkf_obs_sensitivity.f90:use gridinfo, only: latsgrd,lonsgrd,nlevs_pres,npts +gridinfo_fv3.f90:integer(i_kind),public :: nlevs_pres, idvc +gridinfo_fv3.f90:nlevs_pres = nlevsp1 +gridinfo_fv3.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_fv3.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_fv3.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_fv3.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +gridinfo_fv3.f90:do k=1,nlevs_pres +gridinfo_fv3reg.f90:integer(i_kind) nlevs_pres,nlevsp1n,nlevsp2 +gridinfo_fv3reg.f90:nlevs_pres = nlevsp1 +gridinfo_fv3reg.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_fv3reg.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_fv3reg.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_fv3reg.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +gridinfo_fv3reg.f90:do k=1,nlevs_pres +gridinfo_gfs.f90:integer(i_kind),public :: nlevs_pres, idvc +gridinfo_gfs.f90:nlevs_pres=nlevs+1 +gridinfo_gfs.f90: allocate(nems_vcoord(nlevs_pres,3,2)) +gridinfo_gfs.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_gfs.f90: call regtoreduced(spressmn,logp(:,nlevs_pres)) +gridinfo_gfs.f90: logp(:,nlevs_pres) = -log(logp(:,nlevs_pres)) +gridinfo_gfs.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_gfs.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_gfs.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +gridinfo_gfs.f90:do k=1,nlevs_pres +gridinfo_nmmb.f90:integer(i_kind),public :: nlevs_pres +gridinfo_nmmb.f90:nlevs_pres=nlevs+1 +gridinfo_nmmb.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_nmmb.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_nmmb.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers +gridinfo_nmmb.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +gridinfo_nmmb.f90:do k=1,nlevs_pres +gridinfo_wrf.f90: integer(i_kind), public :: nlevs_pres +gridinfo_wrf.f90: nlevs_pres=dimensions%zdim+1 +gridinfo_wrf.f90: if(.not. allocated(logp)) allocate(logp(npts,nlevs_pres)) +gridinfo_wrf.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_wrf.f90: call MPI_Bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +gridinfo_wrf.f90: nlevs_pres=dimensions%zdim+1 +gridinfo_wrf.f90: if(.not. allocated(logp)) allocate(logp(npts,nlevs_pres)) +gridinfo_wrf.f90: logp(:,nlevs_pres) = -log(spressmn(:)) +gridinfo_wrf.f90: call MPI_Bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +letkf.F90:use gridinfo, only: nlevs_pres,lonsgrd,latsgrd,logp,npts,gridloc +letkf.F90: nnmax = nlevs_pres +loadbal.f90:use gridinfo, only: gridloc, logp, latsgrd, nlevs_pres, npts +loadbal.f90:allocate(lnp_chunk(numptsperproc(nproc+1),nlevs_pres)) +loadbal.f90: do nn=1,nlevs_pres diff --git a/src/enkf/CMakeCache.txt b/src/enkf/CMakeCache.txt new file mode 100644 index 0000000000..36930e0d08 --- /dev/null +++ b/src/enkf/CMakeCache.txt @@ -0,0 +1,313 @@ +# This is the CMakeCache file. +# For build in directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_AR:FILEPATH=/bin/ar + +//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or +// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler. +CMAKE_CXX_COMPILER:FILEPATH=/bin/c++ + +//Flags used by the compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the compiler during debug builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the compiler during release minsize builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the compiler during release builds (/MD /Ob1 /Oi +// /Ot /Oy /Gs will produce slightly less optimized but smaller +// files). +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the compiler during Release with Debug Info builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler. +CMAKE_C_COMPILER:FILEPATH=/bin/cc + +//Flags used by the compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the compiler during debug builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the compiler during release minsize builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the compiler during release builds (/MD /Ob1 /Oi +// /Ot /Oy /Gs will produce slightly less optimized but smaller +// files). +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the compiler during Release with Debug Info builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Flags used by the linker. +CMAKE_EXE_LINKER_FLAGS:STRING=' ' + +//Flags used by the linker during debug builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/bin/gmake + +//Flags used by the linker during the creation of modules. +CMAKE_MODULE_LINKER_FLAGS:STRING=' ' + +//Flags used by the linker during debug builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=Project + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/bin/ranlib + +//Flags used by the linker during the creation of dll's. +CMAKE_SHARED_LINKER_FLAGS:STRING=' ' + +//Flags used by the linker during debug builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during debug builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/bin/strip + +//If true, cmake will use relative paths in makefiles and projects. +CMAKE_USE_RELATIVE_PATHS:BOOL=OFF + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +Project_BINARY_DIR:STATIC=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +//Value Computed by CMake +Project_SOURCE_DIR:STATIC=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_BUILD_TOOL +CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1 +//What is the target build tool cmake is generating for. +CMAKE_BUILD_TOOL:INTERNAL=/bin/gmake +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=8 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=12 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Start directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/bin/uname +//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS +CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake new file mode 100644 index 0000000000..ed20818321 --- /dev/null +++ b/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake @@ -0,0 +1,56 @@ +set(CMAKE_C_COMPILER "/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "4.8.5") +set(CMAKE_C_PLATFORM_ID "Linux") + +set(CMAKE_AR "/bin/ar") +set(CMAKE_RANLIB "/bin/ranlib") +set(CMAKE_LINKER "/bin/ld") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_LIBRARY_ARCHITECTURE "") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + + + + +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "c") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") + + + diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake new file mode 100644 index 0000000000..60f14de5e1 --- /dev/null +++ b/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake @@ -0,0 +1,57 @@ +set(CMAKE_CXX_COMPILER "/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "4.8.5") +set(CMAKE_CXX_PLATFORM_ID "Linux") + +set(CMAKE_AR "/bin/ar") +set(CMAKE_RANLIB "/bin/ranlib") +set(CMAKE_LINKER "/bin/ld") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + + + + +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;c") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") + + + diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake new file mode 100644 index 0000000000..685c4bfe8f --- /dev/null +++ b/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-3.10.0-957.1.3.el7.x86_64") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "3.10.0-957.1.3.el7.x86_64") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-3.10.0-957.1.3.el7.x86_64") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "3.10.0-957.1.3.el7.x86_64") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000000..cba81d4a6b --- /dev/null +++ b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,389 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_C = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) +# if defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" +# else +# if __IBMC__ >= 800 +# define COMPILER_ID "XL" +# else +# define COMPILER_ID "VisualAge" +# endif + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ +#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" + +/* IAR Systems compiler for embedded systems. + http://www.iar.com */ +#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" + +/* sdcc, the small devices C compiler for embedded systems, + http://sdcc.sourceforge.net */ +#elif defined(SDCC) +# define COMPILER_ID "SDCC" + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) + +#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) +# define COMPILER_ID "MIPSpro" +# if defined(_SGI_COMPILER_VERSION) + /* _SGI_COMPILER_VERSION = VRP */ +# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) +# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) +# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) +# else + /* _COMPILER_VERSION = VRP */ +# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) +# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) +# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) +# endif + +/* This compiler is either not known or is too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__sgi) +# define COMPILER_ID "MIPSpro" + +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" + +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) +# define PLATFORM_ID "IRIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#else /* unknown platform */ +# define PLATFORM_ID "" + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM) +# define ARCHITECTURE_ID "ARM" + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID "" +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif + (void)argv; + return require; +} +#endif diff --git a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000000..e8220b26e5 --- /dev/null +++ b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,377 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) +# if defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" +# else +# if __IBMCPP__ >= 800 +# define COMPILER_ID "XL" +# else +# define COMPILER_ID "VisualAge" +# endif + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ +#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" + +/* IAR Systems compiler for embedded systems. + http://www.iar.com */ +#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" + +#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) +# define COMPILER_ID "MIPSpro" +# if defined(_SGI_COMPILER_VERSION) + /* _SGI_COMPILER_VERSION = VRP */ +# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) +# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) +# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) +# else + /* _COMPILER_VERSION = VRP */ +# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) +# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) +# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) +# endif + +/* This compiler is either not known or is too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__sgi) +# define COMPILER_ID "MIPSpro" + +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" + +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) +# define PLATFORM_ID "IRIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#else /* unknown platform */ +# define PLATFORM_ID "" + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM) +# define ARCHITECTURE_ID "ARM" + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID "" +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif + (void)argv; + return require; +} diff --git a/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake b/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000000..64f2c3d9c5 --- /dev/null +++ b/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# Relative path conversion top directories. +SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf") +SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf") + +# Force unix paths in dependencies. +SET(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +SET(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/src/enkf/CMakeFiles/CMakeOutput.log b/src/enkf/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000000..3da7d94374 --- /dev/null +++ b/src/enkf/CMakeFiles/CMakeOutput.log @@ -0,0 +1,263 @@ +The system is: Linux - 3.10.0-957.1.3.el7.x86_64 - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/a.out" + +Determining if the C compiler works passed with the following output: +Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp + +Run Build Command:/bin/gmake "cmTryCompileExec1571880127/fast" +/bin/gmake -f CMakeFiles/cmTryCompileExec1571880127.dir/build.make CMakeFiles/cmTryCompileExec1571880127.dir/build +gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' +/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 +Building C object CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o +/bin/cc -o CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/testCCompiler.c +Linking C executable cmTryCompileExec1571880127 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1571880127.dir/link.txt --verbose=1 +/bin/cc CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o -o cmTryCompileExec1571880127 -rdynamic +gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' + + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp + +Run Build Command:/bin/gmake "cmTryCompileExec3965901837/fast" +/bin/gmake -f CMakeFiles/cmTryCompileExec3965901837.dir/build.make CMakeFiles/cmTryCompileExec3965901837.dir/build +gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' +/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 +Building C object CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o +/bin/cc -o CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c +Linking C executable cmTryCompileExec3965901837 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3965901837.dir/link.txt --verbose=1 +/bin/cc -v CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3965901837 -rdynamic +Using built-in specs. +COLLECT_GCC=/bin/cc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper +Target: x86_64-redhat-linux +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux +Thread model: posix +gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) +COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3965901837' '-rdynamic' '-mtune=generic' '-march=x86-64' + /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3965901837 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o +gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command:/bin/gmake "cmTryCompileExec3965901837/fast"] + ignore line: [/bin/gmake -f CMakeFiles/cmTryCompileExec3965901837.dir/build.make CMakeFiles/cmTryCompileExec3965901837.dir/build] + ignore line: [gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp'] + ignore line: [/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1] + ignore line: [Building C object CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o] + ignore line: [/bin/cc -o CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c] + ignore line: [Linking C executable cmTryCompileExec3965901837] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3965901837.dir/link.txt --verbose=1] + ignore line: [/bin/cc -v CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3965901837 -rdynamic ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper] + ignore line: [Target: x86_64-redhat-linux] + ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux] + ignore line: [Thread model: posix] + ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3965901837' '-rdynamic' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3965901837 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] + arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore + arg [--build-id] ==> ignore + arg [--no-add-needed] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-o] ==> ignore + arg [cmTryCompileExec3965901837] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] + arg [-L/lib/../lib64] ==> dir [/lib/../lib64] + arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] + arg [-L/apps/cairo/1.14.2/lib] ==> dir [/apps/cairo/1.14.2/lib] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] + arg [CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--no-as-needed] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--no-as-needed] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore + remove lib [gcc] + remove lib [gcc_s] + remove lib [gcc] + remove lib [gcc_s] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64] + collapse library dir [/lib/../lib64] ==> [/lib64] + collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] + collapse library dir [/apps/cairo/1.14.2/lib] ==> [/apps/cairo/1.14.2/lib] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib] + implicit libs: [c] + implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib] + implicit fwks: [] + + +Determining if the CXX compiler works passed with the following output: +Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp + +Run Build Command:/bin/gmake "cmTryCompileExec4106867847/fast" +/bin/gmake -f CMakeFiles/cmTryCompileExec4106867847.dir/build.make CMakeFiles/cmTryCompileExec4106867847.dir/build +gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' +/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 +Building CXX object CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o +/bin/c++ -o CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/testCXXCompiler.cxx +Linking CXX executable cmTryCompileExec4106867847 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4106867847.dir/link.txt --verbose=1 +/bin/c++ CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o -o cmTryCompileExec4106867847 -rdynamic +gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp + +Run Build Command:/bin/gmake "cmTryCompileExec2000728824/fast" +/bin/gmake -f CMakeFiles/cmTryCompileExec2000728824.dir/build.make CMakeFiles/cmTryCompileExec2000728824.dir/build +gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' +/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 +Building CXX object CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o +/bin/c++ -o CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp +Linking CXX executable cmTryCompileExec2000728824 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2000728824.dir/link.txt --verbose=1 +/bin/c++ -v CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec2000728824 -rdynamic +Using built-in specs. +COLLECT_GCC=/bin/c++ +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper +Target: x86_64-redhat-linux +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux +Thread model: posix +gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) +COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec2000728824' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec2000728824 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o +gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command:/bin/gmake "cmTryCompileExec2000728824/fast"] + ignore line: [/bin/gmake -f CMakeFiles/cmTryCompileExec2000728824.dir/build.make CMakeFiles/cmTryCompileExec2000728824.dir/build] + ignore line: [gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp'] + ignore line: [/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1] + ignore line: [Building CXX object CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/bin/c++ -o CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Linking CXX executable cmTryCompileExec2000728824] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2000728824.dir/link.txt --verbose=1] + ignore line: [/bin/c++ -v CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec2000728824 -rdynamic ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper] + ignore line: [Target: x86_64-redhat-linux] + ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux] + ignore line: [Thread model: posix] + ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec2000728824' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec2000728824 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] + arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore + arg [--build-id] ==> ignore + arg [--no-add-needed] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-o] ==> ignore + arg [cmTryCompileExec2000728824] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] + arg [-L/lib/../lib64] ==> dir [/lib/../lib64] + arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] + arg [-L/apps/cairo/1.14.2/lib] ==> dir [/apps/cairo/1.14.2/lib] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] + arg [-L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] + arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] + arg [CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore + arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore + remove lib [gcc_s] + remove lib [gcc] + remove lib [gcc_s] + remove lib [gcc] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64] + collapse library dir [/lib/../lib64] ==> [/lib64] + collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] + collapse library dir [/apps/cairo/1.14.2/lib] ==> [/apps/cairo/1.14.2/lib] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] + collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] + collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;c] + implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib] + implicit fwks: [] + + diff --git a/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake b/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake new file mode 100644 index 0000000000..ec70177280 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake @@ -0,0 +1,38 @@ +# The set of languages for which implicit dependencies are needed: +SET(CMAKE_DEPENDS_LANGUAGES + "Fortran" + ) +# The set of files for implicit dependencies of each language: +SET(CMAKE_DEPENDS_CHECK_Fortran + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" + ) +SET(CMAKE_Fortran_COMPILER_ID "Intel") + +# Targets to which this target links. +SET(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") + +# The include file search paths: +SET(CMAKE_C_TARGET_INCLUDE_PATH + "/apps/intel/impi/5.1.2.150/intel64/include" + "." + "include" + "src/enkf" + "include/wrf" + "include/global" + "src/enkf/.." + "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" + "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" + "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" + "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" + "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" + "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" + "/apps/netcdf/4.3.0-intel/include" + "libsrc/ncdiag/include" + ) +SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/MODS1.dir/build.make b/src/enkf/CMakeFiles/MODS1.dir/build.make new file mode 100644 index 0000000000..9e57937cd0 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/build.make @@ -0,0 +1,88 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# Include any dependencies generated for this target. +include src/enkf/CMakeFiles/MODS1.dir/depend.make + +# Include the progress variables for this target. +include src/enkf/CMakeFiles/MODS1.dir/progress.make + +# Include the compile flags for this target's objects. +include src/enkf/CMakeFiles/MODS1.dir/flags.make + +src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/MODS1.dir/flags.make +src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o + +src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires + +src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/MODS1.dir/build.make src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides + +src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o + +MODS1: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o +MODS1: src/enkf/CMakeFiles/MODS1.dir/build.make +.PHONY : MODS1 + +# Rule to build all files generated by this target. +src/enkf/CMakeFiles/MODS1.dir/build: MODS1 +.PHONY : src/enkf/CMakeFiles/MODS1.dir/build + +src/enkf/CMakeFiles/MODS1.dir/requires: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires +.PHONY : src/enkf/CMakeFiles/MODS1.dir/requires + +src/enkf/CMakeFiles/MODS1.dir/clean: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/MODS1.dir/cmake_clean.cmake +.PHONY : src/enkf/CMakeFiles/MODS1.dir/clean + +src/enkf/CMakeFiles/MODS1.dir/depend: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : src/enkf/CMakeFiles/MODS1.dir/depend + diff --git a/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake new file mode 100644 index 0000000000..a21c5e1c17 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake @@ -0,0 +1,8 @@ +FILE(REMOVE_RECURSE + "CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" +) + +# Per-language clean rules from dependency scanning. +FOREACH(lang Fortran) + INCLUDE(CMakeFiles/MODS1.dir/cmake_clean_${lang}.cmake OPTIONAL) +ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/MODS1.dir/depend.make b/src/enkf/CMakeFiles/MODS1.dir/depend.make new file mode 100644 index 0000000000..9c43adee43 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for MODS1. +# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/MODS1.dir/flags.make b/src/enkf/CMakeFiles/MODS1.dir/flags.make new file mode 100644 index 0000000000..0594feea72 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort +Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include + +Fortran_DEFINES = + +# Custom flags: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + diff --git a/src/enkf/CMakeFiles/MODS1.dir/progress.make b/src/enkf/CMakeFiles/MODS1.dir/progress.make new file mode 100644 index 0000000000..225de343d6 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS1.dir/progress.make @@ -0,0 +1,2 @@ +CMAKE_PROGRESS_1 = + diff --git a/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake b/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake new file mode 100644 index 0000000000..897b7f7a83 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake @@ -0,0 +1,38 @@ +# The set of languages for which implicit dependencies are needed: +SET(CMAKE_DEPENDS_LANGUAGES + "Fortran" + ) +# The set of files for implicit dependencies of each language: +SET(CMAKE_DEPENDS_CHECK_Fortran + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" + ) +SET(CMAKE_Fortran_COMPILER_ID "Intel") + +# Targets to which this target links. +SET(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") + +# The include file search paths: +SET(CMAKE_C_TARGET_INCLUDE_PATH + "/apps/intel/impi/5.1.2.150/intel64/include" + "." + "include" + "src/enkf" + "include/wrf" + "include/global" + "src/enkf/.." + "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" + "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" + "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" + "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" + "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" + "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" + "/apps/netcdf/4.3.0-intel/include" + "libsrc/ncdiag/include" + ) +SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/MODS2.dir/build.make b/src/enkf/CMakeFiles/MODS2.dir/build.make new file mode 100644 index 0000000000..016e3c9209 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/build.make @@ -0,0 +1,88 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# Include any dependencies generated for this target. +include src/enkf/CMakeFiles/MODS2.dir/depend.make + +# Include the progress variables for this target. +include src/enkf/CMakeFiles/MODS2.dir/progress.make + +# Include the compile flags for this target's objects. +include src/enkf/CMakeFiles/MODS2.dir/flags.make + +src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/MODS2.dir/flags.make +src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/MODS2.dir/gridio_gfs.f90.o + +src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires + +src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/MODS2.dir/build.make src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides + +src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o + +MODS2: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o +MODS2: src/enkf/CMakeFiles/MODS2.dir/build.make +.PHONY : MODS2 + +# Rule to build all files generated by this target. +src/enkf/CMakeFiles/MODS2.dir/build: MODS2 +.PHONY : src/enkf/CMakeFiles/MODS2.dir/build + +src/enkf/CMakeFiles/MODS2.dir/requires: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires +.PHONY : src/enkf/CMakeFiles/MODS2.dir/requires + +src/enkf/CMakeFiles/MODS2.dir/clean: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/MODS2.dir/cmake_clean.cmake +.PHONY : src/enkf/CMakeFiles/MODS2.dir/clean + +src/enkf/CMakeFiles/MODS2.dir/depend: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : src/enkf/CMakeFiles/MODS2.dir/depend + diff --git a/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake new file mode 100644 index 0000000000..6bc72f60cd --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake @@ -0,0 +1,8 @@ +FILE(REMOVE_RECURSE + "CMakeFiles/MODS2.dir/gridio_gfs.f90.o" +) + +# Per-language clean rules from dependency scanning. +FOREACH(lang Fortran) + INCLUDE(CMakeFiles/MODS2.dir/cmake_clean_${lang}.cmake OPTIONAL) +ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/MODS2.dir/depend.make b/src/enkf/CMakeFiles/MODS2.dir/depend.make new file mode 100644 index 0000000000..e58aed43c9 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for MODS2. +# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/MODS2.dir/flags.make b/src/enkf/CMakeFiles/MODS2.dir/flags.make new file mode 100644 index 0000000000..ad6c937ff4 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort +Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include + +Fortran_DEFINES = + +# Custom flags: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + diff --git a/src/enkf/CMakeFiles/MODS2.dir/progress.make b/src/enkf/CMakeFiles/MODS2.dir/progress.make new file mode 100644 index 0000000000..225de343d6 --- /dev/null +++ b/src/enkf/CMakeFiles/MODS2.dir/progress.make @@ -0,0 +1,2 @@ +CMAKE_PROGRESS_1 = + diff --git a/src/enkf/CMakeFiles/Makefile.cmake b/src/enkf/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000000..deb5929463 --- /dev/null +++ b/src/enkf/CMakeFiles/Makefile.cmake @@ -0,0 +1,66 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# The generator used is: +SET(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +SET(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" + "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" + "CMakeFiles/2.8.12.2/CMakeSystem.cmake" + "CMakeLists.txt" + "/usr/share/cmake/Modules/CMakeCCompiler.cmake.in" + "/usr/share/cmake/Modules/CMakeCCompilerABI.c" + "/usr/share/cmake/Modules/CMakeCInformation.cmake" + "/usr/share/cmake/Modules/CMakeCXXCompiler.cmake.in" + "/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp" + "/usr/share/cmake/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake/Modules/CMakeClDeps.cmake" + "/usr/share/cmake/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake" + "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake" + "/usr/share/cmake/Modules/CMakeDetermineCompiler.cmake" + "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake" + "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake" + "/usr/share/cmake/Modules/CMakeDetermineSystem.cmake" + "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake" + "/usr/share/cmake/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake/Modules/CMakeParseImplicitLinkInfo.cmake" + "/usr/share/cmake/Modules/CMakeSystem.cmake.in" + "/usr/share/cmake/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake/Modules/CMakeTestCCompiler.cmake" + "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake" + "/usr/share/cmake/Modules/CMakeTestCompilerCommon.cmake" + "/usr/share/cmake/Modules/CMakeUnixFindMake.cmake" + "/usr/share/cmake/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake/Modules/Compiler/GNU.cmake" + "/usr/share/cmake/Modules/Platform/Linux-CXX.cmake" + "/usr/share/cmake/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake/Modules/Platform/Linux.cmake" + "/usr/share/cmake/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +SET(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +SET(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/2.8.12.2/CMakeSystem.cmake" + "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" + "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" + "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" + "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +SET(CMAKE_DEPEND_INFO_FILES + ) diff --git a/src/enkf/CMakeFiles/Makefile2 b/src/enkf/CMakeFiles/Makefile2 new file mode 100644 index 0000000000..4ea910d716 --- /dev/null +++ b/src/enkf/CMakeFiles/Makefile2 @@ -0,0 +1,67 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# The main recursive all target +all: +.PHONY : all + +# The main recursive preinstall target +preinstall: +.PHONY : preinstall + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/src/enkf/CMakeFiles/TargetDirectories.txt b/src/enkf/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/enkf/CMakeFiles/cmake.check_cache b/src/enkf/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000000..3dccd73172 --- /dev/null +++ b/src/enkf/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake new file mode 100644 index 0000000000..cdb6d3e346 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake @@ -0,0 +1,43 @@ +# The set of languages for which implicit dependencies are needed: +SET(CMAKE_DEPENDS_LANGUAGES + "Fortran" + ) +# The set of files for implicit dependencies of each language: +SET(CMAKE_DEPENDS_CHECK_Fortran + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" + ) +SET(CMAKE_Fortran_COMPILER_ID "Intel") + +# Targets to which this target links. +SET(CMAKE_TARGET_LINKED_INFO_FILES + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/CMakeFiles/gsilib_shrd.dir/DependInfo.cmake" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/CMakeFiles/gsilib_wrf.dir/DependInfo.cmake" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/CMakeFiles/ncdiag.dir/DependInfo.cmake" + ) + +# Fortran module output directory. +SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") + +# The include file search paths: +SET(CMAKE_C_TARGET_INCLUDE_PATH + "/apps/intel/impi/5.1.2.150/intel64/include" + "." + "include" + "src/enkf" + "include/wrf" + "include/global" + "src/enkf/.." + "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" + "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" + "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" + "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" + "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" + "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" + "/apps/netcdf/4.3.0-intel/include" + "libsrc/ncdiag/include" + ) +SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make new file mode 100644 index 0000000000..e73fb39b83 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make @@ -0,0 +1,167 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# Include any dependencies generated for this target. +include src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make + +# Include the progress variables for this target. +include src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make + +# Include the compile flags for this target's objects. +include src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make + +src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o: src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make +src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o: src/enkf/enkf_main.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90 -o CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o + +src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires + +src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides + +src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides.build: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o + +# Object files for target enkf_gfs.x +enkf_gfs_x_OBJECTS = \ +"CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" + +# External object files for target enkf_gfs.x +enkf_gfs_x_EXTERNAL_OBJECTS = + +bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o +bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make +bin/enkf_gfs.x: lib/libenkflib.a +bin/enkf_gfs.x: lib/libenkfdeplib.a +bin/enkf_gfs.x: lib/libgsilib_shrd.a +bin/enkf_gfs.x: lib/libgsilib_wrf.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a +bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a +bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a +bin/enkf_gfs.x: /usr/lib64/libdl.so +bin/enkf_gfs.x: /usr/lib64/librt.so +bin/enkf_gfs.x: /usr/lib64/libpthread.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_gf_lp64.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_lp64.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_thread.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_core.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so +bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so +bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so +bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdf.so +bin/enkf_gfs.x: /usr/lib64/libcurl.so +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a +bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a +bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a +bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a +bin/enkf_gfs.x: lib/libncdiag.a +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so +bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a +bin/enkf_gfs.x: /usr/lib64/libdl.so +bin/enkf_gfs.x: /usr/lib64/librt.so +bin/enkf_gfs.x: /usr/lib64/libpthread.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_gf_lp64.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_lp64.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_thread.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_core.so +bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so +bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so +bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdf.so +bin/enkf_gfs.x: /usr/lib64/libcurl.so +bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran executable ../../bin/enkf_gfs.x" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkf_gfs.x.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +src/enkf/CMakeFiles/enkf_gfs.x.dir/build: bin/enkf_gfs.x +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/build + +src/enkf/CMakeFiles/enkf_gfs.x.dir/requires: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/requires + +src/enkf/CMakeFiles/enkf_gfs.x.dir/clean: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/clean + +src/enkf/CMakeFiles/enkf_gfs.x.dir/depend: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/depend + diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake new file mode 100644 index 0000000000..acdd21a5d8 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake @@ -0,0 +1,10 @@ +FILE(REMOVE_RECURSE + "CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" + "../../bin/enkf_gfs.x.pdb" + "../../bin/enkf_gfs.x" +) + +# Per-language clean rules from dependency scanning. +FOREACH(lang Fortran) + INCLUDE(CMakeFiles/enkf_gfs.x.dir/cmake_clean_${lang}.cmake OPTIONAL) +ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make new file mode 100644 index 0000000000..62030144f3 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for enkf_gfs.x. +# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make new file mode 100644 index 0000000000..91ed503c5a --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort +Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include + +Fortran_DEFINES = + +# Custom flags: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt b/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt new file mode 100644 index 0000000000..cdded996f7 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt @@ -0,0 +1 @@ +/apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o -o ../../bin/enkf_gfs.x -L/apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so -L/apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so -L/apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a -L/usr/lib64/libdl.so -L/usr/lib64/librt.so -L/usr/lib64/libpthread.so -L/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/lib -i_dynamic ../../lib/libenkflib.a ../../lib/libenkfdeplib.a ../../lib/libgsilib_shrd.a ../../lib/libgsilib_wrf.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a /usr/lib64/libdl.so /usr/lib64/librt.so -lpthread -lmkl_gf_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -lpthread -lm /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdf.so -mkl /usr/lib64/libcurl.so /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a ../../lib/libncdiag.a /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a /usr/lib64/libdl.so /usr/lib64/librt.so -lpthread -lmkl_gf_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -lpthread -lm /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdf.so /usr/lib64/libcurl.so -lirng -ldecimal -lcilkrts -lstdc++ -lirc -Wl,-rpath,/apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so:/apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so:/apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a:/usr/lib64/libdl.so:/usr/lib64/librt.so:/usr/lib64/libpthread.so:/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/lib:/apps/intel/impi/5.1.2.150/intel64/lib:/apps/intel/impi/5.1.2.150/intel64/lib/release_mt:/apps/netcdf/4.3.0-intel/lib diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make new file mode 100644 index 0000000000..225de343d6 --- /dev/null +++ b/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make @@ -0,0 +1,2 @@ +CMAKE_PROGRESS_1 = + diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake new file mode 100644 index 0000000000..265a143fb9 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake @@ -0,0 +1,60 @@ +# The set of languages for which implicit dependencies are needed: +SET(CMAKE_DEPENDS_LANGUAGES + "Fortran" + ) +# The set of files for implicit dependencies of each language: +SET(CMAKE_DEPENDS_CHECK_Fortran + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/controlvec.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/covlocal.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obsmod.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/expand_ens.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/fftpack.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/genqsat1.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/kdtree2.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpi_readobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpisetup.F90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/netcdf_io_wrf.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/observer_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/params.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readconvobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readozobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readsatobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/reducedgrid.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/rnorm.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/sorting.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/specmod.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/statevec.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/write_logfile.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" + ) +SET(CMAKE_Fortran_COMPILER_ID "Intel") + +# Targets to which this target links. +SET(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") + +# The include file search paths: +SET(CMAKE_C_TARGET_INCLUDE_PATH + "/apps/intel/impi/5.1.2.150/intel64/include" + "." + "include" + "src/enkf" + "include/wrf" + "include/global" + "src/enkf/.." + "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" + "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" + "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" + "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" + "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" + "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" + "/apps/netcdf/4.3.0-intel/include" + "libsrc/ncdiag/include" + ) +SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/build.make b/src/enkf/CMakeFiles/enkfdeplib.dir/build.make new file mode 100644 index 0000000000..17844fb803 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/build.make @@ -0,0 +1,494 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# Include any dependencies generated for this target. +include src/enkf/CMakeFiles/enkfdeplib.dir/depend.make + +# Include the progress variables for this target. +include src/enkf/CMakeFiles/enkfdeplib.dir/progress.make + +# Include the compile flags for this target's objects. +include src/enkf/CMakeFiles/enkfdeplib.dir/flags.make + +src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o: src/enkf/netcdf_io_wrf.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/netcdf_io_wrf.f90 -o CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o: src/enkf/params.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_2) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/params.f90 -o CMakeFiles/enkfdeplib.dir/params.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o: src/enkf/covlocal.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_3) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/covlocal.f90 -o CMakeFiles/enkfdeplib.dir/covlocal.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o: src/enkf/fftpack.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_4) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/fftpack.f90 -o CMakeFiles/enkfdeplib.dir/fftpack.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o: src/enkf/genqsat1.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_5) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/genqsat1.f90 -o CMakeFiles/enkfdeplib.dir/genqsat1.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o: src/enkf/mpisetup.F90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_6) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpisetup.F90 -o CMakeFiles/enkfdeplib.dir/mpisetup.F90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o: src/enkf/rnorm.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_7) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/rnorm.f90 -o CMakeFiles/enkfdeplib.dir/rnorm.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o: src/enkf/sorting.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_8) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/sorting.f90 -o CMakeFiles/enkfdeplib.dir/sorting.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o: src/enkf/specmod.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_9) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/specmod.f90 -o CMakeFiles/enkfdeplib.dir/specmod.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o: src/enkf/reducedgrid.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_10) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/reducedgrid.f90 -o CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o: src/enkf/readozobs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_11) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readozobs.f90 -o CMakeFiles/enkfdeplib.dir/readozobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o: src/enkf/readsatobs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_12) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readsatobs.f90 -o CMakeFiles/enkfdeplib.dir/readsatobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o: src/enkf/readconvobs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_13) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readconvobs.f90 -o CMakeFiles/enkfdeplib.dir/readconvobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o: src/enkf/write_logfile.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_14) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/write_logfile.f90 -o CMakeFiles/enkfdeplib.dir/write_logfile.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o: src/enkf/kdtree2.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_15) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/kdtree2.f90 -o CMakeFiles/enkfdeplib.dir/kdtree2.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o: src/enkf/mpi_readobs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_16) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpi_readobs.f90 -o CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o: src/enkf/enkf_obsmod.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_17) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obsmod.f90 -o CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o: src/enkf/statevec.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_18) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/statevec.f90 -o CMakeFiles/enkfdeplib.dir/statevec.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o: src/enkf/controlvec.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_19) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/controlvec.f90 -o CMakeFiles/enkfdeplib.dir/controlvec.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o: src/enkf/observer_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_20) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/observer_gfs.f90 -o CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_21) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_22) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o: src/enkf/expand_ens.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_23) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/expand_ens.f90 -o CMakeFiles/enkfdeplib.dir/expand_ens.f90.o + +src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires + +src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides + +src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o + +# Object files for target enkfdeplib +enkfdeplib_OBJECTS = \ +"CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" \ +"CMakeFiles/enkfdeplib.dir/params.f90.o" \ +"CMakeFiles/enkfdeplib.dir/covlocal.f90.o" \ +"CMakeFiles/enkfdeplib.dir/fftpack.f90.o" \ +"CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" \ +"CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" \ +"CMakeFiles/enkfdeplib.dir/rnorm.f90.o" \ +"CMakeFiles/enkfdeplib.dir/sorting.f90.o" \ +"CMakeFiles/enkfdeplib.dir/specmod.f90.o" \ +"CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" \ +"CMakeFiles/enkfdeplib.dir/readozobs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" \ +"CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" \ +"CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" \ +"CMakeFiles/enkfdeplib.dir/statevec.f90.o" \ +"CMakeFiles/enkfdeplib.dir/controlvec.f90.o" \ +"CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" \ +"CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" + +# External object files for target enkfdeplib +enkfdeplib_EXTERNAL_OBJECTS = + +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/build.make +lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran static library ../../lib/libenkfdeplib.a" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkfdeplib.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +src/enkf/CMakeFiles/enkfdeplib.dir/build: lib/libenkfdeplib.a +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/build + +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires +src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/requires + +src/enkf/CMakeFiles/enkfdeplib.dir/clean: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkfdeplib.dir/cmake_clean.cmake +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/clean + +src/enkf/CMakeFiles/enkfdeplib.dir/depend: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/depend + diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake new file mode 100644 index 0000000000..d2c33159c1 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake @@ -0,0 +1,32 @@ +FILE(REMOVE_RECURSE + "CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" + "CMakeFiles/enkfdeplib.dir/params.f90.o" + "CMakeFiles/enkfdeplib.dir/covlocal.f90.o" + "CMakeFiles/enkfdeplib.dir/fftpack.f90.o" + "CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" + "CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" + "CMakeFiles/enkfdeplib.dir/rnorm.f90.o" + "CMakeFiles/enkfdeplib.dir/sorting.f90.o" + "CMakeFiles/enkfdeplib.dir/specmod.f90.o" + "CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" + "CMakeFiles/enkfdeplib.dir/readozobs.f90.o" + "CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" + "CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" + "CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" + "CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" + "CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" + "CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" + "CMakeFiles/enkfdeplib.dir/statevec.f90.o" + "CMakeFiles/enkfdeplib.dir/controlvec.f90.o" + "CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" + "CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" + "CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" + "CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" + "../../lib/libenkfdeplib.pdb" + "../../lib/libenkfdeplib.a" +) + +# Per-language clean rules from dependency scanning. +FOREACH(lang Fortran) + INCLUDE(CMakeFiles/enkfdeplib.dir/cmake_clean_${lang}.cmake OPTIONAL) +ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake new file mode 100644 index 0000000000..1103891c94 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +FILE(REMOVE_RECURSE + "../../lib/libenkfdeplib.a" +) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make b/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make new file mode 100644 index 0000000000..4ce2736bc1 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for enkfdeplib. +# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make b/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make new file mode 100644 index 0000000000..167f6cb0c9 --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make @@ -0,0 +1,54 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort +Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include + +Fortran_DEFINES = + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt b/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt new file mode 100644 index 0000000000..8caf201fee --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt @@ -0,0 +1,2 @@ +/bin/ar cr ../../lib/libenkfdeplib.a CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o CMakeFiles/enkfdeplib.dir/params.f90.o CMakeFiles/enkfdeplib.dir/covlocal.f90.o CMakeFiles/enkfdeplib.dir/fftpack.f90.o CMakeFiles/enkfdeplib.dir/genqsat1.f90.o CMakeFiles/enkfdeplib.dir/mpisetup.F90.o CMakeFiles/enkfdeplib.dir/rnorm.f90.o CMakeFiles/enkfdeplib.dir/sorting.f90.o CMakeFiles/enkfdeplib.dir/specmod.f90.o CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o CMakeFiles/enkfdeplib.dir/readozobs.f90.o CMakeFiles/enkfdeplib.dir/readsatobs.f90.o CMakeFiles/enkfdeplib.dir/readconvobs.f90.o CMakeFiles/enkfdeplib.dir/write_logfile.f90.o CMakeFiles/enkfdeplib.dir/kdtree2.f90.o CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o CMakeFiles/enkfdeplib.dir/statevec.f90.o CMakeFiles/enkfdeplib.dir/controlvec.f90.o CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o CMakeFiles/enkfdeplib.dir/expand_ens.f90.o +/bin/ranlib ../../lib/libenkfdeplib.a diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make b/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make new file mode 100644 index 0000000000..388520a19f --- /dev/null +++ b/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make @@ -0,0 +1,24 @@ +CMAKE_PROGRESS_1 = +CMAKE_PROGRESS_2 = +CMAKE_PROGRESS_3 = +CMAKE_PROGRESS_4 = 2 +CMAKE_PROGRESS_5 = +CMAKE_PROGRESS_6 = +CMAKE_PROGRESS_7 = +CMAKE_PROGRESS_8 = +CMAKE_PROGRESS_9 = +CMAKE_PROGRESS_10 = +CMAKE_PROGRESS_11 = 3 +CMAKE_PROGRESS_12 = +CMAKE_PROGRESS_13 = +CMAKE_PROGRESS_14 = +CMAKE_PROGRESS_15 = +CMAKE_PROGRESS_16 = +CMAKE_PROGRESS_17 = 4 +CMAKE_PROGRESS_18 = +CMAKE_PROGRESS_19 = +CMAKE_PROGRESS_20 = +CMAKE_PROGRESS_21 = +CMAKE_PROGRESS_22 = +CMAKE_PROGRESS_23 = 5 + diff --git a/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake new file mode 100644 index 0000000000..d194c62ae4 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake @@ -0,0 +1,50 @@ +# The set of languages for which implicit dependencies are needed: +SET(CMAKE_DEPENDS_LANGUAGES + "Fortran" + ) +# The set of files for implicit dependencies of each language: +SET(CMAKE_DEPENDS_CHECK_Fortran + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obs_sensitivity.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/inflation.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/innovstats.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/letkf.F90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/loadbal.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/quicksort.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/radbias.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/read_locinfo.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o" + "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/smooth_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o" + ) +SET(CMAKE_Fortran_COMPILER_ID "Intel") + +# Targets to which this target links. +SET(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") + +# The include file search paths: +SET(CMAKE_C_TARGET_INCLUDE_PATH + "/apps/intel/impi/5.1.2.150/intel64/include" + "." + "include" + "src/enkf" + "include/wrf" + "include/global" + "src/enkf/.." + "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" + "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" + "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" + "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" + "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" + "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" + "/apps/netcdf/4.3.0-intel/include" + "libsrc/ncdiag/include" + ) +SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) +SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkflib.dir/build.make b/src/enkf/CMakeFiles/enkflib.dir/build.make new file mode 100644 index 0000000000..fe4aee8f12 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/build.make @@ -0,0 +1,318 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI + +# Include any dependencies generated for this target. +include src/enkf/CMakeFiles/enkflib.dir/depend.make + +# Include the progress variables for this target. +include src/enkf/CMakeFiles/enkflib.dir/progress.make + +# Include the compile flags for this target's objects. +include src/enkf/CMakeFiles/enkflib.dir/flags.make + +src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o: src/enkf/innovstats.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/innovstats.f90 -o CMakeFiles/enkflib.dir/innovstats.f90.o + +src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o: src/enkf/enkf.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_2) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf.f90 -o CMakeFiles/enkflib.dir/enkf.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o + +src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o: src/enkf/read_locinfo.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_3) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/read_locinfo.f90 -o CMakeFiles/enkflib.dir/read_locinfo.f90.o + +src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o: src/enkf/enkf_main.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_4) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90 -o CMakeFiles/enkflib.dir/enkf_main.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o + +src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o: src/enkf/inflation.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_5) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/inflation.f90 -o CMakeFiles/enkflib.dir/inflation.f90.o + +src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o + +src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o: src/enkf/letkf.F90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_6) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/letkf.F90 -o CMakeFiles/enkflib.dir/letkf.F90.o + +src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o + +src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o: src/enkf/quicksort.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_7) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/quicksort.f90 -o CMakeFiles/enkflib.dir/quicksort.f90.o + +src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o + +src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o: src/enkf/radbias.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_8) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/radbias.f90 -o CMakeFiles/enkflib.dir/radbias.f90.o + +src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o + +src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o: src/enkf/loadbal.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_9) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/loadbal.f90 -o CMakeFiles/enkflib.dir/loadbal.f90.o + +src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o + +src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o: src/enkf/smooth_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_10) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/smooth_gfs.f90 -o CMakeFiles/enkflib.dir/smooth_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_11) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/enkflib.dir/gridio_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_12) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make +src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o: src/enkf/enkf_obs_sensitivity.f90 + $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_13) + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obs_sensitivity.f90 -o CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o + +src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires: +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires + +src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires + $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides.build +.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides + +src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o + +# Object files for target enkflib +enkflib_OBJECTS = \ +"CMakeFiles/enkflib.dir/innovstats.f90.o" \ +"CMakeFiles/enkflib.dir/enkf.f90.o" \ +"CMakeFiles/enkflib.dir/read_locinfo.f90.o" \ +"CMakeFiles/enkflib.dir/enkf_main.f90.o" \ +"CMakeFiles/enkflib.dir/inflation.f90.o" \ +"CMakeFiles/enkflib.dir/letkf.F90.o" \ +"CMakeFiles/enkflib.dir/quicksort.f90.o" \ +"CMakeFiles/enkflib.dir/radbias.f90.o" \ +"CMakeFiles/enkflib.dir/loadbal.f90.o" \ +"CMakeFiles/enkflib.dir/smooth_gfs.f90.o" \ +"CMakeFiles/enkflib.dir/gridio_gfs.f90.o" \ +"CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" \ +"CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" + +# External object files for target enkflib +enkflib_EXTERNAL_OBJECTS = \ +"/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" \ +"/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" + +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/build.make +lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran static library ../../lib/libenkflib.a" + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkflib.dir/cmake_clean_target.cmake + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkflib.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +src/enkf/CMakeFiles/enkflib.dir/build: lib/libenkflib.a +.PHONY : src/enkf/CMakeFiles/enkflib.dir/build + +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires +src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires +.PHONY : src/enkf/CMakeFiles/enkflib.dir/requires + +src/enkf/CMakeFiles/enkflib.dir/clean: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkflib.dir/cmake_clean.cmake +.PHONY : src/enkf/CMakeFiles/enkflib.dir/clean + +src/enkf/CMakeFiles/enkflib.dir/depend: + cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : src/enkf/CMakeFiles/enkflib.dir/depend + diff --git a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake new file mode 100644 index 0000000000..cb5d14a003 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake @@ -0,0 +1,22 @@ +FILE(REMOVE_RECURSE + "CMakeFiles/enkflib.dir/innovstats.f90.o" + "CMakeFiles/enkflib.dir/enkf.f90.o" + "CMakeFiles/enkflib.dir/read_locinfo.f90.o" + "CMakeFiles/enkflib.dir/enkf_main.f90.o" + "CMakeFiles/enkflib.dir/inflation.f90.o" + "CMakeFiles/enkflib.dir/letkf.F90.o" + "CMakeFiles/enkflib.dir/quicksort.f90.o" + "CMakeFiles/enkflib.dir/radbias.f90.o" + "CMakeFiles/enkflib.dir/loadbal.f90.o" + "CMakeFiles/enkflib.dir/smooth_gfs.f90.o" + "CMakeFiles/enkflib.dir/gridio_gfs.f90.o" + "CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" + "CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" + "../../lib/libenkflib.pdb" + "../../lib/libenkflib.a" +) + +# Per-language clean rules from dependency scanning. +FOREACH(lang Fortran) + INCLUDE(CMakeFiles/enkflib.dir/cmake_clean_${lang}.cmake OPTIONAL) +ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake new file mode 100644 index 0000000000..41610b20bb --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +FILE(REMOVE_RECURSE + "../../lib/libenkflib.a" +) diff --git a/src/enkf/CMakeFiles/enkflib.dir/depend.make b/src/enkf/CMakeFiles/enkflib.dir/depend.make new file mode 100644 index 0000000000..8fc584e226 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for enkflib. +# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkflib.dir/flags.make b/src/enkf/CMakeFiles/enkflib.dir/flags.make new file mode 100644 index 0000000000..49ecff3f58 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/flags.make @@ -0,0 +1,34 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 + +# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort +Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include + +Fortran_DEFINES = + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + +# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp + diff --git a/src/enkf/CMakeFiles/enkflib.dir/link.txt b/src/enkf/CMakeFiles/enkflib.dir/link.txt new file mode 100644 index 0000000000..72fa31aab2 --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/link.txt @@ -0,0 +1,2 @@ +/bin/ar cr ../../lib/libenkflib.a CMakeFiles/enkflib.dir/innovstats.f90.o CMakeFiles/enkflib.dir/enkf.f90.o CMakeFiles/enkflib.dir/read_locinfo.f90.o CMakeFiles/enkflib.dir/enkf_main.f90.o CMakeFiles/enkflib.dir/inflation.f90.o CMakeFiles/enkflib.dir/letkf.F90.o CMakeFiles/enkflib.dir/quicksort.f90.o CMakeFiles/enkflib.dir/radbias.f90.o CMakeFiles/enkflib.dir/loadbal.f90.o CMakeFiles/enkflib.dir/smooth_gfs.f90.o CMakeFiles/enkflib.dir/gridio_gfs.f90.o CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o CMakeFiles/MODS2.dir/gridio_gfs.f90.o +/bin/ranlib ../../lib/libenkflib.a diff --git a/src/enkf/CMakeFiles/enkflib.dir/progress.make b/src/enkf/CMakeFiles/enkflib.dir/progress.make new file mode 100644 index 0000000000..6d05e974fe --- /dev/null +++ b/src/enkf/CMakeFiles/enkflib.dir/progress.make @@ -0,0 +1,14 @@ +CMAKE_PROGRESS_1 = +CMAKE_PROGRESS_2 = +CMAKE_PROGRESS_3 = +CMAKE_PROGRESS_4 = +CMAKE_PROGRESS_5 = +CMAKE_PROGRESS_6 = +CMAKE_PROGRESS_7 = 6 +CMAKE_PROGRESS_8 = +CMAKE_PROGRESS_9 = +CMAKE_PROGRESS_10 = +CMAKE_PROGRESS_11 = +CMAKE_PROGRESS_12 = +CMAKE_PROGRESS_13 = 7 + diff --git a/src/enkf/CMakeFiles/progress.marks b/src/enkf/CMakeFiles/progress.marks new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/src/enkf/CMakeFiles/progress.marks @@ -0,0 +1 @@ +0 diff --git a/src/enkf/CMakeLists.txt b/src/enkf/CMakeLists.txt index cce68c8aa1..7d5612c29b 100644 --- a/src/enkf/CMakeLists.txt +++ b/src/enkf/CMakeLists.txt @@ -14,6 +14,10 @@ if(BUILD_ENKF) elseif(BUILD_NMMB) set(ENKF_SUFFIX "nmmb") set(ENKF_BASE "enkf_nmmb") + elseif(BUILD_FV3reg) + set(ENKF_SUFFIX "fv3reg") + set(ENKF_BASE "enkf_fv3reg") + set(ENKF_extra_src1 read_fv3regional_restarts.f90 write_fv3regional_restarts.f90) else() set(ENKF_SUFFIX "wrf") set(ENKF_BASE "enkf_wrf") @@ -23,15 +27,16 @@ if(BUILD_ENKF) # else() # set(GSILIB "gsilib_global${debug_suffix}") # endif() - set(ENKF_EXTRA_SRCS gridio_${ENKF_SUFFIX}.f90 ) + set(ENKF_EXTRA_SRCS ${ENKF_extra_src1} gridio_${ENKF_SUFFIX}.f90 ) add_library( MODS1 OBJECT gridinfo_${ENKF_SUFFIX}.f90 ) add_library( MODS2 OBJECT ${ENKF_EXTRA_SRCS} ) set(ENKFMOD_SRCS - netcdf_io_wrf.f90 params.f90 covlocal.f90 fftpack.f90 genqsat1.f90 mpisetup.F90 rnorm.f90 + netcdf_io_wrf.f90 fv3_netcdf_mod.F90 params.f90 covlocal.f90 fftpack.f90 genqsat1.f90 mpisetup.F90 rnorm.f90 sorting.f90 specmod.f90 reducedgrid.f90 readozobs.f90 readsatobs.f90 readconvobs.f90 write_logfile.f90 kdtree2.f90 mpi_readobs.f90 enkf_obsmod.f90 statevec.f90 controlvec.f90 observer_${ENKF_SUFFIX}.f90 gridio_${ENKF_SUFFIX}.f90 gridinfo_${ENKF_SUFFIX}.f90 expand_ens.f90 + ${ENKF_extra_src1} ) set(ENKF_SRCS innovstats.f90 @@ -59,6 +64,7 @@ if(BUILD_ENKF) set_source_files_properties( ${ENKF_SRCS} PROPERTIES COMPILE_FLAGS ${ENKF_Fortran_FLAGS} ) set_source_files_properties( ${ENKFMOD_SRCS} PROPERTIES COMPILE_FLAGS ${ENKF_Fortran_FLAGS} ) + set_source_files_properties( ${ENKF_EXTRA_SRCS} PROPERTIES COMPILE_FLAGS ${ENKF_Fortran_FLAGS} ) add_library(enkfdeplib STATIC ${ENKFMOD_SRCS} ) add_library(enkflib STATIC ${ENKF_SRCS} $ $ ) diff --git a/src/enkf/CTestTestfile.cmake b/src/enkf/CTestTestfile.cmake new file mode 100644 index 0000000000..1594bddb50 --- /dev/null +++ b/src/enkf/CTestTestfile.cmake @@ -0,0 +1,6 @@ +# CMake generated Testfile for +# Source directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf +# Build directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf +# +# This file includes the relevant testing commands required for +# testing this directory and lists subdirectories to be tested as well. diff --git a/src/enkf/Makefile b/src/enkf/Makefile index ebf8d13325..d54cb568e1 100644 --- a/src/enkf/Makefile +++ b/src/enkf/Makefile @@ -1,381 +1,125 @@ -SHELL=/bin/sh - -#============================================================================== -# -# EnKF Makefile -# -# -# 0) Export this makefile name to a variable 'MAKE_FILE' as -# export MAKE_FILE = makefile -# If this file is named neither 'makefile' nor 'Makefile' but -# 'makeairs' for instance, then call this makefile by typing -# 'make -f makeairs' instead of 'make'. -# -# 0a) Modify the include link to either use compile.config.ibm -# or compile.config.sgi for compilation on the ibm sp or sgi -# -# 1) To make a EnKF executable file, type -# > make or > make all -# -# 2) To make a EnKF executable file with debug options, type -# > make debug -# -# 3) To copy the EnKF load module to installing directory, type -# > make install -# . Specify the directory to a variable 'INSTALL_DIR' below. -# -# 4) To crean up files created by make, type -# > make clean -# -# -# Created by Y.Tahara in May,2002 -# Edited by D.Kleist Oct. 2003 -#============================================================================== - -#----------------------------------------------------------------------------- -# -- Parent make (calls child make) -- -#----------------------------------------------------------------------------- - -# ----------------------------------------------------------- -# Default configuration, possibily redefined in Makefile.conf -# ----------------------------------------------------------- - -ARCH = `uname -s` -SED = sed -DASPERL = /usr/bin/perl -COREROOT = ../../.. -COREBIN = $(COREROOT)/bin -CORELIB = $(COREROOT)/lib -COREINC = $(COREROOT)/include -COREETC = $(COREROOT)/etc - - -# ------------- -# General Rules -# ------------- - -CP = /bin/cp -p -RM = /bin/rm -f -MKDIR = /bin/mkdir -p -AR = ar cq -PROTEX = protex -f # -l -ProTexMake = protex -S # -l -LATEX = pdflatex -DVIPS = dvips - -# Preprocessing -# ------------- -_DDEBUG = -_D = $(_DDEBUG) - -# --------- -# Libraries -# --------- -LIBmpeu = -L$(CORELIB) -lmpeu -LIBbfr = -L$(CORELIB) -lbfr -LIBw3 = -L$(CORELIB) -lw3 -LIBsp = -L$(CORELIB) -lsp -LIBbacio = -L$(CORELIB) -lbacio -LIBsfcio = -L$(CORELIB) -lsfcio -LIBsigio = -L$(CORELIB) -lsigio -LIBtransf = -L$(CORELIB) -ltransf -LIBhermes = -L$(CORELIB) -lhermes -LIBgfio = -L$(CORELIB) -lgfio - -# -------------------------- -# Default Baselibs Libraries -# -------------------------- -INChdf = -I$(BASEDIR)/$(ARCH)/include/hdf -LIBhdf = -L$(BASEDIR)/$(ARCH)/lib -lmfhdf -ldf -lhdfjpeg -lhdfz -lsz -LIBnetcdf = -L$(BASEDIR)/$(ARCH)/lib -lnetcdf -lnetcdff -LIBwrf = -L$(BASEDIR)/$(ARCH)/lib -lwrflib -LIBwrfio_int = -L$(BASEDIR)/$(ARCH)/lib -lwrfio_int -LIBwrfio_netcdf = -L$(BASEDIR)/$(ARCH)/lib -lwrfio_nf - -# ------------------------ -# Default System Libraries -# ------------------------ -LIBmpi = -lmpi -LIBsys = - - -#------------ -# Include machine dependent compile & load options -#------------ - MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -# ------------- -# This makefile -# ------------- - - MAKE_FILE = Makefile - - -# ----------- -# Load module -# ----------- - - #EXE_FILE = global_enkf - - -# -------------------- -# Installing directory -# -------------------- - - INSTALL_DIR = ../bin - - -# -------- -# Log file -# -------- - - LOG_FILE = log.make.$(EXE_FILE) - - -# --------------- -# Call child make -# --------------- - -"" : - @$(MAKE) -f $(MAKE_FILE) all - - -# ------------ -# Make install -# ------------ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 -install: - @echo - @echo '==== INSTALL =================================================' - @if [ -e $(INSTALL_DIR) ]; then \ - if [ ! -d $(INSTALL_DIR) ]; then \ - echo '### Fail to create installing directory ###' ;\ - echo '### Stop the installation ###' ;\ - exit ;\ - fi ;\ - else \ - echo " mkdir -p $(INSTALL_DIR)" ;\ - mkdir -p $(INSTALL_DIR) ;\ - fi - cp $(EXE_FILE) $(INSTALL_DIR) - @cd $(INSTALL_DIR) ; ls -l `pwd`/$(EXE_FILE) +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target +#============================================================================= +# Special targets provided by cmake. -# ---------- -# Make clean -# ---------- +# Disable implicit rules so canonical targets will work. +.SUFFIXES: +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/progress.marks + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles 0 +.PHONY : all + +# The main clean target clean: - @echo - @echo '==== CLEAN ===================================================' - - $(RM) $(EXE_FILE) *.o *.mod *.MOD *.lst *.a *.x *__genmod* - - $(RM) loadmap.txt log.make.$(EXE_FILE) - - $(MAKE) -f ${MAKE_FILE} doclean - - -#----------------------------------------------------------------------------- -# -- Child make -- -#----------------------------------------------------------------------------- - -# ------------ -# Source files -# ------------ - - SRCSF90C = \ - covlocal.f90 \ - enkf.f90 \ - enkf_obs_sensitivity.f90 \ - enkf_main.f90 \ - fftpack.f90 \ - genqsat1.f90 \ - gridinfo_gfs.f90 \ - gridio_gfs.f90 \ - inflation.f90 \ - innovstats.f90 \ - kdtree2.f90 \ - letkf.F90 \ - loadbal.f90 \ - mpi_readobs.f90 \ - mpisetup.F90 \ - netcdf_io_wrf.f90 \ - enkf_obsmod.f90 \ - params.f90 \ - sorting.f90 \ - radbias.f90 \ - read_locinfo.f90 \ - readconvobs.f90 \ - readozobs.f90 \ - readsatobs.f90 \ - reducedgrid.f90 \ - rnorm.f90 \ - smooth_gfs.f90 \ - specmod.f90 \ - statevec.f90 \ - write_logfile.f90 - - SRCSF90C_NOSWAP = - - ENKFGC_SRCS = - - SRCSF77 = - - SRCSC = - - SRCS = $(SRCSF90C) $(ENKFGC_SRCS) $(SRCSF77) $(SRCSC) $(XSRCSC) - - DOCSRCS = *.f90 *.F90 - -# ------------ -# Object files -# ------------ - - SRCSF90 = ${SRCSF90C:.F90=.f90} - SRCSF90_NOSWAP= ${SRCSF90C_NOSWAP:.F90=.f90} - - OBJS = ${SRCSF90:.f90=.o} ${SRCSF77:.f=.o} ${SRCSC:.c=.o} - OBJS_NOSWAP = ${SRCSF90_NOSWAP:.f90=.o} - - GSIOBJS = $(shell find ../ -maxdepth 1 -name "*.o" -print | grep -v gsimain) - - -# ----------------------- -# Default compiling rules -# ----------------------- - -.SUFFIXES : -.SUFFIXES : .F90 .f90 .f .c .o - -.F90.o : - @echo - @echo '---> Compiling $<' - $(CF) $(FFLAGS) $(_D) -c $< - -.f90.o : - @echo - @echo '---> Compiling $<' - $(CF) $(FFLAGS) -c $< - -.f.o : - @echo - @echo '---> Compiling $<' - $(CF) $(FFLAGS_f) -c $< - -.c.o : - @echo - @echo '---> Compiling $<' - $(CC) $(CFLAGS) -c $< - -$(OBJS_NOSWAP) : - @echo '---> Special handling of Fortran "native" BUFR-OPEN $<' - $(CF) -c $(FFLAGS_NOSWAP) $< - - -# ------------ -# Dependencies -# ------------ - MAKE_DEPEND = Makefile.dependency -include $(MAKE_DEPEND) - -# ---- - -$(EXE_FILE) : $(OBJS) $(OBJS_NOSWAP) $(GSIOBJS) - $(LD) -o $@ $(OBJS) $(OBJS_NOSWAP) $(GSIOBJS) $(LIBS) $(LDFLAGS) - - -# ------------------------ -# Call compiler and linker -# ------------------------ - -all : - @$(MAKE) -f $(MAKE_FILE) "COMP_MODE=$@" check_mode - @echo - @echo '==== COMPILE =================================================' - @$(MAKE) -f $(MAKE_FILE) \ - "FFLAGS=$(FFLAGS_N)" \ - "FFLAGS_NOSWAP=$(FFLAGS_NOSWAP_N)" \ - "CFLAGS=$(CFLAGS_N)" \ - $(OBJS) $(OBJS_NOSWAP) - @echo - @echo '==== LINK ====================================================' - @$(MAKE) -f $(MAKE_FILE) \ - "LIBS=$(LIBS_N)" "LDFLAGS=$(LDFLAGS_N)" \ - $(EXE_FILE) - -debug : - @$(MAKE) -f $(MAKE_FILE) "COMP_MODE=$@" check_mode - @echo - @echo '==== COMPILE =================================================' - @$(MAKE) -f $(MAKE_FILE) \ - "FFLAGS=$(FFLAGS_D)" \ - "FFLAGS_NOSWAP=$(FFLAGS_NOSWAP_D)" \ - "CFLAGS=$(CFLAGS_D)" \ - $(OBJS) $(OBJS_NOSWAP) - @echo - @echo '==== LINK ====================================================' - @$(MAKE) -f $(MAKE_FILE) \ - "LIBS=$(LIBS_D)" "LDFLAGS=$(LDFLAGS_D)" \ - $(EXE_FILE) - -check_mode : - @if [ -e $(LOG_FILE) ]; then \ - if [ '$(COMP_MODE)' != `head -n 1 $(LOG_FILE)` ]; then \ - echo ;\ - echo "### COMPILE MODE WAS CHANGED ###" ;\ - $(MAKE) -f $(MAKE_FILE) clean ;\ - fi ;\ - else \ - echo ;\ - echo "### NO LOG FILE ###" ;\ - $(MAKE) -f $(MAKE_FILE) clean ;\ - fi - @echo $(COMP_MODE) > $(LOG_FILE) - -# ------------------------- -# GMAO Nomenclature/targets -# ------------------------- -LIB = libenkf.a - -lib: $(LIB) - -enkf.x: $(OBJS) $(OBJS_NOSWAP) $(LIB) - $(FC) $(LDFLAGS) -o enkf.x enkf_main.o libenkf.a $(LIBsfcio) $(LIBsigio) $(LIBw3) $(LIBbacio) $(LIBbfr) $(LIBsp) $(LIBtransf) $(LIBhermes) $(LIBmpeu) $(LIBgfio) $(LIBhdf) $(LIBmpi) $(LIBsys) - -$(LIB): $(OBJS) $(OBJS_NOSWAP) - $(RM) $(LIB) - $(AR) $@ $(OBJS) $(OBJS_NOSWAP) - -export: libenkf.a enkf.x prepbykx.x - $(MKDIR) $(COREBIN) - $(CP) $(LIB) $(CORELIB) - $(CP) enkf.x $(COREBIN) - $(CP) enkf.rc.sample $(COREETC)/enkf.rc - $(CP) tlmadj_parameter.rc.sample $(COREETC)/tlmadj_parameter.rc - $(CP) gmao_airs_bufr.tbl $(COREETC)/gmao_airs_bufr.tbl - $(CP) gmao_global_pcpinfo.txt $(COREETC)/gmao_global_pcpinfo.rc - $(CP) gmao_global_satinfo.txt $(COREETC)/gmao_global_satinfo.rc - $(CP) gmao_global_ozinfo.txt $(COREETC)/gmao_global_ozinfo.rc - $(CP) gmao_global_convinfo.txt $(COREETC)/gmao_global_convinfo.rc - $(SED) -e "s^@DASPERL^$(DASPERL)^" < analyzer > $(COREBIN)/analyzer - chmod 755 $(COREBIN)/analyzer - -doc: AnIntro $(DOCSRC) - $(PROTEX) AnIntro *.f90 *.F90 > enkf.tex - $(LATEX) enkf.tex - $(LATEX) enkf.tex - -doclean: - - $(RM) *.tex *.dvi *.aux *.toc *.log *.ps *.pdf + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Help Target help: - @ echo "Available targets:" - @ echo "NCEP: make creates enkf executable " - @ echo "NPEP: make debug created enkf exec for debugging purposes" - @ echo "NCEP: make install creates enkf exec & places it in bin" - @ echo "GMAO: make lib creates enkf library" - @ echo "GMAO: make export creates lib, exec, & copies all to bin/inc/etc" - @ echo " make clean cleans objects, exec, and alien files" - @ echo " make doc creates documentation" - @ echo " make doclean clean doc-related temporary files" + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system diff --git a/src/enkf/cmake_install.cmake b/src/enkf/cmake_install.cmake new file mode 100644 index 0000000000..beb89d8da4 --- /dev/null +++ b/src/enkf/cmake_install.cmake @@ -0,0 +1,44 @@ +# Install script for directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf + +# Set the install prefix +IF(NOT DEFINED CMAKE_INSTALL_PREFIX) + SET(CMAKE_INSTALL_PREFIX "/usr/local") +ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) +STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + IF(BUILD_TYPE) + STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + ELSE(BUILD_TYPE) + SET(CMAKE_INSTALL_CONFIG_NAME "") + ENDIF(BUILD_TYPE) + MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + +# Set the component getting installed. +IF(NOT CMAKE_INSTALL_COMPONENT) + IF(COMPONENT) + MESSAGE(STATUS "Install component: \"${COMPONENT}\"") + SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + ELSE(COMPONENT) + SET(CMAKE_INSTALL_COMPONENT) + ENDIF(COMPONENT) +ENDIF(NOT CMAKE_INSTALL_COMPONENT) + +# Install shared libraries without execute permission? +IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + SET(CMAKE_INSTALL_SO_NO_EXE "0") +ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + +IF(CMAKE_INSTALL_COMPONENT) + SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +ELSE(CMAKE_INSTALL_COMPONENT) + SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +ENDIF(CMAKE_INSTALL_COMPONENT) + +FILE(WRITE "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/${CMAKE_INSTALL_MANIFEST}" "") +FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES}) + FILE(APPEND "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/${CMAKE_INSTALL_MANIFEST}" "${file}\n") +ENDFOREACH(file) diff --git a/src/enkf/d0 b/src/enkf/d0 new file mode 100644 index 0000000000..7168ca31f8 --- /dev/null +++ b/src/enkf/d0 @@ -0,0 +1 @@ + use gridio,only: ak,bk,eta1_ll,eta2_ll,ptop diff --git a/src/enkf/d1 b/src/enkf/d1 new file mode 100644 index 0000000000..6db25c180b --- /dev/null +++ b/src/enkf/d1 @@ -0,0 +1 @@ +use netcdf, only: nf90_nowrite,nf90_write,nf90_inquire,nf90_inquire_dimension diff --git a/src/enkf/d2 b/src/enkf/d2 new file mode 100644 index 0000000000..9c9086d736 --- /dev/null +++ b/src/enkf/d2 @@ -0,0 +1 @@ +integer(i_kind) file_id,var_id,dim_id,nlevsp1,nx_tile,ny_tile,ntile diff --git a/src/enkf/dd0 b/src/enkf/dd0 new file mode 100644 index 0000000000..850fd1b6e9 --- /dev/null +++ b/src/enkf/dd0 @@ -0,0 +1,17 @@ + if (u_ind > 0) then + varstrname = 'u' + + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(u_ind-1)+k,nb) + enddo + enddo + enddo + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + + endif diff --git a/src/enkf/fv3_netcdf_mod.F90 b/src/enkf/fv3_netcdf_mod.F90 index 05da48e973..f5c4761e12 100644 --- a/src/enkf/fv3_netcdf_mod.F90 +++ b/src/enkf/fv3_netcdf_mod.F90 @@ -1,6 +1,6 @@ module fv3_netcdf_mod -use kinds, only: r_kind, i_kind, r_double, r_single +use kinds, only: r_single, i_kind, r_double, r_single use netcdf, only: nf90_get_var,nf90_inq_varid use netcdf_mod, only: nc_check @@ -14,24 +14,40 @@ module fv3_netcdf_mod subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) real(r_single), intent(inout), dimension(:) :: data_arr character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id include "read_fv3_restart_data.f90" end subroutine read_fv3_restart_data1d subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) real(r_single), intent(inout), dimension(:,:) :: data_arr character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id include "read_fv3_restart_data.f90" end subroutine read_fv3_restart_data2d subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) real(r_single), intent(inout), dimension(:,:,:) :: data_arr character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id include "read_fv3_restart_data.f90" end subroutine read_fv3_restart_data3d subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id include "read_fv3_restart_data.f90" end subroutine read_fv3_restart_data4d diff --git a/src/enkf/gridinfo_fv3.f90 b/src/enkf/gridinfo_fv3.f90 index 0ea1fb3939..859c0bd8e8 100644 --- a/src/enkf/gridinfo_fv3.f90 +++ b/src/enkf/gridinfo_fv3.f90 @@ -142,7 +142,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) latsgrd = pi*latsgrd/180._r_single lonsgrd = pi*lonsgrd/180._r_single enddo - +!cltthink the unit of the lat/lon allocate(delp(res,res,nlevs,1),ps(res,nres)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) nn = 0 diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 new file mode 100644 index 0000000000..4ff1ef7965 --- /dev/null +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -0,0 +1,306 @@ +module gridinfo +!$$$ module documentation block +! +! module: gridinfo read horizontal (lons, lats) and +! vertical (pressure) information from +! ensemble mean first guess file. +! +! prgmmr: whitaker org: esrl/psd date: 2009-02-23 +! +! abstract: This module reads the ensemble mean background file and +! extracts information about the analysis grid, including the +! longitudes and latitudes of the analysis grid points and +! the pressure on each grid point/vertical level. +! +! Public Subroutines: +! getgridinfo: read latitudes, longitudes, pressures and orography for analysis grid, +! broadcast to each task. Compute spherical cartesian coordinate values +! for each analysis horizontal grid point. +! gridinfo_cleanup: deallocate allocated module variables. +! +! Public Variables: +! npts: number of analysis grid points in the horizontal (from module params). +! nlevs: number of analysis vertical levels (from module params). +! specific humidity, ozone and cloud condensate). +! ptop: (real scalar) pressure (hPa) at top model layer interface. +! lonsgrd(npts): real array of analysis grid longitudes (radians). +! latsgrd(npts): real array of analysis grid latitudes (radians). +! logp(npts,ndim): -log(press) for all 2d analysis grids. Assumed invariant +! in assimilation window, computed fro ensemble mean at middle of window. +! gridloc(3,npts): spherical cartesian coordinates (x,y,z) for analysis grid. +! +! Modules Used: mpisetup, params, kinds +! +! program history log: +! 2009-02-23 Initial version. +! 2016-05-02: shlyaeva: Modification for reading state vector from table +! 2016-04-20 Modify to handle the updated nemsio sig file (P, DP & DPDT removed) +! +! attributes: +! language: f95 +! +!$$$ + +use mpisetup, only: nproc, mpi_integer, mpi_real4, mpi_comm_world +use params, only: datapath,nlevs,nlons,nlats,use_gfs_nemsio, fgfileprefixes, & + fv3fixpath, nx_res,ny_res, ntiles +use kinds, only: r_kind, i_kind, r_double, r_single +use constants, only: one,zero,pi,cp,rd,grav,rearth,max_varname_length +use constants, only: half +use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr +use netcdf, only: nf90_inq_dimid,nf90_inq_varid +use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension +use netcdf_mod, only: nc_check +use read_fv3regional_restarts,only:read_fv3_restart_data1d,read_fv3_restart_data2d +use read_fv3regional_restarts,only:read_fv3_restart_data3d,read_fv3_restart_data4d + +implicit none +private +public :: getgridinfo, gridinfo_cleanup +public :: ak,bk,eta1_ll,eta2_ll +real(r_single),public :: ptop +real(r_single),public, allocatable, dimension(:) :: lonsgrd, latsgrd +! arrays passed to kdtree2 routines must be single +real(r_single),public, allocatable, dimension(:,:) :: gridloc +real(r_single),public, allocatable, dimension(:,:) :: logp +integer(i_kind), public :: nlevs_pres +integer,public :: npts +integer,public :: ntrunc +! supported variable names in anavinfo +character(len=max_varname_length),public, dimension(10) :: vars3d_supported = (/'u ', 'v ', 'tv ', 'q ', 'oz ', 'cw ', 'tsen', 'prse', 'ql ', 'qi '/) +character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) +! supported variable names in anavinfo +real(r_single), allocatable, dimension(:) :: ak,bk,eta1_ll,eta2_ll +contains + +subroutine getgridinfo(fileprefix, reducedgrid) +! read latitudes, longitudes and pressures for analysis grid, +! broadcast to each task. +use fv3_netcdf_mod, only: read_fv3_restart_data2d +implicit none + +character(len=120), intent(in) :: fileprefix +logical, intent(in) :: reducedgrid + +integer(i_kind) ierr, k, nn +character(len=500) filename +integer(i_kind) i,j +real(r_kind), allocatable, dimension(:) :: spressmn,tmpspec +real(r_kind), allocatable, dimension(:,:) :: pressimn,presslmn +real(r_kind) kap,kapr,kap1 + +integer(i_kind) file_id,var_id,dim_id,nlevsp1,nx_tile,ny_tile,ntile +integer (i_kind):: nn_tile0 +integer(i_kind) :: nlevsp1n,nlevsp2 +real(r_single), allocatable, dimension(:,:) :: lat_tile,lon_tile,ps +real(r_single), allocatable, dimension(:) :: ak_fv3,bk_fv3 +real(r_single), allocatable, dimension(:,:,:) :: delp,g_prsi +real(r_single) ptop +character(len=4) char_res +character(len=4) char_nxres +character(len=4) char_nyres +character(len=1) char_tile +character(len=24),parameter :: myname_ = 'fv3: getgridinfo' + +nlevsp1 = nlevs + 1 +nlevs_pres = nlevsp1 +npts = ntiles*nx_res*ny_res +kap = rd/cp +kapr = cp/rd +kap1 = kap + one + +! read data on root task +if (nproc .eq. 0) then + + ! read ak,bk from ensmean fv_core.res.nc + ! read nx,ny and nz from fv_core.res.nc + filename = trim(adjustl(fileprefix))//'/ensmean/INPUT/fv_core.res.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& + myname_,'inq_dimid xaxis_1 '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nx_tile),& + myname_,'inquire_dimension xaxis_1 '//trim(filename) ) + if(nx_res.ne.nx_tile) then + write(6,*)'the readin nx_tile does not equal to nx_res as expected, stop' + call stop2(25) + endif + + call nc_check( nf90_inq_dimid(file_id,'yaxis_1',dim_id),& + myname_,'inq_dimid yaxis_1 '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=ny_tile),& + myname_,'inquire_dimension yaxis_1 '//trim(filename) ) + if(ny_res.ne.ny_tile) then + write(6,*)'the readin ny_tile does not equal to ny_res as expected, stop' + call stop2(25) + endif + + + call nc_check( nf90_inq_dimid(file_id,'zaxis_1',dim_id),& + myname_,'inq_dimid zaxis_1 '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1n),& + myname_,'inquire_dimension zaxis_1 '//trim(filename) ) + if(nlevsp1n.ne.nlevsp1) then + write(6,*)'the configure nlevsp1 is not consistent with the parameter & + read from the data files, stop' + call stop2(25) + endif + + + + allocate(ak(nlevsp1),bk(nlevsp1)) + allocate(ak_fv3(nlevsp1),bk_fv3(nlevsp1)) + call read_fv3_restart_data1d('ak',filename,file_id,ak_fv3) + call read_fv3_restart_data1d('bk',filename,file_id,bk_fv3) + nlevsp2=nlevsp1+1 + do i=1,nlevsp1 + ak(i)=ak_fv3(nlevsp2-i) + bk(i)=bk_fv3(nlevsp2-i) + enddo + +!!!!! change unit of ak,also reverse the + + do i=1,nlevsp1 + eta1_ll(i)=ak(i)*0.01_r_kind + eta2_ll(i)=bk(i) + enddo + + + + + ptop = eta1_ll(nlevsp1) + + ! read lats/lons from C###_oro_data.tile#.nc + ! (this requires path to FV3 fix dir) + write(char_nxres, '(i4)') nx_res + write(char_nyres, '(i4)') ny_res + allocate(lat_tile(nx_res,ny_res),lon_tile(nx_res,ny_res)) + nn = 0 + allocate(latsgrd(npts),lonsgrd(npts)) + do ntile=1,ntiles + nn_tile0=(ntile-1)*nx_res*ny_res + write(char_tile, '(i1)') ntile +!cltorg filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' + filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_nxres))//'/C'//trim(adjustl(char_nyres))//'grid_spec.tile'//char_tile//'.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call read_fv3_restart_data2d('grid_lont',filename,file_id,lon_tile) + !print *,'min/max lon_tile',ntile,minval(lon_tile),maxval(lon_tile) + call read_fv3_restart_data2d('grid_latt',filename,file_id,lat_tile) + !print *,'min/max lat_tile',ntile,minval(lat_tile),maxval(lat_tile) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + latsgrd(nn) = lat_tile(i,j) + lonsgrd(nn) = lon_tile(i,j) + enddo + enddo + enddo !loop for ntilet + latsgrd = pi*latsgrd/180._r_single + lonsgrd = pi*lonsgrd/180._r_single +!cltthink the unit of the lat/lon + allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) + allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) + nn = 0 + do ntile=1,ntiles + nn_tile0=(ntile-1)*nx_res*ny_res + nn=nn_tile0 + write(char_tile, '(i1)') ntile +!cltorg filename = trim(adjustl(datapath))//'/ensmean/fv_core.res.tile'//char_tile//'.nc' + filename = trim(adjustl(datapath))//'/ensmean/dynvars.tile'//char_tile//'.nc' + !print *,trim(adjustl(filename)) + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + call read_fv3_restart_data3d('delp',filename,file_id,delp) + !print *,'min/max delp',ntile,minval(delp),maxval(delp) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + g_prsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed + do i=nlevs,1,-1 + g_prsi(:,:,i)=delp(:,:,i)*0.01_r_kind+g_prsi(:,:,i+1) + enddo + +!cltorg ps = sum(delp,3) + ptop + ps = g_prsi(:,:,1) + !print *,'min/max ps',ntile,minval(ps),maxval(ps) + nn=nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + spressmn(nn) = ps(i,j) + enddo + enddo + enddo + ! pressure at interfaces + do k=1,nlevsp1 + nn=nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + pressimn(nn,k) = g_prsi(i,j,k) + enddo + enddo + enddo + deallocate(delp,ak,bk,ps) + do k=1,nlevs + nn=nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + presslmn(nn,k) = (pressimn(nn,k)+pressimn(nn,k+1)) *half + enddo + enddo + end do + print *,'ensemble mean first guess surface pressure:' + print *,minval(spressmn),maxval(spressmn) + ! logp holds log(pressure) or pseudo-height on grid, for each level/variable. + allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers + do k=1,nlevs + ! all variables to be updated are on mid-layers, not layer interfaces. + logp(:,k) = -log(presslmn(:,k)) + !print *,'min/max presslmn',k,minval(presslmn(:,k)),maxval(presslmn(:,k)),minval(logp(:,k)),maxval(logp(:,k)) + end do + logp(:,nlevs_pres) = -log(spressmn(:)) + deallocate(spressmn,presslmn,pressimn) + deallocate(g_prsi,delp,ak_fv3,bk_fv3) + deallocate(eta1_ll,eta2_ll,ak,bk) + deallocate(lat_tile,lon_tile,ps) + +endif ! root task + +if (nproc .ne. 0) then + ! allocate arrays on other (non-root) tasks + allocate(latsgrd(npts),lonsgrd(npts)) + allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers + allocate(gridloc(3,npts)) +endif +!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) +do k=1,nlevs_pres + call mpi_bcast(logp(1,k),npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +enddo +call mpi_bcast(lonsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +call mpi_bcast(latsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +!clt ptop tothink to be defined +call mpi_bcast(ptop,1,mpi_real4,0,MPI_COMM_WORLD,ierr) + +!==> precompute cartesian coords of analysis grid points. +do nn=1,npts + gridloc(1,nn) = cos(latsgrd(nn))*cos(lonsgrd(nn)) + gridloc(2,nn) = cos(latsgrd(nn))*sin(lonsgrd(nn)) + gridloc(3,nn) = sin(latsgrd(nn)) +end do + +end subroutine getgridinfo + +subroutine gridinfo_cleanup() +if (allocated(lonsgrd)) deallocate(lonsgrd) +if (allocated(latsgrd)) deallocate(latsgrd) +if (allocated(logp)) deallocate(logp) +if (allocated(gridloc)) deallocate(gridloc) +end subroutine gridinfo_cleanup + +end module gridinfo diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 new file mode 100644 index 0000000000..b5d0775bb0 --- /dev/null +++ b/src/enkf/gridio_fv3reg.f90 @@ -0,0 +1,594 @@ +module gridio + + !======================================================================== + + !$$$ Module documentation block + ! + ! This module contains various routines to ingest and update + ! variables from Weather Research and Forecasting (WRF) model Advanced + ! Research WRF (ARW) and Non-hydrostatic Mesoscale Model (NMM) dynamical + ! cores which are required by the Ensemble Kalman Filter (ENKF) currently + ! designed for operations within the National Centers for Environmental + ! Prediction (NCEP) Global Forecasting System (GFS) + ! + ! prgmmr: Winterbottom org: ESRL/PSD1 date: 2011-11-30 + ! + ! program history log: + ! + ! 2011-11-30 Winterbottom - Initial version. + ! + ! 2019-01-?? Ting -- + ! attributes: + ! language: f95 + ! + !$$$ + + !========================================================================= + ! Define associated modules + use gridinfo, only: npts + use kinds, only: r_double, r_kind, r_single, i_kind + use mpisetup, only: nproc + use netcdf_io + use params, only: nlevs, cliptracers, datapath, arw, nmm, datestring + use params, only: nx_res,ny_res,nlevs,ntiles + use params, only: pseudo_rh + use mpeu_util, only: getindex + use read_fv3regional_restarts,only:read_fv3_restart_data1d,read_fv3_restart_data2d + use read_fv3regional_restarts,only:read_fv3_restart_data3d,read_fv3_restart_data4d + use netcdf_mod,only: nc_check + + implicit none + + !------------------------------------------------------------------------- + ! Define all public subroutines within this module + private + public :: readgriddata + public :: writegriddata + + !------------------------------------------------------------------------- + +contains + ! Generic WRF read routine, calls ARW-WRF or NMM-WRF + subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,reducedgrid,vargrid,qsat) + use constants, only:zero,one,half,fv, max_varname_length + use gridinfo,only: ak,bk,eta1_ll,eta2_ll,ptop + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_nowrite,nf90_write,nf90_inquire,nf90_inquire_dimension + implicit none + integer, intent(in) :: nanal, n2d, n3d, ndim, ntimes + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, dimension(0:n3d), intent(in) :: levels + character(len=120), dimension(7), intent(in) :: fileprefixes + logical, intent(in) :: reducedgrid + + real(r_single), dimension(npts,ndim,ntimes), intent(out) :: vargrid + real(r_double), dimension(npts,nlevs,ntimes), intent(out) :: qsat + + + + ! Define local variables + character(len=500) :: filename + character(len=:),allocatable :: fv3filename + character(len=7) :: charnanal + integer(i_kind) file_id,var_id,dim_id + + real(r_single), dimension(:,:,:), allocatable ::workvar3d,uworkvar3d,& + vworkvar3d,qvarworkvar3d,tvworkvar3d,tsenworkvar3d,& + workprsi,qworkvar3d + real(r_double),dimension(:,:,:),allocatable:: qsatworkvar3d + real(r_single), dimension(:,:), allocatable ::pswork + + ! Define variables required for netcdf variable I/O + character(len=12) :: varstrname + + character(len=4) char_nxres + character(len=4) char_nyres + character(len=4) char_tile + character(len=24),parameter :: myname_ = 'fv3: getgridinfo' + + ! Define counting variables + integer :: nlevsp1 + integer :: i,j, k,nn,ntile,nn_tile0, nb + integer :: u_ind, v_ind, tv_ind,tsen_ind, q_ind, oz_ind + integer :: ps_ind, sst_ind + logical :: ice + + !====================================================================== + nlevsp1=nlevs+1 + u_ind = getindex(vars3d, 'u') !< indices in the state var arrays + v_ind = getindex(vars3d, 'v') ! U and V (3D) + tv_ind = getindex(vars3d, 'tv') ! Tv (3D) + q_ind = getindex(vars3d, 'q') ! Q (3D) + oz_ind = getindex(vars3d, 'oz') ! Oz (3D) + tsen_ind = getindex(vars3d, 'tsen') !sensible T (3D) +! prse_ind = getindex(vars3d, 'prse') ! pressure + + ps_ind = getindex(vars2d, 'ps') ! Ps (2D) + sst_ind = getindex(vars2d, 'sst') ! SST (2D) + + ! Initialize all constants required by routine + allocate(workvar3d(nx_res,ny_res,nlevs)) + allocate(qworkvar3d(nx_res,ny_res,nlevs)) + allocate(qsatworkvar3d(nx_res,ny_res,nlevs)) + + if (ntimes > 1) then + write(6,*)'gridio/readgriddata: reading multiple backgrounds not yet supported' + call stop2(23) + endif + backgroundloop: do nb=1,ntimes + + ! Define character string for ensemble member file + if (nanal > 0) then + write(charnanal,'(a3, i3.3)') 'mem', nanal + else + charnanal = 'ensmean' + endif + + do ntile=1,ntiles + nn_tile0=(ntile-1)*nx_res*ny_res + write(char_tile, '(i1)') ntile + + filename = trim(adjustl(datapath))//trim(adjustl(fileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) + + !---------------------------------------------------------------------- + ! read u-component + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + !---------------------------------------------------------------------- + ! Update u and v variables (same for NMM and ARW) + + if (u_ind > 0) then + allocate(uworkvar3d(nx_res+1,ny_res,nlevs)) + varstrname = 'u' + + call read_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(u_ind-1)+k,nb)=uworkvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(u_ind-1)+1, levels(u_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : u ', & + & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + enddo + + deallocate(uworkvar3d) + endif + if (v_ind > 0) then + allocate(vworkvar3d(nx_res,ny_res+1,nlevs)) + varstrname = 'v' + call read_fv3_restart_data3d(varstrname,filename,file_id,vworkvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(v_ind-1)+k,nb)=vworkvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(v_ind-1)+1, levels(v_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : v ', & + & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + enddo + deallocate(vworkvar3d) + + endif + + if (tv_ind > 0.or.tsen_ind) then + allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) + varstrname = 't' + call read_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) + if(tv_ind >0 .or. q_ind>0) then + allocate(qworkvar3d(nx_res,ny_res,nlevs)) + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) + + + if (q_ind > 0) then + varstrname = 'sphum' + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(q_ind-1)+k,nb)=qworkvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(q_ind-1)+1, levels(q_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : q ', & + & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + enddo + + endif + endif + if(tv_ind > 0) then + do k=1,nlevs + do j=1,ny_res + do i=1,nx_res + workvar3d(i,j,k)=tsenworkvar3d(i,j,k)*(one+fv*qworkvar3d(i,j,k)) + enddo + enddo + enddo + else! tsen_id >0 + workvar3d=tsenworkvar3d + endif + + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(tv_ind-1)+k,nb)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(tv_ind-1)+1, levels(tv_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : t ', & + & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + enddo + + endif + if(allocated(tsenworkvar3d)) deallocate(tsenworkvar3d) + + + + if (oz_ind > 0) then + varstrname = 'o3mr' + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(oz_ind-1)+k,nb)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(oz_ind-1)+1, levels(oz_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : oz ', & + & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + enddo + + endif + + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + ! set SST to zero for now + if (sst_ind > 0) then + vargrid(:,levels(n3d)+sst_ind,nb) = zero + endif + + + !---------------------------------------------------------------------- + ! Allocate memory for variables computed within routine + + if (ps_ind > 0) then + allocate(workprsi(nx_res,ny_res,nlevs)) + allocate(pswork(nx_res,ny_res)) + varstrname = 'u' + fv3filename=trim(adjustl(filename))//"_dynvars" + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) + call read_fv3_restart_data3d('delp',filename,file_id,workvar3d) !cltto think different files be used + !print *,'min/max delp',ntile,minval(delp),maxval(delp) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) + workprsi(:,:,nlevsp1+1)=eta1_ll(nlevsp1) !etal_ll is needed + do i=nlevs,1,-1 + workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) + enddo + + pswork(:,:)=workprsi(:,:,1) + + + + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(ps_ind-1), nb) =pswork(i,j) + enddo + enddo + + + + + + do k=1,nlevs + do j=1,ny_res + do i=1,nx_res + workvar3d(i,j,k)=(workprsi(i,j,k)+workprsi(i,j,k+1))*half + enddo + enddo + enddo + allocate(qsatworkvar3d(nx_res,ny_res,nlevs)) + ice=.true. !tothink + if (pseudo_rh) then + call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & + nx_res*ny_res,nlevs) + else + qsatworkvar3d(:,:,:) = 1._r_double + endif + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + qsat(nn,k,nb)=qsatworkvar3d(i,j,k) + enddo + enddo + enddo + + + + + + if(allocated(workprsi)) deallocate(workprsi) + if(allocated(pswork)) deallocate(pswork) + if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) + if(allocated(qworkvar3d)) deallocate(qworkvar3d) + if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) + + endif + !====================================================================== + ! Deallocate memory + if(allocated(workvar3d)) deallocate(workvar3d) + end do ! ntile loop + + end do backgroundloop ! loop over backgrounds to read in + + return + + end subroutine readgriddata + + !======================================================================== + ! readgriddata_nmm.f90: read WRF-NMM state or control vector + !------------------------------------------------------------------------- + + + !======================================================================== + ! writegriddata.f90: write WRF-ARW or WRF-NMM analysis + !------------------------------------------------------------------------- + + subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) + use constants, only: zero, one,fv,half + use params, only: nbackgrounds, anlfileprefixes, fgfileprefixes + use params, only: nx_res,ny_res,nlevs,ntiles + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_write,nf90_write,nf90_inquire,nf90_inquire_dimension + use write_fv3regional_restarts,only:write_fv3_restart_data1d,write_fv3_restart_data2d + use write_fv3regional_restarts,only:write_fv3_restart_data3d,write_fv3_restart_data4d + include 'netcdf.inc' + + !---------------------------------------------------------------------- + ! Define variables passed to subroutine + integer, intent(in) :: nanal, n2d, n3d, ndim + character(len=*), dimension(n2d), intent(in) :: vars2d + character(len=*), dimension(n3d), intent(in) :: vars3d + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds), intent(in) :: vargrid + logical, intent(in) :: no_inflate_flag + + !---------------------------------------------------------------------- + ! Define variables computed within subroutine + character(len=500) :: filename + character(len=:),allocatable :: fv3filename + character(len=3) :: charnanal + + !---------------------------------------------------------------------- + integer(i_kind) :: u_ind, v_ind, tv_ind, tsen_ind,q_ind, ps_ind,oz_ind + integer(i_kind) :: w_ind, cw_ind, ph_ind + + integer(i_kind) file_id,var_id,dim_id + real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,uworkvar3d,& + vworkvar3d,qvarworkvar3d,tvworkvar3d,tsenworkvar3d,& + workprsi,qworkvar3d + !---------------------------------------------------------------------- + ! Define variables required by for extracting netcdf variable + ! fields + character(len=19) :: DateStr + ! Define variables required for netcdf variable I/O + character(len=12) :: varstrname + character(len=4) char_nxres + character(len=4) char_nyres + character(len=4) char_tile + character(len=:),allocatable:: varname + character(len=24),parameter :: myname_ = 'fv3: getgridinfo' + + !---------------------------------------------------------------------- + ! Define counting variables + integer :: i,j,k,nn,ntile,nn_tile0, nb + + + + real(r_single) :: ptop + + !---------------------------------------------------------------------- + + u_ind = getindex(vars3d, 'u') !< indices in the state var arrays + v_ind = getindex(vars3d, 'v') ! U and V (3D) + tv_ind = getindex(vars3d, 'tv') ! Tv (3D) + tsen_ind = getindex(vars3d, 'tsen') ! Tv (3D) + q_ind = getindex(vars3d, 'q') ! Q (3D) + cw_ind = getindex(vars3d, 'cw') ! CWM for WRF-NMM + w_ind = getindex(vars3d, 'w') ! W for WRF-ARW + ph_ind = getindex(vars3d, 'ph') ! PH for WRF-ARW + + ps_ind = getindex(vars2d, 'ps') ! Ps (2D) + + ! Initialize constants required by routine +!cltorg call init_constants(.true.) + + !---------------------------------------------------------------------- + if (nbackgrounds > 1) then + write(6,*)'gridio/writegriddata: writing multiple backgrounds not yet supported' + call stop2(23) + endif + + backgroundloop: do nb=1,nbackgrounds + + !---------------------------------------------------------------------- + ! First guess file should be copied to analysis file at scripting + ! level; only variables updated by EnKF are changed + write(charnanal,'(i3.3)') nanal + filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal + call nc_check( nf90_open(trim(adjustl(filename)),nf90_write,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + !---------------------------------------------------------------------- + ! Update u and v variables (same for NMM and ARW) + do ntile=1,ntiles + nn_tile0=(ntile-1)*nx_res*ny_res + write(char_tile, '(i1)') ntile + + filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) + + !---------------------------------------------------------------------- + ! read u-component + call nc_check( nf90_open(trim(adjustl(filename)),nf90_write,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + + ! update CWM for WRF-NMM + if (u_ind > 0) then + varstrname = 'u' + + call read_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(u_ind-1)+k,nb) + enddo + enddo + enddo + uworkvar3d(1:nx_res,:,:)=workvar3d+workinc3d + uworkvar3d(nx_res+1,:,:)=uworkvar3d(nx_res,:,:) + call write_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + + endif + + if (v_ind > 0) then + varstrname = 'v' + + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(v_ind-1)+k,nb) + enddo + enddo + enddo + vworkvar3d(:,1:ny_res,:)=workvar3d+workinc3d + vworkvar3d(:,ny_res+1,:)=vworkvar3d(:,ny_res,:) + call write_fv3_restart_data3d(varstrname,filename,file_id,vworkvar3d) + + endif + if (tv_ind > 0.or.tsen_ind>0 ) then + varstrname = 't' + + if(tsen_ind>0) then + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(tsen_ind-1)+k,nb) + enddo + enddo + enddo + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + else ! tv_ind >0 + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(tv_ind-1)+k,nb) + enddo + enddo + enddo + + call read_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) + call read_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) + tvworkvar3d=tsenworkvar3d*qworkvar3d + tvworkvar3d=tvworkvar3d+workinc3d + if(q_ind > 0) then + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(q_ind-1)+k,nb) + enddo + enddo + enddo + qworkvar3d=qworkvar3d+workinc3d + endif + tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d(i,j,k)) + call write_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) + if(q_ind>0) then + varname='sphum' + + call write_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) + endif + + + + endif + + endif + if (oz_ind > 0) then + varstrname = 'o3mr' + + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(oz_ind-1)+k,nb) + enddo + enddo + enddo + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + + endif + + + !---------------------------------------------------------------------- + ! update time stamp is to be considered NSTART_HOUR in NMM (HWRF) restart file. + !====================================================================== + end do ! tiles + end do backgroundloop ! loop over backgrounds to read in + + ! Return calculated values + return + + !====================================================================== + + end subroutine writegriddata + + +end module gridio diff --git a/src/enkf/gridio_nmmb.f90 b/src/enkf/gridio_nmmb.f90 index 67d8f0b7e1..e4ff302159 100644 --- a/src/enkf/gridio_nmmb.f90 +++ b/src/enkf/gridio_nmmb.f90 @@ -44,6 +44,7 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi integer :: u_ind, v_ind, t_ind, tsen_ind, q_ind, oz_ind, cw_ind, prse_ind integer :: ps_ind, sst_ind !integer(nemsio_intkind) :: idvc +write(6,*)'test' u_ind = getindex(vars3d, 'u') !< indices in the state var arrays v_ind = getindex(vars3d, 'v') ! U and V (3D) @@ -200,6 +201,7 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo ! compute qsat if (pseudo_rh) then +!cltthothink problem call genqsat1(grdin(:,levels(q_ind-1)+1:levels(q_ind-1)+nlevs,nb),qsat(:,:,nb),pslg,& grdin(:,levels(t_ind-1)+1:levels(t_ind-1)+nlevs,nb),ice,npts,nlevs) else diff --git a/src/enkf/observer_fv3reg.f90 b/src/enkf/observer_fv3reg.f90 new file mode 100644 index 0000000000..3654e17834 --- /dev/null +++ b/src/enkf/observer_fv3reg.f90 @@ -0,0 +1,156 @@ +module observer_enkf +!clt a dummy module ,modified from observer_gfs.f90 +use statevec, only: nsdim, ns3d, ns2d, slevels +use params, only: nlevs, neigv + +private +public init_observer_enkf, setup_linhx, calc_linhx, calc_linhx_modens,& + destroy_observer_enkf +integer, allocatable, dimension(:) :: kindx + +contains + +subroutine init_observer_enkf + write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' + call stop2(555) + return +end subroutine init_observer_enkf + +subroutine destroy_observer_enkf + write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' + call stop2(555) +end subroutine destroy_observer_enkf + +subroutine setup_linhx(rlat, rlon, time, ix, delx, ixp, delxp, iy, dely, & + iyp, delyp, it, delt, itp, deltp) +!$$$ subprogram documentation block +! . . . . +! subprogram: calc_linhx +! prgmmr: shlyaeva org: esrl/psd date: 2016-11-29 +! +! abstract: +! +! program history log: +! 2016-11-29 shlyaeva +! +! input argument list: +! +! output argument list: +! +! attributes: +! language: f95 +! +!$$$ + use kinds, only: r_kind,i_kind,r_single + use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim + use gridinfo, only: npts, latsgrd, lonsgrd + use statevec, only: nsdim + use constants, only: zero,one,pi + use mpisetup + implicit none + +! Declare passed variables + real(r_single) ,intent(in ) :: rlat, rlon ! observation lat and lon in radians + real(r_single) ,intent(in ) :: time ! observation time relative to middle of window + integer(i_kind), intent(out) :: ix, iy, it, ixp, iyp, itp + real(r_kind), intent(out) :: delx, dely, delxp, delyp, delt, deltp + write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' + call stop2(555) + + + ! find interplation indices and deltas + +end subroutine setup_linhx + +subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & + ix, delx, ixp, delxp, iy, dely, iyp, delyp, & + it, delt, itp, deltp) +!$$$ subprogram documentation block +! . . . . +! subprogram: calc_linhx +! prgmmr: shlyaeva org: esrl/psd date: 2016-11-29 +! +! abstract: +! +! program history log: +! 2016-11-29 shlyaeva +! +! input argument list: +! +! output argument list: +! +! attributes: +! language: f95 +! +!$$$ + use kinds, only: r_kind,i_kind,r_single + use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim + use gridinfo, only: npts, latsgrd, lonsgrd + use statevec, only: nsdim + use constants, only: zero,one,pi + use sparsearr, only: sparr + use mpisetup + implicit none + +! Declare passed variables + real(r_single) ,intent(in ) :: hx ! H(x_mean) + real(r_single),dimension(npts,nsdim,nstatefields),intent(in ) :: dens ! x_ens - x_mean, state vector space + integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp + real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp + type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + real(r_single) ,intent( out) :: hx_ens ! H (x_ens) + integer(i_kind) i,j,k + + write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' + call stop2(555) + + return +end subroutine calc_linhx + +subroutine calc_linhx_modens(hx, dens, dhx_dx, hx_ens, & + ix, delx, ixp, delxp, iy, dely, iyp, delyp, & + it, delt, itp, deltp, vscale) +!$$$ subprogram documentation block +! . . . . +! subprogram: calc_linhx +! prgmmr: shlyaeva org: esrl/psd date: 2016-11-29 +! +! abstract: +! +! program history log: +! 2016-11-29 shlyaeva +! +! input argument list: +! +! output argument list: +! +! attributes: +! language: f95 +! +!$$$ + use kinds, only: r_kind,i_kind,r_single + use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim + use gridinfo, only: npts, latsgrd, lonsgrd + use statevec, only: nsdim + use constants, only: zero,one,pi + use sparsearr, only: sparr + use mpisetup + implicit none + +! Declare passed variables + real(r_single) ,intent(in ) :: hx ! H(x_mean) + real(r_single),dimension(npts,nsdim,nstatefields),intent(in ) :: dens ! x_ens - x_mean, state vector space + integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp + real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp + type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + real(r_single) ,intent( out) :: hx_ens(neigv)! H (x_ens) + real(r_double),dimension(neigv,nlevs+1) ,intent(in ) :: vscale ! vertical scaling (for modulated ens) + integer(i_kind) i,j,k + write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' + call stop2(555) + + + return +end subroutine calc_linhx_modens + +end module observer_enkf diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index 86a5c86140..a3df212f79 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -187,7 +187,7 @@ module params logical,public :: fv3_native = .false. character(len=500),public :: fv3fixpath = ' ' integer(i_kind),public :: ntiles=6 -integer(i_kind),public :: res=0 +integer(i_kind),public :: nx_res=0,ny_res=0 namelist /nam_enkf/datestring,datapath,iassim_order,nvars,& covinflatemax,covinflatemin,deterministic,sortinc,& @@ -211,7 +211,7 @@ module params fso_cycling,fso_calculate,imp_physics,lupp,fv3_native namelist /nam_wrf/arw,nmm,nmm_restart -namelist /nam_fv3/fv3fixpath,res,ntiles +namelist /nam_fv3/fv3fixpath,nx_res,ny_res,ntiles namelist /satobs_enkf/sattypes_rad,dsis namelist /ozobs_enkf/sattypes_oz @@ -346,7 +346,7 @@ subroutine read_namelist() endif if (fv3_native) then read(912,nam_fv3) - nlons = res; nlats = res ! (total number of pts = ntiles*res*res) + nlons = nx_res; nlats = ny_res ! (total number of pts = ntiles*res*res) endif close(912) @@ -475,8 +475,8 @@ subroutine read_namelist() print *, 'must select either arw, nmm or nmmb regional dynamical core' call stop2(19) endif - if (fv3_native .and. (fv3fixpath == ' ' .or. res == 0)) then - print *, 'must specify res and fv3fixpath when fv3_native is true' + if (fv3_native .and. (fv3fixpath == ' ' .or. nx_res == 0.or.ny_res)) then + print *, 'must specify nx_res,ny_res and fv3fixpath when fv3_native is true' call stop2(19) endif if (letkf_flag .and. univaroz) then diff --git a/src/enkf/read_fv3_restart_data.f90 b/src/enkf/read_fv3_restart_data.f90 index 39a25cf6a6..ddd9522949 100644 --- a/src/enkf/read_fv3_restart_data.f90 +++ b/src/enkf/read_fv3_restart_data.f90 @@ -1,7 +1,3 @@ - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) call nc_check( nf90_get_var(file_id,var_id,data_arr),& diff --git a/src/enkf/read_fv3regional_restart_data.f90 b/src/enkf/read_fv3regional_restart_data.f90 new file mode 100644 index 0000000000..39a25cf6a6 --- /dev/null +++ b/src/enkf/read_fv3regional_restart_data.f90 @@ -0,0 +1,8 @@ + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& + myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) + call nc_check( nf90_get_var(file_id,var_id,data_arr),& + myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) diff --git a/src/enkf/read_fv3regional_restarts.f90 b/src/enkf/read_fv3regional_restarts.f90 new file mode 100644 index 0000000000..31d7b82474 --- /dev/null +++ b/src/enkf/read_fv3regional_restarts.f90 @@ -0,0 +1,60 @@ + module read_fv3regional_restarts +!clt modified from read_fv3_restarts.f90 + +! ifort -I${NETCDF}/include -O2 -traceback read_fv3_restarts.f90 kinds.o +! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff + +! read data from FV3 restart files. + + + use kinds, only: i_kind,r_single,r_kind + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf_mod, only: nc_check + public read_fv3_restart_data1d,read_fv3_restart_data2d + public read_fv3_restart_data3d,read_fv3_restart_data4d + + contains + + subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data1d + + subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data2d + + subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data3d + + subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "read_fv3_restart_data.f90" + end subroutine read_fv3_restart_data4d + + end module read_fv3regional_restarts diff --git a/src/enkf/smooth_fv3reg.f90 b/src/enkf/smooth_fv3reg.f90 new file mode 100644 index 0000000000..39646071a8 --- /dev/null +++ b/src/enkf/smooth_fv3reg.f90 @@ -0,0 +1,23 @@ +module smooth_mod + +use mpisetup +use params, only: nlons,nlats,smoothparm +use controlvec, only: ncdim +use kinds, only: r_kind +use gridinfo, only: npts + +implicit none + +private +public :: smooth + +contains + +subroutine smooth(grids) +real(r_single), intent(inout) :: grids(npts,ncdim) ! there are ndim 2d grids. +! stub - not yet implemented. +if (nproc .eq. 0) print *,'FV3reg inflation smoothing not yet implemented!,stop' +call stop2(544) +end subroutine smooth + +end module smooth_mod diff --git a/src/enkf/test.dot b/src/enkf/test.dot new file mode 100644 index 0000000000..f4f3033161 --- /dev/null +++ b/src/enkf/test.dot @@ -0,0 +1,5 @@ +digraph GG { +node [ + fontsize = "12" +]; +} diff --git a/src/enkf/write_fv3_restart_data.f90 b/src/enkf/write_fv3_restart_data.f90 new file mode 100644 index 0000000000..9196d5bb0b --- /dev/null +++ b/src/enkf/write_fv3_restart_data.f90 @@ -0,0 +1,4 @@ + call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& + myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) + call nc_check( nf90_put_var(file_id,var_id,data_arr),& + myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) diff --git a/src/enkf/write_fv3regional_restarts.f90 b/src/enkf/write_fv3regional_restarts.f90 new file mode 100644 index 0000000000..642176ac2b --- /dev/null +++ b/src/enkf/write_fv3regional_restarts.f90 @@ -0,0 +1,60 @@ + module write_fv3regional_restarts +!clt modified from write_fv3_restarts.f90 + +! ifort -I${NETCDF}/include -O2 -traceback write_fv3_restarts.f90 kinds.o +! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff + +! read data from FV3 restart files. + + + use kinds, only: i_kind,r_single,r_kind + use netcdf, only: nf90_open,nf90_close,nf90_put_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf_mod, only: nc_check + public write_fv3_restart_data1d,write_fv3_restart_data2d + public write_fv3_restart_data3d,write_fv3_restart_data4d + + contains + + subroutine write_fv3_restart_data1d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:) :: data_arr + character(len=24),parameter :: myname_ = 'write_fv3_restart_data1d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "write_fv3_restart_data.f90" + end subroutine write_fv3_restart_data1d + + subroutine write_fv3_restart_data2d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:) :: data_arr + character(len=24),parameter :: myname_ = 'write_fv3_restart_data2d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "write_fv3_restart_data.f90" + end subroutine write_fv3_restart_data2d + + subroutine write_fv3_restart_data3d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'write_fv3_restart_data3d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "write_fv3_restart_data.f90" + end subroutine write_fv3_restart_data3d + + subroutine write_fv3_restart_data4d(varname,filename,file_id,data_arr) + real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr + character(len=24),parameter :: myname_ = 'write_fv3_restart_data4d' + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: filename + integer(i_kind), intent(in) :: file_id + integer(i_kind) :: var_id + include "write_fv3_restart_data.f90" + end subroutine write_fv3_restart_data4d + + end module write_fv3regional_restarts From 682d8a0eb6ac9af1f3251443e2c960fd7a4d3585 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 21 Feb 2019 17:40:08 +0000 Subject: [PATCH 004/155] check in initial version for the GSI incorporating FV3 regional ensembles on developing mode --- src/class_get_fv3_regional_ensperts.f90 | 32 ++ src/cplr_get_fv3_regional_ensperts.f90 | 667 ++++++++++++++++++++++++ 2 files changed, 699 insertions(+) create mode 100644 src/class_get_fv3_regional_ensperts.f90 create mode 100644 src/cplr_get_fv3_regional_ensperts.f90 diff --git a/src/class_get_fv3_regional_ensperts.f90 b/src/class_get_fv3_regional_ensperts.f90 new file mode 100644 index 0000000000..e3e4b5ed46 --- /dev/null +++ b/src/class_get_fv3_regional_ensperts.f90 @@ -0,0 +1,32 @@ +module abstract_get_fv3_regional_ensperts_mod +!clt first copied from class_get_wrf_nmm_ensperts.f90 + type, abstract :: abstract_get_fv3_regional_ensperts_class + contains + procedure(get_fv3_regional_ensperts), deferred, pass(this) :: get_fv3_regional_ensperts +!cltthink procedure(convert_binary_nmm_ens), deferred, pass(this) :: convert_binary_nmm_ens + end type abstract_get_fv3_regional_ensperts_class + + abstract interface + subroutine get_fv3_regional_ensperts(this,en_perts,nelen,ps_bar) + use gsi_bundlemod, only: gsi_bundle + use kinds, only: r_kind,i_kind,r_single + + import abstract_get_fv3_regional_ensperts_class + implicit none + class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this + type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + real(r_single),dimension(:,:,:),allocatable, intent(inout):: ps_bar + + end subroutine get_fv3_regional_ensperts + end interface + abstract interface + + subroutine convert_binary_fv3_regional_ens(this) + import abstract_get_fv3_regional_ensperts_class + implicit none + class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this + end subroutine convert_binary_fv3_regional_ens + end interface + +end module abstract_get_fv3_regional_ensperts_mod diff --git a/src/cplr_get_fv3_regional_ensperts.f90 b/src/cplr_get_fv3_regional_ensperts.f90 new file mode 100644 index 0000000000..7d18c3b453 --- /dev/null +++ b/src/cplr_get_fv3_regional_ensperts.f90 @@ -0,0 +1,667 @@ +module get_fv3_regional_ensperts_mod +!clt started from cplr_get_fv3_regional_ensperts.f90 +use abstract_get_fv3_regional_ensperts_mod + use kinds, only : i_kind + type, extends(abstract_get_fv3_regional_ensperts_class) :: get_fv3_regional_ensperts_class + contains + procedure, pass(this) :: get_fv3_regional_ensperts => get_fv3_regional_ensperts_run + procedure, pass(this) :: ens_spread_dualres_regional => ens_spread_dualres_regional_fv3_regional + procedure, pass(this) :: general_read_fv3_regional + end type get_fv3_regional_ensperts_class +contains + subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) + !$$$ subprogram documentation block + ! . . . . + ! subprogram: get_fv3_regional_ensperts read arw model ensemble members + ! prgmmr: Ting org: ncar/mmm date: 2018-12-13 + ! + ! abstract: read ensemble members from the fv3 regional (fv3_SAR) + ! model,following Wanshu's programs to read those background files + ! + ! + ! program history log: + ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle + ! + ! input argument list: + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + + use kinds, only: r_kind,i_kind,r_single + use constants, only: zero,one,half,zero_single,rd_over_cp,one_tenth + use mpimod, only: mpi_comm_world,ierror,mype + use hybrid_ensemble_parameters, only: n_ens,grd_ens + use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path + use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d + use gsi_bundlemod, only: gsi_bundlecreate + use gsi_bundlemod, only: gsi_grid + use gsi_bundlemod, only: gsi_bundle + use gsi_bundlemod, only: gsi_bundlegetpointer + use gsi_bundlemod, only: gsi_bundledestroy + use gsi_bundlemod, only: gsi_gridcreate + use guess_grids, only: ntguessig,ifilesig + use gsi_4dvar, only: nhr_assimilation + use gsi_4dvar, only: ens_fhrlevs + use gsi_rfv3io_mod, only: type_fv3regfilenameg + + implicit none + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + real(r_single),dimension(:,:,:),allocatable:: ps_bar + + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig):: u,v,tv,cwmr,oz,rh + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2):: ps + + real(r_single),pointer,dimension(:,:,:):: w3 + real(r_single),pointer,dimension(:,:):: w2 + real(r_kind),pointer,dimension(:,:,:):: x3 + real(r_kind),pointer,dimension(:,:):: x2 + type(gsi_bundle),allocatable,dimension(:):: en_bar + type(gsi_grid):: grid_ens + real(r_kind):: bar_norm,sig_norm,kapr,kap1 + + integer(i_kind):: i,j,k,n,mm1,istatus + integer(i_kind):: ic2,ic3 + integer(i_kind):: m + + character(255) filelists(ntlevs_ens) + character(255) ensfilenam_str + type(type_fv3regfilenameg)::fv3_filename + + call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) + ! Allocate bundle to hold mean of ensemble members + allocate(en_bar(ntlevs_ens)) + do m=1,ntlevs_ens + call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' + call stop2(999) + endif + enddo ! for m + + + do m=1,ntlevs_ens + + + + ! + ! INITIALIZE ENSEMBLE MEAN ACCUMULATORS + en_bar(m)%values=zero + + do n=1,n_ens + en_perts(n,m)%valuesr4 = zero + enddo + + mm1=mype+1 + kap1=rd_over_cp+one + kapr=one/rd_over_cp + ! + ! LOOP OVER ENSEMBLE MEMBERS + do n=1,n_ens + write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n +22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) + ! DEFINE INPUT FILE NAME + fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe + fv3_filename%ak_bk=trim(ensfilenam_str)//'fv3_akbk' + fv3_filename%dynvars=trim(ensfilenam_str)//'-fv3_dynavars' + fv3_filename%tracers=trim(ensfilenam_str)//"-fv3_tracer" + fv3_filename%sfcdata=trim(ensfilenam_str)//"-fv3_sfcdata" + fv3_filename%couplerres=trim(ensfilenam_str)//"-coupler.res" + ! + ! READ ENEMBLE MEMBERS DATA + if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) + call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) + + ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR + do ic3=1,nc3d + + call gsi_bundlegetpointer(en_perts(n,m),trim(cvars3d(ic3)),w3,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for ensemble member ',n + call stop2(999) + end if + call gsi_bundlegetpointer(en_bar(m),trim(cvars3d(ic3)),x3,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for en_bar' + call stop2(999) + end if + + select case (trim(cvars3d(ic3))) + + case('sf','SF') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = u(j,i,k) + x3(j,i,k)=x3(j,i,k)+u(j,i,k) + end do + end do + end do + + case('vp','VP') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = v(j,i,k) + x3(j,i,k)=x3(j,i,k)+v(j,i,k) + end do + end do + end do + + case('t','T') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = tv(j,i,k) + x3(j,i,k)=x3(j,i,k)+tv(j,i,k) + end do + end do + end do + + case('q','Q') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = rh(j,i,k) + x3(j,i,k)=x3(j,i,k)+rh(j,i,k) + end do + end do + end do + + case('oz','OZ') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = oz(j,i,k) + x3(j,i,k)=x3(j,i,k)+oz(j,i,k) + end do + end do + end do + + + end select + end do + + do ic2=1,nc2d + + call gsi_bundlegetpointer(en_perts(n,m),trim(cvars2d(ic2)),w2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for ensemble member ',n + call stop2(999) + end if + call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar' + call stop2(999) + end if + + select case (trim(cvars2d(ic2))) + + case('ps','PS') + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w2(j,i) = ps(j,i) + x2(j,i)=x2(j,i)+ps(j,i) + end do + end do + + case('sst','SST') + ! IGNORE SST IN HYBRID for now + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w2(j,i) = zero + x2(j,i)=zero + end do + end do + + end select + end do + enddo + ! + ! CALCULATE ENSEMBLE MEAN + bar_norm = one/float(n_ens) + en_bar(m)%values=en_bar(m)%values*bar_norm + + ! Copy pbar to module array. ps_bar may be needed for vertical localization + ! in terms of scale heights/normalized p/p + do ic2=1,nc2d + + if(trim(cvars2d(ic2)) == 'ps'.or.trim(cvars2d(ic2)) == 'PS') then + + call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar to get ps_bar' + call stop2(999) + end if + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + ps_bar(j,i,1)=x2(j,i) + end do + end do + exit + end if + end do + + call mpi_barrier(mpi_comm_world,ierror) + ! + ! CALCULATE ENSEMBLE SPREAD + call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) + call mpi_barrier(mpi_comm_world,ierror) + ! + ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS + sig_norm=sqrt(one/max(one,n_ens-one)) + + do n=1,n_ens + do i=1,nelen + en_perts(n,m)%valuesr4(i)=(en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i))*sig_norm + end do + end do + + enddo ! it 4d loop + do m=1,ntlevs_ens + call gsi_bundledestroy(en_bar(m),istatus) + if(istatus/=0) then + write(6,*)' in get_fv3_regional_ensperts_netcdf: trouble destroying en_bar bundle' + call stop2(999) + endif + end do + + deallocate(en_bar) + ! + + return + +30 write(6,*) 'get_fv3_regional_ensperts_netcdf: open filelist failed ' + call stop2(555) +20 write(6,*) 'get_fv3_regional_ensperts_netcdf: read WRF-ARW ens failed ',n + call stop2(555) + + end subroutine get_fv3_regional_ensperts_run + + subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) +!clt modified from rad_fv3_netcdf_guess + !$$$ subprogram documentation block + ! . . . . + ! subprogram: general_read_fv3_regional read arw model ensemble members + ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 + ! + ! abstract: read ensemble members from the arw model in "wrfout" netcdf format + ! for use with hybrid ensemble option. + ! + ! program history log: + ! 2010-08-11 parrish, initial documentation + ! 2010-09-10 parrish, modify so ensemble variables are read in the same way as in + ! subroutines convert_netcdf_mass and read_fv3_regional_binary_guess. + ! There were substantial differences due to different opinion about what + ! to use for surface pressure. This issue should be resolved by coordinating + ! with Ming Hu (ming.hu@noaa.gov). At the moment, these changes result in + ! agreement to single precision between this input method and the guess input + ! procedure when the same file is read by both methods. + ! 2012-03-12 whitaker: read data on root, distribute with scatterv. + ! remove call to general_reload. + ! simplify, fix memory leaks, reduce memory footprint. + ! use genqsat, remove genqsat2_regional. + ! replace bare 'stop' statements with call stop2(999). + ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS core + ! + ! input argument list: + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + + use netcdf, only: nf90_nowrite + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_inq_dimid,nf90_inquire_dimension + use netcdf, only: nf90_inq_varid,nf90_inquire_variable,nf90_get_var + use kinds, only: r_kind,r_single,i_kind + use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll + use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 + use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens + use mpimod, only: mpi_comm_world,ierror,mpi_rtype + use mpimod, only: npe + use netcdf_mod, only: nc_check + use gsi_rfv3io_mod,only: type_fv3regfilenameg + use gsi_rfv3io_mod,only:n2d + use gsi_rfv3io_mod,only:mype_t,mype_p ,mype_q,mype_oz + use constants, only: half,zero + use gsi_rfv3io_mod, only: gsi_fv3ncdf_read + use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv + + implicit none + ! + ! Declare passed variables + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type (type_fv3regfilenameg) , intent (in) :: fv3_filenameginput + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig),intent(out)::g_u,g_v,g_tv,g_rh,g_oz + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2),intent(out):: g_ps + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ::g_tsen, g_q,g_prsl + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig+1) ::g_prsi + ! + ! Declare local parameters + real(r_kind),parameter:: r0_01 = 0.01_r_kind + real(r_kind),parameter:: r10 = 10.0_r_kind + real(r_kind),parameter:: r100 = 100.0_r_kind + ! + ! Declare local variables + real(r_single),allocatable,dimension(:):: temp_1d + real(r_single),allocatable,dimension(:,:):: temp_2d,temp_2d2 + real(r_single),allocatable,dimension(:,:,:):: temp_3d + real(r_kind),allocatable,dimension(:):: p_top + real(r_kind),allocatable,dimension(:,:):: q_integral,gg_ps,q_integralc4h + real(r_kind),allocatable,dimension(:,:,:):: tsn,qst,prsl,& + gg_u,gg_v,gg_tv,gg_rh + real(r_kind),allocatable,dimension(:):: wrk_fill_2d + integer(i_kind),allocatable,dimension(:):: dim,dim_id + + integer(i_kind):: nx,ny,nz,i,j,k,d_max,file_id,var_id,ndim,mype,kp + integer(i_kind):: Time_id,s_n_id,w_e_id,b_t_id,s_n_stag_id,w_e_stag_id,b_t_stag_id + integer(i_kind):: Time_len,s_n_len,w_e_len,b_t_len,s_n_stag_len,w_e_stag_len,b_t_stag_len + integer(i_kind) iderivative + + real(r_kind):: deltasigma + real(r_kind) psfc_this_dry,psfc_this + real(r_kind) work_prslk,work_prsl + + logical ice + + character(len=24),parameter :: myname_ = 'general_read_fv3_regional' + + character(len=:),allocatable :: grid_spec !='fv3_grid_spec' + character(len=:),allocatable :: ak_bk !='fv3_akbk' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + character(len=:),allocatable :: tracers !='fv3_tracer' + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: couplerres!='coupler.res' + integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) + integer(i_kind),allocatable:: ijnz(:),displsz_g(:) + + grid_spec=fv3_filenameginput%grid_spec + ak_bk=fv3_filenameginput%ak_bk + dynvars=fv3_filenameginput%dynvars + tracers=fv3_filenameginput%tracers + sfcdata=fv3_filenameginput%sfcdata + couplerres=fv3_filenameginput%couplerres + + + + allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) + allocate(displss(npe),displss2d(npe),displsz_g(npe) ) + +!cltthinktobe should be contained in variable like grd_ens + do i=1,npe + ijns(i)=grd_ens%ijn_s(i)*grd_ens%nsig + ijnz(i)=grd_ens%ijn(i)*grd_ens%nsig + ijns2d(i)=grd_ens%ijn_s(i)*n2d + enddo + displss(1)=0 + displsz_g(1)=0 + displss2d(1)=0 + do i=2,npe + displss(i)=displss(i-1)+ ijns(i-1) + displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) + displss2d(i)=displss2d(i-1)+ ijns2d(i-1) + enddo + +! do it=1,nfldsig + + + + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) + g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid + do i=grd_ens%nsig,1,-1 + g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) + enddo + g_ps(:,:)=g_prsi(:,:,1) + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) +! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) + +!! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_tv(i,j,k)=g_tsen(i,j,k)*(one+fv*g_q(i,j,k)) + enddo + enddo + enddo + if (.not.q_hyb_ens) then + ice=.true. + iderivative=0 + do k=1,grd_ens%nsig + kp=k+1 + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_prsl(i,j,k)=(g_prsi(i,j,k)+g_prsi(i,j,kp))*half + + end do + end do + end do + + call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_rh(i,j,k) = g_q(i,j,k)/g_rh(i,j,k) + end do + end do + end do + else + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_rh(i,j,k) = g_q(i,j,k) + end do + end do + end do + end if + + + +!clt not needed call gsi_fv3ncdf2d_read(it,ges_z) + + return + end subroutine general_read_fv3_regional + subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_bar) + !$$$ subprogram documentation block + ! . . . . + ! subprogram: ens_spread_dualres_regional + ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 + ! + ! abstract: + ! + ! + ! program history log: + ! 2010-08-11 parrish, initial documentation + ! 2011-04-05 parrish - add pseudo-bundle capability + ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle + ! + ! input argument list: + ! en_bar - ensemble mean + ! mype - current processor number + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + ! + use kinds, only: r_single,r_kind,i_kind + use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_anl,p_e2a,uv_hyb_ens, & + regional_ensemble_option + use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_create_info,general_sube2suba + use constants, only: zero,two,half,one + use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d + use gsi_bundlemod, only: gsi_bundlecreate + use gsi_bundlemod, only: gsi_grid + use gsi_bundlemod, only: gsi_bundle + use gsi_bundlemod, only: gsi_bundlegetpointer + use gsi_bundlemod, only: gsi_bundledestroy + use gsi_bundlemod, only: gsi_gridcreate + implicit none + + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type(gsi_bundle),OPTIONAL,intent(in):: en_bar + integer(i_kind),intent(in):: mype + type(gsi_bundle),allocatable, intent(in ) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + + type(gsi_bundle):: sube,suba + type(gsi_grid):: grid_ens,grid_anl + real(r_kind) sp_norm,sig_norm_sq_inv + type(sub2grid_info)::se,sa + integer(i_kind) k + + integer(i_kind) i,n,ic3 + logical regional + integer(i_kind) num_fields,inner_vars,istat,istatus + logical,allocatable::vector(:) + real(r_kind),pointer,dimension(:,:,:):: st,vp,tv,rh,oz,cw + real(r_kind),pointer,dimension(:,:):: ps + real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2,grd_anl%nsig),target::dum3 + real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2),target::dum2 + + associate( this => this ) ! eliminates warning for unused dummy argument needed for binding + end associate + + ! create simple regular grid + call gsi_gridcreate(grid_anl,grd_anl%lat2,grd_anl%lon2,grd_anl%nsig) + call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) + + ! create two internal bundles, one on analysis grid and one on ensemble grid + + call gsi_bundlecreate (suba,grid_anl,'ensemble work',istatus, & + names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' in ens_spread_dualres_regional: trouble creating bundle_anl bundle' + call stop2(999) + endif + call gsi_bundlecreate (sube,grid_ens,'ensemble work ens',istatus, & + names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' ens_spread_dualres_regional: trouble creating bundle_ens bundle' + call stop2(999) + endif + + sp_norm=(one/float(n_ens)) + + sube%values=zero + ! + + if(regional_ensemble_option == 1)then + print *,'global ensemble' + sig_norm_sq_inv=n_ens-one + + do n=1,n_ens + do i=1,nelen + sube%values(i)=sube%values(i) & + +en_perts(n,1)%valuesr4(i)*en_perts(n,1)%valuesr4(i) + end do + end do + + do i=1,nelen + sube%values(i) = sqrt(sp_norm*sig_norm_sq_inv*sube%values(i)) + end do + else + do n=1,n_ens + do i=1,nelen + sube%values(i)=sube%values(i) & + +(en_perts(n,1)%valuesr4(i)-en_bar%values(i))*(en_perts(n,1)%valuesr4(i)-en_bar%values(i)) + end do + end do + + do i=1,nelen + sube%values(i) = sqrt(sp_norm*sube%values(i)) + end do + end if + + if(grd_ens%latlon1n == grd_anl%latlon1n) then + do i=1,nelen + suba%values(i)=sube%values(i) + end do + else + inner_vars=1 + num_fields=max(0,nc3d)*grd_ens%nsig+max(0,nc2d) + allocate(vector(num_fields)) + vector=.false. + do ic3=1,nc3d + if(trim(cvars3d(ic3))=='sf'.or.trim(cvars3d(ic3))=='vp') then + do k=1,grd_ens%nsig + vector((ic3-1)*grd_ens%nsig+k)=uv_hyb_ens + end do + end if + end do + call general_sub2grid_create_info(se,inner_vars,grd_ens%nlat,grd_ens%nlon,grd_ens%nsig,num_fields, & + regional,vector) + call general_sub2grid_create_info(sa,inner_vars,grd_anl%nlat,grd_anl%nlon,grd_anl%nsig,num_fields, & + regional,vector) + deallocate(vector) + call general_sube2suba(se,sa,p_e2a,sube%values,suba%values,regional) + end if + + dum2=zero + dum3=zero + call gsi_bundlegetpointer(suba,'sf',st,istat) + if(istat/=0) then + write(6,*)' no sf pointer in ens_spread_dualres, point st at dum3 array' + st => dum3 + end if + call gsi_bundlegetpointer(suba,'vp',vp,istat) + if(istat/=0) then + write(6,*)' no vp pointer in ens_spread_dualres, point vp at dum3 array' + vp => dum3 + end if + call gsi_bundlegetpointer(suba,'t',tv,istat) + if(istat/=0) then + write(6,*)' no t pointer in ens_spread_dualres, point tv at dum3 array' + tv => dum3 + end if + call gsi_bundlegetpointer(suba,'q',rh,istat) + if(istat/=0) then + write(6,*)' no q pointer in ens_spread_dualres, point rh at dum3 array' + rh => dum3 + end if + call gsi_bundlegetpointer(suba,'oz',oz,istat) + if(istat/=0) then + write(6,*)' no oz pointer in ens_spread_dualres, point oz at dum3 array' + oz => dum3 + end if + call gsi_bundlegetpointer(suba,'cw',cw,istat) + if(istat/=0) then + write(6,*)' no cw pointer in ens_spread_dualres, point cw at dum3 array' + cw => dum3 + end if + call gsi_bundlegetpointer(suba,'ps',ps,istat) + if(istat/=0) then + write(6,*)' no ps pointer in ens_spread_dualres, point ps at dum2 array' + ps => dum2 + end if + + call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) + + return + end subroutine ens_spread_dualres_regional_fv3_regional + +end module get_fv3_regional_ensperts_mod From da3a431016fbfd8fa09f33da08c7f379502e722a Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Wed, 6 Mar 2019 16:58:32 +0000 Subject: [PATCH 005/155] to check in a few modifiations which were not checked in successfully. --- src/fv3_regional_interface.f90 | 4 +- src/gsi_rfv3io_mod.f90 | 190 +++++++++++++++++++++++------- src/hybrid_ensemble_isotropic.F90 | 6 + src/read_guess.F90 | 4 +- src/write_all.F90 | 3 +- 5 files changed, 159 insertions(+), 48 deletions(-) diff --git a/src/fv3_regional_interface.f90 b/src/fv3_regional_interface.f90 index 9b51fa6b29..fc214e5bcc 100644 --- a/src/fv3_regional_interface.f90 +++ b/src/fv3_regional_interface.f90 @@ -28,6 +28,7 @@ subroutine convert_fv3_regional use kinds, only: r_single,r_kind,i_kind use gsi_rfv3io_mod, only: gsi_rfv3io_get_grid_specs + use gsi_rfv3io_mod, only: bg_fv3regfilenameg use gsi_io, only: lendian_out use gridmod, only: nsig,regional_time,regional_fhr,nlon_regional,nlat_regional,nsig use mpimod, only: mype @@ -40,7 +41,8 @@ subroutine convert_fv3_regional !!!!!!!!!!! get grid specs !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! grid_spec='fv3_grid_spec' ! horizontal grid information ak_bk='fv3_akbk' ! vertical grid information - call gsi_rfv3io_get_grid_specs(grid_spec,ak_bk,ierr) + call bg_fv3regfilenameg%init(grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') + call gsi_rfv3io_get_grid_specs(bg_fv3regfilenameg,ierr) if(ierr/=0)then write(6,*)' problem in convert_fv3_regional - get_grid_specs Status = ',ierr call stop2 (555) diff --git a/src/gsi_rfv3io_mod.f90 b/src/gsi_rfv3io_mod.f90 index 477b517041..11f9d2f07d 100644 --- a/src/gsi_rfv3io_mod.f90 +++ b/src/gsi_rfv3io_mod.f90 @@ -36,20 +36,23 @@ module gsi_rfv3io_mod use kinds, only: r_kind,i_kind use gridmod, only: nlon_regional,nlat_regional implicit none + public type_fv3regfilenameg + public bg_fv3regfilenameg ! directory names (hardwired for now) - - character(len=*),parameter :: grid_spec='fv3_grid_spec' - character(len=*),parameter :: ak_bk='fv3_akbk' - character(len=*),parameter :: dynvars='fv3_dynvars' - character(len=*),parameter :: tracers='fv3_tracer' - character(len=*),parameter :: sfcdata='fv3_sfcdata' - integer(i_kind) gfile_grid_spec,gfile_ak_bk,gfile_dynvars - integer(i_kind) gfile_tracers,gfile_sfcdata - integer(i_kind) :: gfile - save gfile - - + type type_fv3regfilenameg + character(len=:),allocatable :: grid_spec !='fv3_grid_spec' + character(len=:),allocatable :: ak_bk !='fv3_akbk' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + character(len=:),allocatable :: tracers !='fv3_tracer' + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: couplerres!='coupler.res' + + contains + procedure , pass(this):: init=>fv3regfilename_init + end type type_fv3regfilenameg + + type(type_fv3regfilenameg):: bg_fv3regfilenameg integer(i_kind) nx,ny,nz real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) real(r_kind),allocatable:: ak(:),bk(:) @@ -60,6 +63,8 @@ module gsi_rfv3io_mod private ! set subroutines to public public :: gsi_rfv3io_get_grid_specs + public :: gsi_fv3ncdf_read + public :: gsi_fv3ncdf_readuv public :: read_fv3_files public :: read_fv3_netcdf_guess public :: wrfv3_netcdf @@ -72,10 +77,68 @@ module gsi_rfv3io_mod integer(i_kind) mype_u,mype_v,mype_t,mype_q,mype_p,mype_oz,mype_ql integer(i_kind) k_slmsk,k_tsea,k_vfrac,k_vtype,k_stype,k_zorl,k_smc,k_stc integer(i_kind) k_snwdph,k_f10m,mype_2d,n2d,k_orog,k_psfc + parameter( & + k_f10m =1, & !fact10 + k_stype=2, & !soil_type + k_vfrac=3, & !veg_frac + k_vtype=4, & !veg_type + k_zorl =5, & !sfc_rough + k_tsea =6, & !sfct ? + k_snwdph=7, & !sno ? + k_stc =8, & !soil_temp + k_smc =9, & !soil_moi + k_slmsk=10, & !isli + k_orog =11, & !terrain + n2d=11 ) contains - -subroutine gsi_rfv3io_get_grid_specs(grid_spec,ak_bk,ierr) + subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & + tracers_input,sfcdata_input,couplerres_input) + class(type_fv3regfilenameg):: this + character(*),optional :: grid_spec_input,ak_bk_input,dynvars_input, & + tracers_input,sfcdata_input,couplerres_input + if(present(grid_spec_input))then + + this%grid_spec=grid_spec_input + else + this%grid_spec='fv3_grid_spec' + endif + if(present(ak_bk_input))then + + this%ak_bk=ak_bk_input + else + this%ak_bk='fv3_ak_bk' + endif + if(present(dynvars_input))then + + this%dynvars=dynvars_input + else + this%dynvars='fv3_dynvars' + endif + if(present(tracers_input))then + + this%tracers=tracers_input + else + this%tracers='fv3_tracers' + endif + if(present(sfcdata_input))then + + this%sfcdata=sfcdata_input + else + this%sfcdata='fv3_sfcdata' + endif + + if(present(couplerres_input))then + + this%couplerres=couplerres_input + else + this%couplerres='fv3_coupler.res' + endif + + end subroutine fv3regfilename_init + + +subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_rfv3io_get_grid_specs @@ -119,8 +182,15 @@ subroutine gsi_rfv3io_get_grid_specs(grid_spec,ak_bk,ierr) implicit none - character(*), intent(in ) :: grid_spec - character(*), intent(in ) :: ak_bk + integer(i_kind) gfile_grid_spec,gfile_ak_bk,gfile_dynvars + integer(i_kind) gfile_tracers,gfile_sfcdata +! integer(i_kind) :: gfile +! save gfile + + type (type_fv3regfilenameg) :: fv3filenamegin + character(:),allocatable :: grid_spec + character(:),allocatable :: ak_bk + character(len=:),allocatable :: coupler_res_filenam integer(i_kind),intent( out) :: ierr integer(i_kind) i,k,ndimensions,iret,nvariables,nattributes,unlimiteddimid integer(i_kind) len,gfile_loc @@ -128,8 +198,13 @@ subroutine gsi_rfv3io_get_grid_specs(grid_spec,ak_bk,ierr) integer(i_kind) myear,mmonth,mday,mhour,mminute,msecond real(r_kind),allocatable:: abk_fv3(:) + coupler_res_filenam=fv3filenamegin%couplerres + grid_spec=fv3filenamegin%grid_spec + ak_bk=fv3filenamegin%ak_bk + !!!!! set regional_time - open(24,file='coupler.res',form='formatted') +!cltorg open(24,file='coupler.res',form='formatted') + open(24,file=trim(coupler_res_filenam),form='formatted') read(24,*) read(24,*) read(24,*)myear,mmonth,mday,mhour,mminute,msecond @@ -487,7 +562,7 @@ subroutine read_fv3_files(mype) return end subroutine read_fv3_files -subroutine read_fv3_netcdf_guess +subroutine read_fv3_netcdf_guess(fv3filenamegin) !$$$ subprogram documentation block ! . . . . ! subprogram: read_fv3_netcdf_guess read fv3 interface file @@ -512,6 +587,7 @@ subroutine read_fv3_netcdf_guess implicit none + type (type_fv3regfilenameg) :: fv3filenamegin character(len=24),parameter :: myname = 'read_fv3_netcdf_guess' integer(i_kind) k,i,j integer(i_kind) it,ier,istatus @@ -524,19 +600,28 @@ subroutine read_fv3_netcdf_guess real(r_kind),dimension(:,:,:),pointer::ges_oz=>NULL() real(r_kind),dimension(:,:,:),pointer::ges_tv=>NULL() + character(len=:),allocatable :: grid_spec !='fv3_grid_spec' + character(len=:),allocatable :: ak_bk !='fv3_akbk' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + character(len=:),allocatable :: tracers !='fv3_tracer' + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: couplerres!='coupler.res' + ! setup list for 2D surface fields - k_f10m =1 !fact10 - k_stype=2 !soil_type - k_vfrac=3 !veg_frac - k_vtype=4 !veg_type - k_zorl =5 !sfc_rough - k_tsea =6 !sfct ? - k_snwdph=7 !sno ? - k_stc =8 !soil_temp - k_smc =9 !soil_moi - k_slmsk=10 !isli - k_orog =11 !terrain - n2d=11 +! k_f10m =1 !fact10 +! k_stype=2 !soil_type +! k_vfrac=3 !veg_frac +! k_vtype=4 !veg_type +! k_zorl =5 !sfc_rough +! k_tsea =6 !sfct ? +! k_snwdph=7 !sno ? +! k_stc =8 !soil_temp +! k_smc =9 !soil_moi +! k_slmsk=10 !isli +! k_orog =11 !terrain +! n2d=11 + dynvars= fv3filenamegin%dynvars + tracers= fv3filenamegin%tracers if(npe< 8) then call die('read_fv3_netcdf_guess','not enough PEs to read in fv3 fields' ) @@ -582,7 +667,7 @@ subroutine read_fv3_netcdf_guess call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'oz' ,ges_oz ,istatus );ier=ier+istatus if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) - call gsi_fv3ncdf_readuv(ges_u,ges_v) + call gsi_fv3ncdf_readuv(dynvars,ges_u,ges_v) call gsi_fv3ncdf_read(dynvars,'T','t',ges_tsen(1,1,1,it),mype_t) call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi,mype_p) ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) @@ -603,11 +688,11 @@ subroutine read_fv3_netcdf_guess enddo enddo - call gsi_fv3ncdf2d_read(it,ges_z) + call gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) end subroutine read_fv3_netcdf_guess -subroutine gsi_fv3ncdf2d_read(it,ges_z) +subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf2d_read @@ -643,6 +728,7 @@ subroutine gsi_fv3ncdf2d_read(it,ges_z) integer(i_kind),intent(in) :: it real(r_kind),intent(in),dimension(:,:),pointer::ges_z + type (type_fv3regfilenameg),intent(in) :: fv3filenamegin character(len=128) :: name integer(i_kind),allocatable,dimension(:):: dim_id,dim real(r_kind),allocatable,dimension(:):: work @@ -653,6 +739,11 @@ subroutine gsi_fv3ncdf2d_read(it,ges_z) integer(i_kind) iret,gfile_loc,i,k,len,ndim integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid integer(i_kind) kk,n,ns,j,ii,jj,mm1 + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + + sfcdata= fv3filenamegin%sfcdata + dynvars= fv3filenamegin%dynvars mm1=mype+1 allocate(a(nya,nxa)) @@ -791,7 +882,7 @@ subroutine gsi_fv3ncdf2d_read(it,ges_z) return end subroutine gsi_fv3ncdf2d_read -subroutine gsi_fv3ncdf_read(filename,varname,varname2,work_sub,mype_io) +subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_read @@ -827,8 +918,7 @@ subroutine gsi_fv3ncdf_read(filename,varname,varname2,work_sub,mype_io) use general_commvars_mod, only: ltosi_s,ltosj_s implicit none - - character(*) ,intent(in ) :: varname,varname2,filename + character(*) ,intent(in ) :: varname,varname2,filenamein real(r_kind) ,intent(out ) :: work_sub(lat2,lon2,nsig) integer(i_kind) ,intent(in ) :: mype_io character(len=128) :: name @@ -847,9 +937,9 @@ subroutine gsi_fv3ncdf_read(filename,varname,varname2,work_sub,mype_io) allocate (work(itotsub*nsig)) if(mype==mype_io ) then - iret=nf90_open(trim(filename),nf90_nowrite,gfile_loc) + iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(filename),gfile_loc,', Status = ',iret + write(6,*)' problem opening ',trim(filenamein),gfile_loc,', Status = ',iret return endif @@ -906,7 +996,7 @@ subroutine gsi_fv3ncdf_read(filename,varname,varname2,work_sub,mype_io) return end subroutine gsi_fv3ncdf_read -subroutine gsi_fv3ncdf_readuv(ges_u,ges_v) +subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_readuv @@ -937,7 +1027,7 @@ subroutine gsi_fv3ncdf_readuv(ges_u,ges_v) use general_commvars_mod, only: ltosi_s,ltosj_s implicit none - + character(*) ,intent(in ):: dynvarsfile real(r_kind) ,intent(out ) :: ges_u(lat2,lon2,nsig) real(r_kind) ,intent(out ) :: ges_v(lat2,lon2,nsig) character(len=128) :: name @@ -955,9 +1045,9 @@ subroutine gsi_fv3ncdf_readuv(ges_u,ges_v) allocate (work(itotsub*nsig)) mm1=mype+1 if(mype==mype_u .or. mype==mype_v) then - iret=nf90_open(dynvars,nf90_nowrite,gfile_loc) + iret=nf90_open(dynvarsfile,nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(dynvars),', Status = ',iret + write(6,*)' problem opening ',trim(dynvarsfile),', Status = ',iret return endif @@ -1031,7 +1121,7 @@ subroutine gsi_fv3ncdf_readuv(ges_u,ges_v) deallocate(work) end subroutine gsi_fv3ncdf_readuv -subroutine wrfv3_netcdf +subroutine wrfv3_netcdf(fv3filenamegin) !$$$ subprogram documentation block ! . . . . ! subprogram: wrfv3_netcdf write out FV3 analysis increments @@ -1057,15 +1147,24 @@ subroutine wrfv3_netcdf use gsi_bundlemod, only: gsi_bundlegetpointer use mpeu_util, only: die implicit none + type (type_fv3regfilenameg) :: fv3filenamegin ! Declare local constants logical add_saved + character(len=:),allocatable :: grid_spec !='fv3_grid_spec' + character(len=:),allocatable :: ak_bk !='fv3_akbk' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + character(len=:),allocatable :: tracers !='fv3_tracer' + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: couplerres!='coupler.res' ! variables for cloud info integer(i_kind) ier,istatus,it real(r_kind),pointer,dimension(:,: ):: ges_ps =>NULL() real(r_kind),pointer,dimension(:,:,:):: ges_u =>NULL() real(r_kind),pointer,dimension(:,:,:):: ges_v =>NULL() real(r_kind),pointer,dimension(:,:,:):: ges_q =>NULL() + dynvars=fv3filenamegin%dynvars + tracers=fv3filenamegin%tracers it=ntguessig ier=0 @@ -1080,12 +1179,12 @@ subroutine wrfv3_netcdf ! write out call gsi_fv3ncdf_write(dynvars,'T',ges_tsen(1,1,1,it),mype_t,add_saved) call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) - call gsi_fv3ncdf_writeuv(ges_u,ges_v,mype_v,add_saved) + call gsi_fv3ncdf_writeuv(dynvars,ges_u,ges_v,mype_v,add_saved) call gsi_fv3ncdf_writeps(dynvars,'delp',ges_ps,mype_p,add_saved) end subroutine wrfv3_netcdf -subroutine gsi_fv3ncdf_writeuv(varu,varv,mype_io,add_saved) +subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_nemsio_writeuv @@ -1122,6 +1221,7 @@ subroutine gsi_fv3ncdf_writeuv(varu,varv,mype_io,add_saved) use netcdf, only: nf90_put_var,nf90_get_var implicit none + character(len=*),intent(in) :: dynvars !='fv3_dynvars' real(r_kind) ,intent(in ) :: varu(lat2,lon2,nsig) real(r_kind) ,intent(in ) :: varv(lat2,lon2,nsig) diff --git a/src/hybrid_ensemble_isotropic.F90 b/src/hybrid_ensemble_isotropic.F90 index ccfdc789ee..6abc228288 100644 --- a/src/hybrid_ensemble_isotropic.F90 +++ b/src/hybrid_ensemble_isotropic.F90 @@ -1172,6 +1172,7 @@ subroutine load_ensemble use mpimod, only: mype use get_pseudo_ensperts_mod, only: get_pseudo_ensperts_class use get_wrf_mass_ensperts_mod, only: get_wrf_mass_ensperts_class + use get_fv3_regional_ensperts_mod, only: get_fv3_regional_ensperts_class use get_wrf_nmm_ensperts_mod, only: get_wrf_nmm_ensperts_class use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens @@ -1180,6 +1181,7 @@ subroutine load_ensemble type(get_pseudo_ensperts_class) :: pseudo_enspert type(get_wrf_mass_ensperts_class) :: wrf_mass_enspert type(get_wrf_nmm_ensperts_class) :: wrf_nmm_enspert + type(get_fv3_regional_ensperts_class) :: fv3_regional_enspert type(gsi_bundle),allocatable:: en_bar(:) type(gsi_bundle):: bundle_anl,bundle_ens type(gsi_grid) :: grid_anl,grid_ens @@ -1354,6 +1356,10 @@ subroutine load_ensemble ! regional_ensemble_option = 4: ensembles are NEMS NMMB format. call get_nmmb_ensperts + case(5) +! regional_ensemble_option = 5: ensembles are fv3 regional. + call fv3_regional_enspert%get_fv3_regional_ensperts(en_perts,nelen,ps_bar) + end select diff --git a/src/read_guess.F90 b/src/read_guess.F90 index 86e86bcc88..cebbec0724 100644 --- a/src/read_guess.F90 +++ b/src/read_guess.F90 @@ -108,6 +108,7 @@ subroutine read_guess(iyear,month,idd,mype) use read_wrf_mass_guess_mod, only: read_wrf_mass_guess_class use read_wrf_nmm_guess_mod, only: read_wrf_nmm_guess_class use gsi_rfv3io_mod, only: read_fv3_netcdf_guess + use gsi_rfv3io_mod, only: bg_fv3regfilenameg implicit none @@ -158,7 +159,8 @@ subroutine read_guess(iyear,month,idd,mype) else if (nems_nmmb_regional) then call nmm_binary_guess%read_nems_nmmb_guess(mype) else if (fv3_regional ) then - call read_fv3_netcdf_guess + call bg_fv3regfilenameg%init + call read_fv3_netcdf_guess(bg_fv3regfilenameg) else if (cmaq_regional) then call read_cmaq_guess(mype) end if diff --git a/src/write_all.F90 b/src/write_all.F90 index 93e90ebc69..0e7569232d 100644 --- a/src/write_all.F90 +++ b/src/write_all.F90 @@ -32,6 +32,7 @@ subroutine write_all(increment) ! use regional_io, only: write_regional_analysis use regional_io_mod, only: regional_io_class use gsi_rfv3io_mod, only: wrfv3_netcdf + use gsi_rfv3io_mod, only: bg_fv3regfilenameg use ncepgfs_io, only: write_gfs @@ -117,7 +118,7 @@ subroutine write_all(increment) ! Regional output if (regional) then if (fv3_regional) then - call wrfv3_netcdf + call wrfv3_netcdf(bg_fv3regfilenameg) else call io%write_regional_analysis(mype) endif From 441c463dd1e5cf41e644fe99bad048c2213b9bf9 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 7 Mar 2019 15:41:21 +0000 Subject: [PATCH 006/155] add a few modications dealing with the reversed order of data in fv3 reg. --- src/enkf/1 | 56 ------------------------- src/enkf/gridinfo_fv3reg.f90 | 13 ++---- src/enkf/read_fv3regional_restarts.f90 | 6 +++ src/enkf/write_fv3regional_restarts.f90 | 6 +++ 4 files changed, 15 insertions(+), 66 deletions(-) delete mode 100644 src/enkf/1 diff --git a/src/enkf/1 b/src/enkf/1 deleted file mode 100644 index cc20fa0646..0000000000 --- a/src/enkf/1 +++ /dev/null @@ -1,56 +0,0 @@ -dd.f90:integer(i_kind),public :: nlevs_pres, idvc -dd.f90:nlevs_pres = nlevsp1 -dd.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -dd.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -dd.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -dd.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -dd.f90:do k=1,nlevs_pres -enkf.f90:use gridinfo, only: nlevs_pres -enkf.f90:real(r_single),dimension(nlevs_pres):: taperv -enkf.f90: do nn=1,nlevs_pres -enkf_obs_sensitivity.f90:use gridinfo, only: latsgrd,lonsgrd,nlevs_pres,npts -gridinfo_fv3.f90:integer(i_kind),public :: nlevs_pres, idvc -gridinfo_fv3.f90:nlevs_pres = nlevsp1 -gridinfo_fv3.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_fv3.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_fv3.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_fv3.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -gridinfo_fv3.f90:do k=1,nlevs_pres -gridinfo_fv3reg.f90:integer(i_kind) nlevs_pres,nlevsp1n,nlevsp2 -gridinfo_fv3reg.f90:nlevs_pres = nlevsp1 -gridinfo_fv3reg.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_fv3reg.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_fv3reg.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_fv3reg.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -gridinfo_fv3reg.f90:do k=1,nlevs_pres -gridinfo_gfs.f90:integer(i_kind),public :: nlevs_pres, idvc -gridinfo_gfs.f90:nlevs_pres=nlevs+1 -gridinfo_gfs.f90: allocate(nems_vcoord(nlevs_pres,3,2)) -gridinfo_gfs.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_gfs.f90: call regtoreduced(spressmn,logp(:,nlevs_pres)) -gridinfo_gfs.f90: logp(:,nlevs_pres) = -log(logp(:,nlevs_pres)) -gridinfo_gfs.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_gfs.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_gfs.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -gridinfo_gfs.f90:do k=1,nlevs_pres -gridinfo_nmmb.f90:integer(i_kind),public :: nlevs_pres -gridinfo_nmmb.f90:nlevs_pres=nlevs+1 -gridinfo_nmmb.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_nmmb.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_nmmb.f90: allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers -gridinfo_nmmb.f90:!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -gridinfo_nmmb.f90:do k=1,nlevs_pres -gridinfo_wrf.f90: integer(i_kind), public :: nlevs_pres -gridinfo_wrf.f90: nlevs_pres=dimensions%zdim+1 -gridinfo_wrf.f90: if(.not. allocated(logp)) allocate(logp(npts,nlevs_pres)) -gridinfo_wrf.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_wrf.f90: call MPI_Bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -gridinfo_wrf.f90: nlevs_pres=dimensions%zdim+1 -gridinfo_wrf.f90: if(.not. allocated(logp)) allocate(logp(npts,nlevs_pres)) -gridinfo_wrf.f90: logp(:,nlevs_pres) = -log(spressmn(:)) -gridinfo_wrf.f90: call MPI_Bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -letkf.F90:use gridinfo, only: nlevs_pres,lonsgrd,latsgrd,logp,npts,gridloc -letkf.F90: nnmax = nlevs_pres -loadbal.f90:use gridinfo, only: gridloc, logp, latsgrd, nlevs_pres, npts -loadbal.f90:allocate(lnp_chunk(numptsperproc(nproc+1),nlevs_pres)) -loadbal.f90: do nn=1,nlevs_pres diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 4ff1ef7965..443fb93de9 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -93,7 +93,6 @@ subroutine getgridinfo(fileprefix, reducedgrid) integer (i_kind):: nn_tile0 integer(i_kind) :: nlevsp1n,nlevsp2 real(r_single), allocatable, dimension(:,:) :: lat_tile,lon_tile,ps -real(r_single), allocatable, dimension(:) :: ak_fv3,bk_fv3 real(r_single), allocatable, dimension(:,:,:) :: delp,g_prsi real(r_single) ptop character(len=4) char_res @@ -150,14 +149,8 @@ subroutine getgridinfo(fileprefix, reducedgrid) allocate(ak(nlevsp1),bk(nlevsp1)) - allocate(ak_fv3(nlevsp1),bk_fv3(nlevsp1)) - call read_fv3_restart_data1d('ak',filename,file_id,ak_fv3) - call read_fv3_restart_data1d('bk',filename,file_id,bk_fv3) - nlevsp2=nlevsp1+1 - do i=1,nlevsp1 - ak(i)=ak_fv3(nlevsp2-i) - bk(i)=bk_fv3(nlevsp2-i) - enddo + call read_fv3_restart_data1d('ak',filename,file_id,ak) + call read_fv3_restart_data1d('bk',filename,file_id,bk) !!!!! change unit of ak,also reverse the @@ -266,7 +259,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) end do logp(:,nlevs_pres) = -log(spressmn(:)) deallocate(spressmn,presslmn,pressimn) - deallocate(g_prsi,delp,ak_fv3,bk_fv3) + deallocate(g_prsi,delp) deallocate(eta1_ll,eta2_ll,ak,bk) deallocate(lat_tile,lon_tile,ps) diff --git a/src/enkf/read_fv3regional_restarts.f90 b/src/enkf/read_fv3regional_restarts.f90 index 31d7b82474..0d3cd5a74e 100644 --- a/src/enkf/read_fv3regional_restarts.f90 +++ b/src/enkf/read_fv3regional_restarts.f90 @@ -25,6 +25,7 @@ subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) end subroutine read_fv3_restart_data1d subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) @@ -35,6 +36,7 @@ subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) end subroutine read_fv3_restart_data2d subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) @@ -45,6 +47,8 @@ subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1) end subroutine read_fv3_restart_data3d subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) @@ -55,6 +59,8 @@ subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1,ubound(data_arr,4):lbound(data_arr,4):-1) end subroutine read_fv3_restart_data4d end module read_fv3regional_restarts diff --git a/src/enkf/write_fv3regional_restarts.f90 b/src/enkf/write_fv3regional_restarts.f90 index 642176ac2b..9e83469a47 100644 --- a/src/enkf/write_fv3regional_restarts.f90 +++ b/src/enkf/write_fv3regional_restarts.f90 @@ -24,6 +24,7 @@ subroutine write_fv3_restart_data1d(varname,filename,file_id,data_arr) character(len=*), intent(in) :: filename integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) include "write_fv3_restart_data.f90" end subroutine write_fv3_restart_data1d @@ -34,6 +35,7 @@ subroutine write_fv3_restart_data2d(varname,filename,file_id,data_arr) character(len=*), intent(in) :: filename integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) include "write_fv3_restart_data.f90" end subroutine write_fv3_restart_data2d @@ -44,6 +46,8 @@ subroutine write_fv3_restart_data3d(varname,filename,file_id,data_arr) character(len=*), intent(in) :: filename integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1) include "write_fv3_restart_data.f90" end subroutine write_fv3_restart_data3d @@ -54,6 +58,8 @@ subroutine write_fv3_restart_data4d(varname,filename,file_id,data_arr) character(len=*), intent(in) :: filename integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1,ubound(data_arr,4):lbound(data_arr,4):-1) include "write_fv3_restart_data.f90" end subroutine write_fv3_restart_data4d From 09e5d3508aa3ae1b9a945b29026c29832a281180 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Thu, 7 Mar 2019 20:17:50 +0000 Subject: [PATCH 007/155] just adding a debug line before merging --- src/gsi_rfv3io_mod.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gsi_rfv3io_mod.f90 b/src/gsi_rfv3io_mod.f90 index 11f9d2f07d..c53094b1ab 100644 --- a/src/gsi_rfv3io_mod.f90 +++ b/src/gsi_rfv3io_mod.f90 @@ -1437,6 +1437,7 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) kp=k+1 work_b(:,:,k)=(work_bi(:,:,kp)-work_bi(:,:,k))*1000._r_kind enddo + write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_b(12,:,nsig) print *,'write out ',trim(varname),' to ',trim(filename) From cb82ade7957995c9a3f368993d8c712e99b3d328 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Thu, 7 Mar 2019 20:18:47 +0000 Subject: [PATCH 008/155] commit in a minor modification --- src/cplr_get_fv3_regional_ensperts.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cplr_get_fv3_regional_ensperts.f90 b/src/cplr_get_fv3_regional_ensperts.f90 index 7d18c3b453..112ea9457f 100644 --- a/src/cplr_get_fv3_regional_ensperts.f90 +++ b/src/cplr_get_fv3_regional_ensperts.f90 @@ -53,7 +53,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) class(get_fv3_regional_ensperts_class), intent(inout) :: this type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) integer(i_kind), intent(in ):: nelen - real(r_single),dimension(:,:,:),allocatable:: ps_bar + real(r_single),dimension(:,:,:),allocatable,intent(inout):: ps_bar real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig):: u,v,tv,cwmr,oz,rh real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2):: ps From 0adc7835133309c6897824547c2b50bc8217037f Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Thu, 21 Mar 2019 16:33:26 +0000 Subject: [PATCH 009/155] some cleaning up for this basic working version --- src/gsi/class_get_fv3_regional_ensperts.f90 | 32 + src/gsi/cplr_get_fv3_regional_ensperts.f90 | 669 ++++++++++++++++++++ src/gsi/fv3_regional_interface.f90 | 4 + src/gsi/get_gefs_for_regional.f90 | 26 +- src/gsi/gsi_rfv3io_mod.f90 | 20 +- src/gsi/guess_grids.F90 | 2 + src/gsi/hybrid_ensemble_isotropic.F90 | 4 +- src/gsi/mpeu_util.F90 | 1 + src/gsi/ncepnems_io.f90 | 4 +- src/gsi/observer.F90 | 2 + src/gsi/read_guess.F90 | 1 + 11 files changed, 750 insertions(+), 15 deletions(-) create mode 100644 src/gsi/class_get_fv3_regional_ensperts.f90 create mode 100644 src/gsi/cplr_get_fv3_regional_ensperts.f90 diff --git a/src/gsi/class_get_fv3_regional_ensperts.f90 b/src/gsi/class_get_fv3_regional_ensperts.f90 new file mode 100644 index 0000000000..e3e4b5ed46 --- /dev/null +++ b/src/gsi/class_get_fv3_regional_ensperts.f90 @@ -0,0 +1,32 @@ +module abstract_get_fv3_regional_ensperts_mod +!clt first copied from class_get_wrf_nmm_ensperts.f90 + type, abstract :: abstract_get_fv3_regional_ensperts_class + contains + procedure(get_fv3_regional_ensperts), deferred, pass(this) :: get_fv3_regional_ensperts +!cltthink procedure(convert_binary_nmm_ens), deferred, pass(this) :: convert_binary_nmm_ens + end type abstract_get_fv3_regional_ensperts_class + + abstract interface + subroutine get_fv3_regional_ensperts(this,en_perts,nelen,ps_bar) + use gsi_bundlemod, only: gsi_bundle + use kinds, only: r_kind,i_kind,r_single + + import abstract_get_fv3_regional_ensperts_class + implicit none + class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this + type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + real(r_single),dimension(:,:,:),allocatable, intent(inout):: ps_bar + + end subroutine get_fv3_regional_ensperts + end interface + abstract interface + + subroutine convert_binary_fv3_regional_ens(this) + import abstract_get_fv3_regional_ensperts_class + implicit none + class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this + end subroutine convert_binary_fv3_regional_ens + end interface + +end module abstract_get_fv3_regional_ensperts_mod diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 new file mode 100644 index 0000000000..fb0b8129b9 --- /dev/null +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -0,0 +1,669 @@ +module get_fv3_regional_ensperts_mod +!clt started from cplr_get_fv3_regional_ensperts.f90 +use abstract_get_fv3_regional_ensperts_mod + use kinds, only : i_kind + type, extends(abstract_get_fv3_regional_ensperts_class) :: get_fv3_regional_ensperts_class + contains + procedure, pass(this) :: get_fv3_regional_ensperts => get_fv3_regional_ensperts_run + procedure, pass(this) :: ens_spread_dualres_regional => ens_spread_dualres_regional_fv3_regional + procedure, pass(this) :: general_read_fv3_regional + end type get_fv3_regional_ensperts_class +contains + subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) + !$$$ subprogram documentation block + ! . . . . + ! subprogram: get_fv3_regional_ensperts read arw model ensemble members + ! prgmmr: Ting org: ncar/mmm date: 2018-12-13 + ! + ! abstract: read ensemble members from the fv3 regional (fv3_SAR) + ! model,following Wanshu's programs to read those background files + ! + ! + ! program history log: + ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle + ! + ! input argument list: + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + + use kinds, only: r_kind,i_kind,r_single + use constants, only: zero,one,half,zero_single,rd_over_cp,one_tenth + use mpimod, only: mpi_comm_world,ierror,mype + use hybrid_ensemble_parameters, only: n_ens,grd_ens + use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path + use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d + use gsi_bundlemod, only: gsi_bundlecreate + use gsi_bundlemod, only: gsi_grid + use gsi_bundlemod, only: gsi_bundle + use gsi_bundlemod, only: gsi_bundlegetpointer + use gsi_bundlemod, only: gsi_bundledestroy + use gsi_bundlemod, only: gsi_gridcreate + use guess_grids, only: ntguessig,ifilesig + use gsi_4dvar, only: nhr_assimilation + use gsi_4dvar, only: ens_fhrlevs + use gsi_rfv3io_mod, only: type_fv3regfilenameg + + implicit none + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + real(r_single),dimension(:,:,:),allocatable,intent(inout):: ps_bar + + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig):: u,v,tv,cwmr,oz,rh + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2):: ps + + real(r_single),pointer,dimension(:,:,:):: w3 + real(r_single),pointer,dimension(:,:):: w2 + real(r_kind),pointer,dimension(:,:,:):: x3 + real(r_kind),pointer,dimension(:,:):: x2 + type(gsi_bundle),allocatable,dimension(:):: en_bar + type(gsi_grid):: grid_ens + real(r_kind):: bar_norm,sig_norm,kapr,kap1 + + integer(i_kind):: i,j,k,n,mm1,istatus + integer(i_kind):: ic2,ic3 + integer(i_kind):: m + + character(255) filelists(ntlevs_ens) + character(255) ensfilenam_str + type(type_fv3regfilenameg)::fv3_filename + + call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) + ! Allocate bundle to hold mean of ensemble members + allocate(en_bar(ntlevs_ens)) + do m=1,ntlevs_ens + call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' + call stop2(9991) + endif + enddo ! for m + + + do m=1,ntlevs_ens + + + + ! + ! INITIALIZE ENSEMBLE MEAN ACCUMULATORS + en_bar(m)%values=zero + + do n=1,n_ens + en_perts(n,m)%valuesr4 = zero + enddo + + mm1=mype+1 + kap1=rd_over_cp+one + kapr=one/rd_over_cp + ! + ! LOOP OVER ENSEMBLE MEMBERS + do n=1,n_ens + write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n + write(6,*)'thinkdeb22 ens_fhrlevs(mO is ',m, ens_fhrlevs(m) + write(6,*)'ensfilenam_str is ',trim(ensfilenam_str) +22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) + ! DEFINE INPUT FILE NAME + fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe + fv3_filename%ak_bk=trim(ensfilenam_str)//'-fv3_akbk' + fv3_filename%dynvars=trim(ensfilenam_str)//'-fv3_dynvars' + fv3_filename%tracers=trim(ensfilenam_str)//"-fv3_tracer" + fv3_filename%sfcdata=trim(ensfilenam_str)//"-fv3_sfcdata" + fv3_filename%couplerres=trim(ensfilenam_str)//"-coupler.res" + ! + ! READ ENEMBLE MEMBERS DATA + if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) + call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) + + ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR + do ic3=1,nc3d + + call gsi_bundlegetpointer(en_perts(n,m),trim(cvars3d(ic3)),w3,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for ensemble member ',n + call stop2(9992) + end if + call gsi_bundlegetpointer(en_bar(m),trim(cvars3d(ic3)),x3,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for en_bar' + call stop2(9993) + end if + + select case (trim(cvars3d(ic3))) + + case('sf','SF') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = u(j,i,k) + x3(j,i,k)=x3(j,i,k)+u(j,i,k) + end do + end do + end do + + case('vp','VP') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = v(j,i,k) + x3(j,i,k)=x3(j,i,k)+v(j,i,k) + end do + end do + end do + + case('t','T') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = tv(j,i,k) + x3(j,i,k)=x3(j,i,k)+tv(j,i,k) + end do + end do + end do + + case('q','Q') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = rh(j,i,k) + x3(j,i,k)=x3(j,i,k)+rh(j,i,k) + end do + end do + end do + + case('oz','OZ') + + do k=1,grd_ens%nsig + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w3(j,i,k) = oz(j,i,k) + x3(j,i,k)=x3(j,i,k)+oz(j,i,k) + end do + end do + end do + + + end select + end do + + do ic2=1,nc2d + + call gsi_bundlegetpointer(en_perts(n,m),trim(cvars2d(ic2)),w2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for ensemble member ',n + call stop2(9994) + end if + call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar' + call stop2(9995) + end if + + select case (trim(cvars2d(ic2))) + + case('ps','PS') + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w2(j,i) = ps(j,i) + x2(j,i)=x2(j,i)+ps(j,i) + end do + end do + + case('sst','SST') + ! IGNORE SST IN HYBRID for now + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + w2(j,i) = zero + x2(j,i)=zero + end do + end do + + end select + end do + enddo + ! + ! CALCULATE ENSEMBLE MEAN + bar_norm = one/float(n_ens) + en_bar(m)%values=en_bar(m)%values*bar_norm + + ! Copy pbar to module array. ps_bar may be needed for vertical localization + ! in terms of scale heights/normalized p/p + do ic2=1,nc2d + + if(trim(cvars2d(ic2)) == 'ps'.or.trim(cvars2d(ic2)) == 'PS') then + + call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) + if(istatus/=0) then + write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar to get ps_bar' + call stop2(9996) + end if + + do i=1,grd_ens%lon2 + do j=1,grd_ens%lat2 + ps_bar(j,i,1)=x2(j,i) + end do + end do + exit + end if + end do + + call mpi_barrier(mpi_comm_world,ierror) + ! + ! CALCULATE ENSEMBLE SPREAD + call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) + call mpi_barrier(mpi_comm_world,ierror) + ! + ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS + sig_norm=sqrt(one/max(one,n_ens-one)) + + do n=1,n_ens + do i=1,nelen + en_perts(n,m)%valuesr4(i)=(en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i))*sig_norm + end do + end do + + enddo ! it 4d loop + do m=1,ntlevs_ens + call gsi_bundledestroy(en_bar(m),istatus) + if(istatus/=0) then + write(6,*)' in get_fv3_regional_ensperts_netcdf: trouble destroying en_bar bundle' + call stop2(9997) + endif + end do + + deallocate(en_bar) + ! + + return + +30 write(6,*) 'get_fv3_regional_ensperts_netcdf: open filelist failed ' + call stop2(555) +20 write(6,*) 'get_fv3_regional_ensperts_netcdf: read WRF-ARW ens failed ',n + call stop2(555) + + end subroutine get_fv3_regional_ensperts_run + + subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) +!clt modified from rad_fv3_netcdf_guess + !$$$ subprogram documentation block + ! . . . . + ! subprogram: general_read_fv3_regional read arw model ensemble members + ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 + ! + ! abstract: read ensemble members from the arw model in "wrfout" netcdf format + ! for use with hybrid ensemble option. + ! + ! program history log: + ! 2010-08-11 parrish, initial documentation + ! 2010-09-10 parrish, modify so ensemble variables are read in the same way as in + ! subroutines convert_netcdf_mass and read_fv3_regional_binary_guess. + ! There were substantial differences due to different opinion about what + ! to use for surface pressure. This issue should be resolved by coordinating + ! with Ming Hu (ming.hu@noaa.gov). At the moment, these changes result in + ! agreement to single precision between this input method and the guess input + ! procedure when the same file is read by both methods. + ! 2012-03-12 whitaker: read data on root, distribute with scatterv. + ! remove call to general_reload. + ! simplify, fix memory leaks, reduce memory footprint. + ! use genqsat, remove genqsat2_regional. + ! replace bare 'stop' statements with call stop2(999). + ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS core + ! + ! input argument list: + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + + use netcdf, only: nf90_nowrite + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_inq_dimid,nf90_inquire_dimension + use netcdf, only: nf90_inq_varid,nf90_inquire_variable,nf90_get_var + use kinds, only: r_kind,r_single,i_kind + use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll + use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 + use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens + use mpimod, only: mpi_comm_world,ierror,mpi_rtype + use mpimod, only: npe + use netcdf_mod, only: nc_check + use gsi_rfv3io_mod,only: type_fv3regfilenameg + use gsi_rfv3io_mod,only:n2d + use gsi_rfv3io_mod,only:mype_t,mype_p ,mype_q,mype_oz + use constants, only: half,zero + use gsi_rfv3io_mod, only: gsi_fv3ncdf_read + use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv + + implicit none + ! + ! Declare passed variables + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type (type_fv3regfilenameg) , intent (in) :: fv3_filenameginput + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig),intent(out)::g_u,g_v,g_tv,g_rh,g_oz + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2),intent(out):: g_ps + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ::g_tsen, g_q,g_prsl + real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig+1) ::g_prsi + ! + ! Declare local parameters + real(r_kind),parameter:: r0_01 = 0.01_r_kind + real(r_kind),parameter:: r10 = 10.0_r_kind + real(r_kind),parameter:: r100 = 100.0_r_kind + ! + ! Declare local variables + real(r_single),allocatable,dimension(:):: temp_1d + real(r_single),allocatable,dimension(:,:):: temp_2d,temp_2d2 + real(r_single),allocatable,dimension(:,:,:):: temp_3d + real(r_kind),allocatable,dimension(:):: p_top + real(r_kind),allocatable,dimension(:,:):: q_integral,gg_ps,q_integralc4h + real(r_kind),allocatable,dimension(:,:,:):: tsn,qst,prsl,& + gg_u,gg_v,gg_tv,gg_rh + real(r_kind),allocatable,dimension(:):: wrk_fill_2d + integer(i_kind),allocatable,dimension(:):: dim,dim_id + + integer(i_kind):: nx,ny,nz,i,j,k,d_max,file_id,var_id,ndim,mype,kp + integer(i_kind):: Time_id,s_n_id,w_e_id,b_t_id,s_n_stag_id,w_e_stag_id,b_t_stag_id + integer(i_kind):: Time_len,s_n_len,w_e_len,b_t_len,s_n_stag_len,w_e_stag_len,b_t_stag_len + integer(i_kind) iderivative + + real(r_kind):: deltasigma + real(r_kind) psfc_this_dry,psfc_this + real(r_kind) work_prslk,work_prsl + + logical ice + + character(len=24),parameter :: myname_ = 'general_read_fv3_regional' + + character(len=:),allocatable :: grid_spec !='fv3_grid_spec' + character(len=:),allocatable :: ak_bk !='fv3_akbk' + character(len=:),allocatable :: dynvars !='fv3_dynvars' + character(len=:),allocatable :: tracers !='fv3_tracer' + character(len=:),allocatable :: sfcdata !='fv3_sfcdata' + character(len=:),allocatable :: couplerres!='coupler.res' + integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) + integer(i_kind),allocatable:: ijnz(:),displsz_g(:) + + grid_spec=fv3_filenameginput%grid_spec + ak_bk=fv3_filenameginput%ak_bk + dynvars=fv3_filenameginput%dynvars + tracers=fv3_filenameginput%tracers + sfcdata=fv3_filenameginput%sfcdata + couplerres=fv3_filenameginput%couplerres + + + + allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) + allocate(displss(npe),displss2d(npe),displsz_g(npe) ) + +!cltthinktobe should be contained in variable like grd_ens + do i=1,npe + ijns(i)=grd_ens%ijn_s(i)*grd_ens%nsig + ijnz(i)=grd_ens%ijn(i)*grd_ens%nsig + ijns2d(i)=grd_ens%ijn_s(i)*n2d + enddo + displss(1)=0 + displsz_g(1)=0 + displss2d(1)=0 + do i=2,npe + displss(i)=displss(i-1)+ ijns(i-1) + displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) + displss2d(i)=displss2d(i-1)+ ijns2d(i-1) + enddo + +! do it=1,nfldsig + + + + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) + g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid + do i=grd_ens%nsig,1,-1 + g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) + enddo + g_ps(:,:)=g_prsi(:,:,1) + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) +! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) + +!! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_tv(i,j,k)=g_tsen(i,j,k)*(one+fv*g_q(i,j,k)) + enddo + enddo + enddo + if (.not.q_hyb_ens) then + ice=.true. + iderivative=0 + do k=1,grd_ens%nsig + kp=k+1 + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_prsl(i,j,k)=(g_prsi(i,j,k)+g_prsi(i,j,kp))*half + + end do + end do + end do + + call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_rh(i,j,k) = g_q(i,j,k)/g_rh(i,j,k) + end do + end do + end do + else + do k=1,grd_ens%nsig + do j=1,grd_ens%lon2 + do i=1,grd_ens%lat2 + g_rh(i,j,k) = g_q(i,j,k) + end do + end do + end do + end if + + + +!clt not needed call gsi_fv3ncdf2d_read(it,ges_z) + + return + end subroutine general_read_fv3_regional + subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_bar) + !$$$ subprogram documentation block + ! . . . . + ! subprogram: ens_spread_dualres_regional + ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 + ! + ! abstract: + ! + ! + ! program history log: + ! 2010-08-11 parrish, initial documentation + ! 2011-04-05 parrish - add pseudo-bundle capability + ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle + ! + ! input argument list: + ! en_bar - ensemble mean + ! mype - current processor number + ! + ! output argument list: + ! + ! attributes: + ! language: f90 + ! machine: ibm RS/6000 SP + ! + !$$$ end documentation block + ! + use kinds, only: r_single,r_kind,i_kind + use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_anl,p_e2a,uv_hyb_ens, & + regional_ensemble_option + use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_create_info,general_sube2suba + use constants, only: zero,two,half,one + use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d + use gsi_bundlemod, only: gsi_bundlecreate + use gsi_bundlemod, only: gsi_grid + use gsi_bundlemod, only: gsi_bundle + use gsi_bundlemod, only: gsi_bundlegetpointer + use gsi_bundlemod, only: gsi_bundledestroy + use gsi_bundlemod, only: gsi_gridcreate + implicit none + + class(get_fv3_regional_ensperts_class), intent(inout) :: this + type(gsi_bundle),OPTIONAL,intent(in):: en_bar + integer(i_kind),intent(in):: mype + type(gsi_bundle),allocatable, intent(in ) :: en_perts(:,:) + integer(i_kind), intent(in ):: nelen + + type(gsi_bundle):: sube,suba + type(gsi_grid):: grid_ens,grid_anl + real(r_kind) sp_norm,sig_norm_sq_inv + type(sub2grid_info)::se,sa + integer(i_kind) k + + integer(i_kind) i,n,ic3 + logical regional + integer(i_kind) num_fields,inner_vars,istat,istatus + logical,allocatable::vector(:) + real(r_kind),pointer,dimension(:,:,:):: st,vp,tv,rh,oz,cw + real(r_kind),pointer,dimension(:,:):: ps + real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2,grd_anl%nsig),target::dum3 + real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2),target::dum2 + + associate( this => this ) ! eliminates warning for unused dummy argument needed for binding + end associate + + ! create simple regular grid + call gsi_gridcreate(grid_anl,grd_anl%lat2,grd_anl%lon2,grd_anl%nsig) + call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) + + ! create two internal bundles, one on analysis grid and one on ensemble grid + + call gsi_bundlecreate (suba,grid_anl,'ensemble work',istatus, & + names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' in ens_spread_dualres_regional: trouble creating bundle_anl bundle' + call stop2(9998) + endif + call gsi_bundlecreate (sube,grid_ens,'ensemble work ens',istatus, & + names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) + if(istatus/=0) then + write(6,*)' ens_spread_dualres_regional: trouble creating bundle_ens bundle' + call stop2(9999) + endif + + sp_norm=(one/float(n_ens)) + + sube%values=zero + ! + + if(regional_ensemble_option == 1)then + print *,'global ensemble' + sig_norm_sq_inv=n_ens-one + + do n=1,n_ens + do i=1,nelen + sube%values(i)=sube%values(i) & + +en_perts(n,1)%valuesr4(i)*en_perts(n,1)%valuesr4(i) + end do + end do + + do i=1,nelen + sube%values(i) = sqrt(sp_norm*sig_norm_sq_inv*sube%values(i)) + end do + else + do n=1,n_ens + do i=1,nelen + sube%values(i)=sube%values(i) & + +(en_perts(n,1)%valuesr4(i)-en_bar%values(i))*(en_perts(n,1)%valuesr4(i)-en_bar%values(i)) + end do + end do + + do i=1,nelen + sube%values(i) = sqrt(sp_norm*sube%values(i)) + end do + end if + + if(grd_ens%latlon1n == grd_anl%latlon1n) then + do i=1,nelen + suba%values(i)=sube%values(i) + end do + else + inner_vars=1 + num_fields=max(0,nc3d)*grd_ens%nsig+max(0,nc2d) + allocate(vector(num_fields)) + vector=.false. + do ic3=1,nc3d + if(trim(cvars3d(ic3))=='sf'.or.trim(cvars3d(ic3))=='vp') then + do k=1,grd_ens%nsig + vector((ic3-1)*grd_ens%nsig+k)=uv_hyb_ens + end do + end if + end do + call general_sub2grid_create_info(se,inner_vars,grd_ens%nlat,grd_ens%nlon,grd_ens%nsig,num_fields, & + regional,vector) + call general_sub2grid_create_info(sa,inner_vars,grd_anl%nlat,grd_anl%nlon,grd_anl%nsig,num_fields, & + regional,vector) + deallocate(vector) + call general_sube2suba(se,sa,p_e2a,sube%values,suba%values,regional) + end if + + dum2=zero + dum3=zero + call gsi_bundlegetpointer(suba,'sf',st,istat) + if(istat/=0) then + write(6,*)' no sf pointer in ens_spread_dualres, point st at dum3 array' + st => dum3 + end if + call gsi_bundlegetpointer(suba,'vp',vp,istat) + if(istat/=0) then + write(6,*)' no vp pointer in ens_spread_dualres, point vp at dum3 array' + vp => dum3 + end if + call gsi_bundlegetpointer(suba,'t',tv,istat) + if(istat/=0) then + write(6,*)' no t pointer in ens_spread_dualres, point tv at dum3 array' + tv => dum3 + end if + call gsi_bundlegetpointer(suba,'q',rh,istat) + if(istat/=0) then + write(6,*)' no q pointer in ens_spread_dualres, point rh at dum3 array' + rh => dum3 + end if + call gsi_bundlegetpointer(suba,'oz',oz,istat) + if(istat/=0) then + write(6,*)' no oz pointer in ens_spread_dualres, point oz at dum3 array' + oz => dum3 + end if + call gsi_bundlegetpointer(suba,'cw',cw,istat) + if(istat/=0) then + write(6,*)' no cw pointer in ens_spread_dualres, point cw at dum3 array' + cw => dum3 + end if + call gsi_bundlegetpointer(suba,'ps',ps,istat) + if(istat/=0) then + write(6,*)' no ps pointer in ens_spread_dualres, point ps at dum2 array' + ps => dum2 + end if + + call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) + + return + end subroutine ens_spread_dualres_regional_fv3_regional + +end module get_fv3_regional_ensperts_mod diff --git a/src/gsi/fv3_regional_interface.f90 b/src/gsi/fv3_regional_interface.f90 index fc214e5bcc..40cfc1f33b 100644 --- a/src/gsi/fv3_regional_interface.f90 +++ b/src/gsi/fv3_regional_interface.f90 @@ -32,6 +32,7 @@ subroutine convert_fv3_regional use gsi_io, only: lendian_out use gridmod, only: nsig,regional_time,regional_fhr,nlon_regional,nlat_regional,nsig use mpimod, only: mype + use mpimod, only: mpi_comm_world,ierror implicit none integer(i_kind) ierr @@ -43,6 +44,9 @@ subroutine convert_fv3_regional ak_bk='fv3_akbk' ! vertical grid information call bg_fv3regfilenameg%init(grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') call gsi_rfv3io_get_grid_specs(bg_fv3regfilenameg,ierr) + call mpi_barrier(mpi_comm_world,ierror) + write(6,*)'after gsi_rfv3io_get_grid_specs' + call flush(6) if(ierr/=0)then write(6,*)' problem in convert_fv3_regional - get_grid_specs Status = ',ierr call stop2 (555) diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index b10f9cce35..99ec40b1b4 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -39,7 +39,7 @@ subroutine get_gefs_for_regional use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_a1,grd_e1,p_e2a,uv_hyb_ens,dual_res use hybrid_ensemble_parameters, only: full_ensemble,q_hyb_ens,l_ens_in_diff_time,write_ens_sprd - use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path + use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path,jcap_ens !use hybrid_ensemble_parameters, only: add_bias_perturbation use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d use gsi_bundlemod, only: gsi_bundlecreate @@ -244,7 +244,18 @@ subroutine get_gefs_for_regional nlat_gfs=sighead%latf+2 nlon_gfs=sighead%lonf nsig_gfs=sighead%levs - jcap_gfs=sighead%jcap + if(sighead%jcap > 0)then + jcap_gfs=sighead%jcap + else if(jcap_ens > 0)then + jcap_gfs=jcap_ens + else + write(6,*)'ERROR jcap is undefined' + call stop2(555) + endif + + + + idvc=sighead%idvc idsl=sighead%idsl ! Extract header information @@ -273,8 +284,15 @@ subroutine get_gefs_for_regional nlat_gfs=latb+2 nlon_gfs=lonb nsig_gfs=levs - jcap_gfs=njcap - + if(njcap > 0)then + jcap_gfs=njcap + else if(jcap_ens > 0)then + jcap_gfs=jcap_ens + else + write(6,*)'ERROR jcap is undefined' + call stop2(555) + endif + write(6,*)'thinkdeb555 jcap_gfs is ',jcap_gfs if(allocated(nems_vcoord)) deallocate(nems_vcoord) allocate(nems_vcoord(levs+1,3,2)) call nemsio_getfilehead(gfile,iret=iret,vcoord=nems_vcoord) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index c53094b1ab..97dcb4ee7c 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -119,7 +119,7 @@ subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & this%tracers=tracers_input else - this%tracers='fv3_tracers' + this%tracers='fv3_tracer' endif if(present(sfcdata_input))then @@ -132,7 +132,8 @@ subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & this%couplerres=couplerres_input else - this%couplerres='fv3_coupler.res' +!clt this%couplerres='fv3_coupler.res' + this%couplerres='coupler.res' endif end subroutine fv3regfilename_init @@ -222,7 +223,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) ierr=0 iret=nf90_open(trim(grid_spec),nf90_nowrite,gfile_grid_spec) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(grid_spec),', Status = ',iret + write(6,*)' problem opening1 ',trim(grid_spec),', Status = ',iret ierr=1 return endif @@ -265,7 +266,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) iret=nf90_open(ak_bk,nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(ak_bk),', Status = ',iret + write(6,*)' problem opening2 ',trim(ak_bk),', Status = ',iret ierr=1 return endif @@ -753,7 +754,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) if(mype==mype_2d ) then iret=nf90_open(sfcdata,nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(sfcdata),', Status = ',iret + write(6,*)' problem opening3 ',trim(sfcdata),', Status = ',iret return endif iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) @@ -814,7 +815,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) !!!! read in orog from dynam !!!!!!!!!!!! iret=nf90_open(trim(dynvars ),nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(dynvars ),gfile_loc,', Status = ',iret + write(6,*)' problem opening4 ',trim(dynvars ),gfile_loc,', Status = ',iret return endif @@ -939,7 +940,8 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) if(mype==mype_io ) then iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(filenamein),gfile_loc,', Status = ',iret + write(6,*)' problem opening5 ',trim(filenamein),gfile_loc,', Status = ',iret + write(6,*)' problem opening5 with varnam ',trim(varname) return endif @@ -1047,7 +1049,7 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) if(mype==mype_u .or. mype==mype_v) then iret=nf90_open(dynvarsfile,nf90_nowrite,gfile_loc) if(iret/=nf90_noerr) then - write(6,*)' problem opening ',trim(dynvarsfile),', Status = ',iret + write(6,*)' problem opening6 ',trim(dynvarsfile),', Status = ',iret return endif @@ -1437,6 +1439,8 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) kp=k+1 work_b(:,:,k)=(work_bi(:,:,kp)-work_bi(:,:,k))*1000._r_kind enddo + write(6,*)'thinkdeb delp (nsig+1)(the actual lowest leval is ',work_bi(12,:,nsig) + write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_bi(12,:,nsig) write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_b(12,:,nsig) print *,'write out ',trim(varname),' to ',trim(filename) diff --git a/src/gsi/guess_grids.F90 b/src/gsi/guess_grids.F90 index ed617108f1..c4fb85226a 100644 --- a/src/gsi/guess_grids.F90 +++ b/src/gsi/guess_grids.F90 @@ -690,6 +690,8 @@ subroutine create_chemges_grids(mype,istatus) ! When proper connection to ESMF is complete, ! the following will not be needed here ! ------------------------------------------ +!clt to think +!tothink wrong call gsi_chemguess_get('dim',ntgases,istatus) if(istatus/=0) then if(mype==0) write(6,*) myname_, ': trouble getting number of chem/gases' diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 6abc228288..eae308e1a9 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1175,6 +1175,7 @@ subroutine load_ensemble use get_fv3_regional_ensperts_mod, only: get_fv3_regional_ensperts_class use get_wrf_nmm_ensperts_mod, only: get_wrf_nmm_ensperts_class use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens + use mpimod, only: mpi_comm_world,ierror implicit none @@ -1301,7 +1302,7 @@ subroutine load_ensemble else - if(regional_ensemble_option < 1 .or. regional_ensemble_option > 4) then + if(regional_ensemble_option < 1 .or. regional_ensemble_option > 5) then if(mype==0) then write(6,'(" IMPROPER CHOICE FOR ENSEMBLE INPUT IN SUBROUTINE LOAD_ENSEMBLE")') write(6,'(" regional_ensemble_option = ",i5)') regional_ensemble_option @@ -1331,6 +1332,7 @@ subroutine load_ensemble call en_perts_get_from_save_fulldomain else call get_gefs_for_regional + call mpi_barrier(mpi_comm_world,ierror) endif ! pseudo_hybens = .true.: pseudo ensemble hybrid option for hwrf diff --git a/src/gsi/mpeu_util.F90 b/src/gsi/mpeu_util.F90 index 960af8b71a..8266fa6530 100644 --- a/src/gsi/mpeu_util.F90 +++ b/src/gsi/mpeu_util.F90 @@ -2010,6 +2010,7 @@ subroutine get_table_size_(tname,lu,ntotal,nactual) rewind(lu) done_scan: do read(lu,*,iostat=ier) buf + write(6,*)'thinkdeb 20 ier is ',ier if(ier/=0) exit if(trim(buf)==''.or.buf(1:1)=='#'.or.buf(1:1)=='!') cycle ! ignore comments outside table ln=len(trim(tname)) diff --git a/src/gsi/ncepnems_io.f90 b/src/gsi/ncepnems_io.f90 index 5d81e643ec..2134c0a05b 100644 --- a/src/gsi/ncepnems_io.f90 +++ b/src/gsi/ncepnems_io.f90 @@ -267,7 +267,7 @@ subroutine read_ call gsi_bundlecreate(atm_bundle,atm_grid,'aux-atm-read',istatus,names2d=vars2d,names3d=vars3d) if(istatus/=0) then write(6,*) myname_,': trouble creating atm_bundle' - call stop2(999) + call stop2(2999) endif do it=1,nfldsig @@ -1930,7 +1930,7 @@ subroutine write_atm_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin) write(6,*) 'Missing some of the required fields' write(6,*) 'Aborting ... ' endif - call stop2(999) + call stop2(1999) endif if ( sp_a%jcap /= jcap_b ) then diff --git a/src/gsi/observer.F90 b/src/gsi/observer.F90 index 30cd46bdee..a3108c7efc 100644 --- a/src/gsi/observer.F90 +++ b/src/gsi/observer.F90 @@ -139,6 +139,7 @@ subroutine guess_init_ use compact_diffs,only: create_cdiff_coefs, inisph use mp_compact_diffs_mod1, only: init_mp_compact_diffs1 use mpeu_util, only: die + use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype implicit none ! Declare passed variables @@ -309,6 +310,7 @@ subroutine set_ use mpeu_util, only: tell,die use gsi_nstcouplermod, only: nst_gsi,gsi_nstcoupler_final use gsi_io, only: mype_io + use mpimod, only: ierror,mpi_comm_world implicit none character(len=*), parameter :: Iam="observer_set" diff --git a/src/gsi/read_guess.F90 b/src/gsi/read_guess.F90 index cebbec0724..e7802516af 100644 --- a/src/gsi/read_guess.F90 +++ b/src/gsi/read_guess.F90 @@ -109,6 +109,7 @@ subroutine read_guess(iyear,month,idd,mype) use read_wrf_nmm_guess_mod, only: read_wrf_nmm_guess_class use gsi_rfv3io_mod, only: read_fv3_netcdf_guess use gsi_rfv3io_mod, only: bg_fv3regfilenameg + use mpimod, only: ierror,mpi_comm_world implicit none From 1a441b85c31e686a55ef5f5dbcabb0a6da0b9027 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Tue, 2 Apr 2019 13:44:27 +0000 Subject: [PATCH 010/155] mainly for adding fv3sar_ensemble_opt option --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 11 +++ src/gsi/gsi_rfv3io_mod.f90 | 104 +++++++++++++++++++++ src/gsi/gsimod.F90 | 7 +- src/gsi/hybrid_ensemble_parameters.f90 | 4 + src/gsi/mpeu_util.F90 | 1 - 5 files changed, 124 insertions(+), 3 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index fb0b8129b9..9f8ec471f4 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -338,6 +338,8 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens + use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt + use mpimod, only: mpi_comm_world,ierror,mpi_rtype use mpimod, only: npe use netcdf_mod, only: nc_check @@ -429,12 +431,21 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) + if (fv3sar_ensemble_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid do i=grd_ens%nsig,1,-1 g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) enddo g_ps(:,:)=g_prsi(:,:,1) + else ! for the ensemble processed frm CHGRES + call gsi_fv3ncdf_read(dynvars,'ps','PS',g_ps,mype_p) + g_prsi=g_prsi*0.001_r_kind + do k=1,grd_ens%nsig+1 + g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps + enddo + + endif call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) ! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 97dcb4ee7c..e29f8a2088 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -882,6 +882,104 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) deallocate (sfcn2d,a) return end subroutine gsi_fv3ncdf2d_read +subroutine gsi_fv2dncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_fv2dncdf_readv1 +! prgmmr: T. Lei date: 2019-03-28 +! modified from gsi_fv3ncdf_read and gsi_fv3ncdf2d_read +! +! abstract: read in a 2d field from a netcdf FV3 file in mype_io +! then scatter the field to each PE +! program history log: +! +! input argument list: +! filename - file name to read from +! varname - variable name to read in +! varname2 - variable name to read in +! mype_io - pe to read in the field +! +! output argument list: +! work_sub - output sub domain field +! +! attributes: +! language: f90 +! machine: ibm RS/6000 SP +! +!$$$ end documentation block + + + use kinds, only: r_kind,i_kind + use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype + use gridmod, only: lat2,lon2,nsig,nlat,nlon,itotsub,ijn_s,displs_s + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf, only: nf90_inq_varid + use netcdf, only: nf90_inquire_variable + use mod_fv3_lola, only: fv3_h_to_ll + use general_commvars_mod, only: ltosi_s,ltosj_s + + implicit none + character(*) ,intent(in ) :: varname,varname2,filenamein + real(r_kind) ,intent(out ) :: work_sub(lat2,lon2) + integer(i_kind) ,intent(in ) :: mype_io + character(len=128) :: name + real(r_kind),allocatable,dimension(:,:,:):: uu + integer(i_kind),allocatable,dimension(:):: dim_id,dim + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:):: a + + + integer(i_kind) n,ns,k,len,ndim + integer(i_kind) gfile_loc,var_id,iret + integer(i_kind) nz,nzp1,kk,j,mm1,i,ir,ii,jj + integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid + + mm1=mype+1 + allocate (work(itotsub)) + + if(mype==mype_io ) then + iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) + if(iret/=nf90_noerr) then + write(6,*)' problem opening5 ',trim(filenamein),gfile_loc,', Status = ',iret + write(6,*)' problem opening5 with varnam ',trim(varname) + return + endif + + iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) + allocate(dim(ndimensions)) + allocate(a(nlat,nlon)) + + iret=nf90_inq_varid(gfile_loc,trim(adjustl(name)),var_id) + iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) + if(allocated(dim_id )) deallocate(dim_id ) + allocate(dim_id(ndim)) + iret=nf90_inquire_variable(gfile_loc,var_id,dimids=dim_id) + if(allocated(uu )) deallocate(uu ) + allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) + iret=nf90_get_var(gfile_loc,var_id,uu) + call fv3_h_to_ll(uu(:,:,1),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat) + kk=0 + do n=1,npe + do j=1,ijn_s(n) + kk=kk+1 + ii=ltosi_s(kk) + jj=ltosj_s(kk) + work(kk)=a(ii,jj) + end do + end do + + iret=nf90_close(gfile_loc) + deallocate (uu,a,dim,dim_id) + + endif !mype + + call mpi_scatterv(work,ijn_s,displs_s,mpi_rtype,& + work_sub,ijn_s(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + + deallocate (work) + return +end subroutine gsi_fv2dncdf_read_v1 subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) !$$$ subprogram documentation block @@ -1439,11 +1537,17 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) kp=k+1 work_b(:,:,k)=(work_bi(:,:,kp)-work_bi(:,:,k))*1000._r_kind enddo + write(6,*)'thinkdeb delp (nsig+1)(the actual lowest leval is ',work_bi(12,:,nsig) write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_bi(12,:,nsig) write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_b(12,:,nsig) + write(6,*)'thinkdeb add_saved is ',add_saved + write(6,*)'thinkdeb delp (1:nsig)(the actual lowest leval is ',work_b(12,12,nsig:1:-1) print *,'write out ',trim(varname),' to ',trim(filename) + do k=1,nsig+1 + write(6,*)'thinkdebetal12 k, is ',k,' ',eta1_ll(k),eta2_ll(k) + enddo call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 1c3f2a5e34..7f2c949858 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -107,7 +107,7 @@ module gsimod use lag_traj,only : lag_stepduration use hybrid_ensemble_parameters,only : l_hyb_ens,uv_hyb_ens,aniso_a_en,generate_ens,& n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test,oz_univ_static,& - regional_ensemble_option,merge_two_grid_ensperts, & + regional_ensemble_option,fv3sar_ensemble_opt,merge_two_grid_ensperts, & full_ensemble,pseudo_hybens,pwgtflg,& beta_s0,s_ens_h,s_ens_v,init_hybrid_ensemble_parameters,& readin_localization,write_ens_sprd,eqspace_ensgrid,grid_ratio_ens,& @@ -365,6 +365,9 @@ module gsimod ! 01-04-2018 Apodaca add diag_light and lightinfo for GOES/GLM lightning ! data assimilation ! 08-25-2018 Collard Introduce bias_zero_start +! 03-29-2019 lei add integer parameter fv3sar_ensemble_opt to select the format of the FV3SAR ensembles +! =0; restart files +! =1; cold start IC files from CHGRES ! !EOP !------------------------------------------------------------------------- @@ -902,7 +905,7 @@ module gsimod ! ! namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,& - pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,full_ensemble,pwgtflg,& + pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& jcap_ens_test,beta_s0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& grid_ratio_ens, & oz_univ_static,write_ens_sprd,use_localization_grid,use_gfs_ens, & diff --git a/src/gsi/hybrid_ensemble_parameters.f90 b/src/gsi/hybrid_ensemble_parameters.f90 index 5c78ca47aa..ca7d25a726 100644 --- a/src/gsi/hybrid_ensemble_parameters.f90 +++ b/src/gsi/hybrid_ensemble_parameters.f90 @@ -274,6 +274,8 @@ module hybrid_ensemble_parameters public :: pseudo_hybens public :: merge_two_grid_ensperts public :: regional_ensemble_option + public :: fv3sar_ensemble_opt + public :: write_ens_sprd public :: nval_lenz_en public :: ntlevs_ens @@ -321,6 +323,7 @@ module hybrid_ensemble_parameters integer(i_kind) nval_lenz_en integer(i_kind) ntlevs_ens integer(i_kind) regional_ensemble_option + integer(i_kind) fv3sar_ensemble_opt character(len=512),save :: ensemble_path ! following is for storage of ensemble perturbations: @@ -379,6 +382,7 @@ subroutine init_hybrid_ensemble_parameters pseudo_hybens=.false. merge_two_grid_ensperts=.false. regional_ensemble_option=0 + fv3sar_ensemble_opt=0 write_ens_sprd=.false. readin_localization=.false. readin_beta=.false. diff --git a/src/gsi/mpeu_util.F90 b/src/gsi/mpeu_util.F90 index 8266fa6530..960af8b71a 100644 --- a/src/gsi/mpeu_util.F90 +++ b/src/gsi/mpeu_util.F90 @@ -2010,7 +2010,6 @@ subroutine get_table_size_(tname,lu,ntotal,nactual) rewind(lu) done_scan: do read(lu,*,iostat=ier) buf - write(6,*)'thinkdeb 20 ier is ',ier if(ier/=0) exit if(trim(buf)==''.or.buf(1:1)=='#'.or.buf(1:1)=='!') cycle ! ignore comments outside table ln=len(trim(tname)) From b93b3cc338feb8581170d88244108cdbc9fe2634 Mon Sep 17 00:00:00 2001 From: Jili Dong Date: Thu, 4 Apr 2019 00:25:39 +0000 Subject: [PATCH 011/155] Henry's GSI update for jet --- modulefiles/modulefile.ProdGSI.jet | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modulefiles/modulefile.ProdGSI.jet b/modulefiles/modulefile.ProdGSI.jet index 1f932ea765..f49a8e9004 100644 --- a/modulefiles/modulefile.ProdGSI.jet +++ b/modulefiles/modulefile.ProdGSI.jet @@ -11,15 +11,15 @@ #module-whatis " GDAS_ENKF whatis description" # # -module load newdefaults -module load intel/2016.2.181 -module load impi/5.1.1.109 +. /apps/lmod/lmod/init/sh + +module load intel/15.0.3.187 +module load impi # -module load szip/2.1 -module load hdf5/1.8.9 +module load szip +module load hdf5 module load netcdf4/4.2.1.1 -export COREPATH=/lfs3/projects/hfv3gfs/nwprod/lib export COREPATH=/mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib export NCEPLIBS=$COREPATH module use $NCEPLIBS/modulefiles @@ -37,8 +37,8 @@ module load sigio-intel-sandybridge/2.0.1 module load sfcio-intel-sandybridge/1.0.0 module use /home/George.Vandenberghe/t1/l1025/lib/modulefiles -module load hdf5 -module load netcdf +#module load hdf5 +#module load netcdf export NETCDF=${NETCDF4} export NETCDF_DIR=${NETCDF4} From b25741b830540c827a6d4fa12e7bed23598db24c Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Mon, 15 Apr 2019 21:17:09 +0000 Subject: [PATCH 012/155] add fv3sar_ensemble_opt --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 52 ++-- src/gsi/gsi_rfv3io_mod.f90 | 329 +++++++++++++++++++-- src/gsi/gsimod.F90 | 2 +- src/gsi/hybrid_ensemble_isotropic.F90 | 2 +- 4 files changed, 340 insertions(+), 45 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 9f8ec471f4..1aa50ec710 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -1,5 +1,5 @@ module get_fv3_regional_ensperts_mod -!clt started from cplr_get_fv3_regional_ensperts.f90 +!,grd_ens%ns,grd_ens%nsigigclt started from cplr_get_fv3_regional_ensperts.f90 use abstract_get_fv3_regional_ensperts_mod use kinds, only : i_kind type, extends(abstract_get_fv3_regional_ensperts_class) :: get_fv3_regional_ensperts_class @@ -105,8 +105,6 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! LOOP OVER ENSEMBLE MEMBERS do n=1,n_ens write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n - write(6,*)'thinkdeb22 ens_fhrlevs(mO is ',m, ens_fhrlevs(m) - write(6,*)'ensfilenam_str is ',trim(ensfilenam_str) 22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) ! DEFINE INPUT FILE NAME fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe @@ -348,7 +346,10 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g use gsi_rfv3io_mod,only:mype_t,mype_p ,mype_q,mype_oz use constants, only: half,zero use gsi_rfv3io_mod, only: gsi_fv3ncdf_read + use gsi_rfv3io_mod, only: gsi_fv3ncdf_read_v1 use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv + use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv_v1 + use gsi_rfv3io_mod, only: gsi_fv3ncdf2d_read_v1 implicit none ! @@ -395,8 +396,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g character(len=:),allocatable :: tracers !='fv3_tracer' character(len=:),allocatable :: sfcdata !='fv3_sfcdata' character(len=:),allocatable :: couplerres!='coupler.res' - integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) - integer(i_kind),allocatable:: ijnz(:),displsz_g(:) grid_spec=fv3_filenameginput%grid_spec ak_bk=fv3_filenameginput%ak_bk @@ -405,32 +404,24 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g sfcdata=fv3_filenameginput%sfcdata couplerres=fv3_filenameginput%couplerres - - allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) - allocate(displss(npe),displss2d(npe),displsz_g(npe) ) !cltthinktobe should be contained in variable like grd_ens - do i=1,npe - ijns(i)=grd_ens%ijn_s(i)*grd_ens%nsig - ijnz(i)=grd_ens%ijn(i)*grd_ens%nsig - ijns2d(i)=grd_ens%ijn_s(i)*n2d - enddo - displss(1)=0 - displsz_g(1)=0 - displss2d(1)=0 - do i=2,npe - displss(i)=displss(i-1)+ ijns(i-1) - displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) - displss2d(i)=displss2d(i-1)+ ijns2d(i-1) - enddo ! do it=1,nfldsig - - - + write(6,*)'thinkdeb999 fv3sar_ensemble_opt is ',fv3sar_ensemble_opt + if(fv3sar_ensemble_opt.eq.0 ) then + write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 0 ' call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) + else + write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 1 ' + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v) + endif + if(fv3sar_ensemble_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) + else + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t) + endif if (fv3sar_ensemble_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid @@ -439,16 +430,25 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g enddo g_ps(:,:)=g_prsi(:,:,1) else ! for the ensemble processed frm CHGRES - call gsi_fv3ncdf_read(dynvars,'ps','PS',g_ps,mype_p) - g_prsi=g_prsi*0.001_r_kind + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p) + g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps + write(6,*)'thinkdeb999 etal eta2 in hpa,k = ',k ,' ',eta1_ll(k),eta2_ll(k),g_ps(10,10) + write(6,*)'thinkdeb999 g_prsi in hpa,k = ',k ,' ',g_prsi(10,10,k) enddo + endif + + if(fv3sar_ensemble_opt.eq.0) then call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) ! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) + else + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz) + endif !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do k=1,grd_ens%nsig diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index e29f8a2088..b30e356f77 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -64,10 +64,13 @@ module gsi_rfv3io_mod ! set subroutines to public public :: gsi_rfv3io_get_grid_specs public :: gsi_fv3ncdf_read + public :: gsi_fv3ncdf_read_v1 public :: gsi_fv3ncdf_readuv + public :: gsi_fv3ncdf_readuv_v1 public :: read_fv3_files public :: read_fv3_netcdf_guess public :: wrfv3_netcdf + public :: gsi_fv3ncdf2d_read_v1 public :: mype_u,mype_v,mype_t,mype_q,mype_p,mype_oz,mype_ql public :: k_slmsk,k_tsea,k_vfrac,k_vtype,k_stype,k_zorl,k_smc,k_stc @@ -261,6 +264,10 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) iret=nf90_get_var(gfile_loc,k,grid_lont) endif enddo + write(6,*)'thinkdeb9992 grid_lont i j=12, is ',grid_lont(10:100:10,12) + write(6,*)'thinkdeb9992 grid_lont i j=240 is ',grid_lont(10:100:10,24) + write(6,*)'thinkdeb9992 grid_latt i=12 is ',grid_latt(12, 12:112:10) + write(6,*)'thinkdeb9992 grid_latt i=240 is ',grid_latt(240,10:112:10) iret=nf90_close(gfile_loc) @@ -882,10 +889,10 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) deallocate (sfcn2d,a) return end subroutine gsi_fv3ncdf2d_read -subroutine gsi_fv2dncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) +subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) !$$$ subprogram documentation block ! . . . . -! subprogram: gsi_fv2dncdf_readv1 +! subprogram: gsi_fv23ncdf2d_readv1 ! prgmmr: T. Lei date: 2019-03-28 ! modified from gsi_fv3ncdf_read and gsi_fv3ncdf2d_read ! @@ -923,7 +930,6 @@ subroutine gsi_fv2dncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) character(*) ,intent(in ) :: varname,varname2,filenamein real(r_kind) ,intent(out ) :: work_sub(lat2,lon2) integer(i_kind) ,intent(in ) :: mype_io - character(len=128) :: name real(r_kind),allocatable,dimension(:,:,:):: uu integer(i_kind),allocatable,dimension(:):: dim_id,dim real(r_kind),allocatable,dimension(:):: work @@ -950,15 +956,24 @@ subroutine gsi_fv2dncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) allocate(dim(ndimensions)) allocate(a(nlat,nlon)) - iret=nf90_inq_varid(gfile_loc,trim(adjustl(name)),var_id) + iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) + write(6,*)'thinkdeb99 iret,var_id is ',var_id + if(iret/=nf90_noerr) then + write(6,*)'thinkdeb999 wrong to get var_id ',var_id + endif + iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) if(allocated(dim_id )) deallocate(dim_id ) allocate(dim_id(ndim)) iret=nf90_inquire_variable(gfile_loc,var_id,dimids=dim_id) if(allocated(uu )) deallocate(uu ) - allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) +!cltorg allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) + allocate(uu(nx,ny,1)) iret=nf90_get_var(gfile_loc,var_id,uu) - call fv3_h_to_ll(uu(:,:,1),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat) + write(6,*)'thinkdeb999 varname ',trim(adjustl(varname)) + write(6,*)'thinkdeb999 in readeps uu ps is ',uu(10,10,1) + call fv3_h_to_ll(uu(:,:,1),a,nx,ny,nlon,nlat) + write(6,*)'thinkdeb999 in readeps aps is ',a(10,10) kk=0 do n=1,npe do j=1,ijn_s(n) @@ -979,7 +994,7 @@ subroutine gsi_fv2dncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) deallocate (work) return -end subroutine gsi_fv2dncdf_read_v1 +end subroutine gsi_fv3ncdf2d_read_v1 subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) !$$$ subprogram documentation block @@ -1096,6 +1111,132 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) return end subroutine gsi_fv3ncdf_read +subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) + +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_fv3ncdf_read +! Lei modified from gsi_fv3ncdf_read +! prgmmr: wu org: np22 date: 2017-10-10 +! +! abstract: read in a field from a netcdf FV3 file in mype_io +! then scatter the field to each PE +! program history log: +! +! input argument list: +! filename - file name to read from +! varname - variable name to read in +! varname2 - variable name to read in +! mype_io - pe to read in the field +! +! output argument list: +! work_sub - output sub domain field +! +! attributes: +! language: f90 +! machine: ibm RS/6000 SP +! +!$$$ end documentation block + + + use kinds, only: r_kind,i_kind + use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype + use gridmod, only: lat2,lon2,nsig,nlat,nlon,itotsub,ijn_s + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf, only: nf90_inquire_variable + use netcdf, only: nf90_inq_varid + use mod_fv3_lola, only: fv3_h_to_ll + use general_commvars_mod, only: ltosi_s,ltosj_s + + implicit none + character(*) ,intent(in ) :: varname,varname2,filenamein + real(r_kind) ,intent(out ) :: work_sub(lat2,lon2,nsig) + integer(i_kind) ,intent(in ) :: mype_io + character(len=128) :: name + real(r_kind),allocatable,dimension(:,:,:):: uu + real(r_kind),allocatable,dimension(:,:,:):: temp0 + integer(i_kind),allocatable,dimension(:):: dim_id,dim + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:):: a + + + integer(i_kind) n,ns,k,len,ndim,var_id + integer(i_kind) gfile_loc,iret + integer(i_kind) nztmp,nzp1,kk,j,mm1,i,ir,ii,jj + integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid + + mm1=mype+1 + allocate (work(itotsub*nsig)) + + if(mype==mype_io ) then + iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) + if(iret/=nf90_noerr) then + write(6,*)' problem opening5 ',trim(filenamein),gfile_loc,', Status = ',iret + write(6,*)' problem opening5 with varnam ',trim(varname) + return + endif + + iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) + allocate(dim(ndimensions)) + allocate(a(nlat,nlon)) + + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc,k,name,len) + dim(k)=len + enddo + + allocate(uu(nx,ny,nsig)) + allocate(temp0(nx,ny,nsig+1)) + +!cltorg beigin do k=ndimensions+1,nvariables +! iret=nf90_inquire_variable(gfile_loc,k,name,len) +! if(trim(name)==varname .or. trim(name)==varname2) then +! iret=nf90_inquire_variable(gfile_loc,k,ndims=ndim) +! if(allocated(dim_id )) deallocate(dim_id ) +! allocate(dim_id(ndim)) +! iret=nf90_inquire_variable(gfile_loc,k,dimids=dim_id) +! if(allocated(uu )) deallocate(uu ) +! allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) +! iret=nf90_get_var(gfile_loc,k,uu) +! exit +! endif +! enddo ! k + iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) + iret=nf90_get_var(gfile_loc,var_id,temp0) + uu(:,:,:)=temp0(:,:,2:(nsig+1)) + + nztmp=nsig + nzp1=nztmp+1 + do i=1,nztmp + ir=nzp1-i + call fv3_h_to_ll(uu(:,:,i),a,nx,ny,nlon,nlat) + kk=0 + do n=1,npe + ns=displss(n)+(ir-1)*ijn_s(n) + do j=1,ijn_s(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_s(kk) + jj=ltosj_s(kk) + work(ns)=a(ii,jj) + end do + end do + enddo ! i + + iret=nf90_close(gfile_loc) + deallocate (uu,a,dim) + deallocate (temp0) + + endif !mype + + call mpi_scatterv(work,ijns,displss,mpi_rtype,& + work_sub,ijns(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + + deallocate (work) + return +end subroutine gsi_fv3ncdf_read_v1 + subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) !$$$ subprogram documentation block ! . . . . @@ -1123,6 +1264,7 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable + use netcdf, only: nf90_inq_varid use mod_fv3_lola, only: fv3_h_to_ll,nya,nxa,fv3uv2earth use general_commvars_mod, only: ltosi_s,ltosj_s @@ -1163,6 +1305,10 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) allocate(u(dim(1),dim(4))) allocate(v(dim(1),dim(4))) + write(6,*)'thinkdeb999 0 u,v dims are',dim(1),dim(4) + iret=nf90_inq_varid(gfile_loc,trim(adjustl("xaxis_1")),k) !thinkdeb + iret=nf90_get_var(gfile_loc,k,u(:,1)) + write(6,*)'thinkdeb9992 in origin readuv ',u(1:10,1) do k=ndimensions+1,nvariables iret=nf90_inquire_variable(gfile_loc,k,name,len) @@ -1175,6 +1321,7 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) ! NOTE: dimension of variables on native fv3 grid. ! u and v have an extra row in one of the dimensions if(allocated(uu)) deallocate(uu) + write(6,*)'thinkdeb999 varname dim is ',(trim(name)),dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)) allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,k,uu) if(trim(name)=='u'.or.trim(name)=='U') then @@ -1220,6 +1367,161 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) ges_v,ijns(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) deallocate(work) end subroutine gsi_fv3ncdf_readuv +subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) +!$$$ subprogram documentation block +! subprogram: gsi_fv3ncdf_readuv +! prgmmr: wu w org: np22 date: 2017-11-22 +! +! 2019-04 lei modified from gsi_fv3ncdf_readuv to deal with cold start files . . . +! abstract: read in a field from a netcdf FV3 file in mype_u,mype_v +! then scatter the field to each PE +! program history log: +! +! input argument list: +! +! output argument list: +! ges_u - output sub domain u field +! ges_v - output sub domain v field +! +! attributes: +! language: f90 +! machine: ibm RS/6000 SP +! +!$$$ end documentation block + use constants, only: half + use kinds, only: r_kind,i_kind + use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype + use gridmod, only: lat2,lon2,nsig,itotsub,ijn_s + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf, only: nf90_inquire_variable + use netcdf, only: nf90_inq_varid + use mod_fv3_lola, only: fv3_h_to_ll,nya,nxa,fv3uv2earth + use general_commvars_mod, only: ltosi_s,ltosj_s + + implicit none + character(*) ,intent(in ):: dynvarsfile + real(r_kind) ,intent(out ) :: ges_u(lat2,lon2,nsig) + real(r_kind) ,intent(out ) :: ges_v(lat2,lon2,nsig) + character(len=128) :: name + real(r_kind),allocatable,dimension(:,:,:):: uu,temp0 + integer(i_kind),allocatable,dimension(:):: dim_id,dim + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:):: a + real(r_kind),allocatable,dimension(:,:):: uorv + + integer(i_kind) n,ns,k,len,ndim,var_id + integer(i_kind) gfile_loc,iret + integer(i_kind) nztmp,nzp1,kk,j,mm1,i,ir,ii,jj + integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid + + allocate (work(itotsub*nsig)) + mm1=mype+1 + if(mype==mype_u .or. mype==mype_v) then + iret=nf90_open(dynvarsfile,nf90_nowrite,gfile_loc) + if(iret/=nf90_noerr) then + write(6,*)' problem opening6 ',trim(dynvarsfile),', Status = ',iret + return + endif + + iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) + + allocate(dim(ndimensions)) + allocate(a(nya,nxa)) + + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc,k,name,len) + dim(k)=len + enddo + allocate(uorv(nx,ny)) + if(mype.eq.mype_u) then + allocate(uu(nx,ny+1,nsig)) + else ! for mype_v + allocate(uu(nx+1,ny,nsig)) + endif + +!cltorg begin do k=ndimensions+1,nvariables +!clt iret=nf90_inquire_variable(gfile_loc,k,name,len) +!clt if(trim(name)=='u'.or.trim(name)=='U' .or. & +!clt trim(name)=='v'.or.trim(name)=='V' ) then +!clt iret=nf90_inquire_variable(gfile_loc,k,ndims=ndim) +!clt if(allocated(dim_id )) deallocate(dim_id ) +!clt allocate(dim_id(ndim)) +!clt iret=nf90_inquire_variable(gfile_loc,k,dimids=dim_id) +! NOTE: dimension of variables on native fv3 grid. +! u and v have an extra row in one of the dimensions +!! if(allocated(uu)) deallocate(uu) +! allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) +! iret=nf90_get_var(gfile_loc,k,uu) +! if(trim(name)=='u'.or.trim(name)=='U') then +! allocate(temp1(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) +! temp1=uu +! else if(trim(name)=='v'.or.trim(name)=='V') then +! exit +! endif +! endif +! enddo ! k +! transfor to earth u/v, interpolate to analysis grid, reverse vertical order + if(mype.eq.mype_u) then + iret=nf90_inq_varid(gfile_loc,trim(adjustl("u_s")),var_id) + + iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) + allocate(temp0(nx,ny+1,nsig+1)) + iret=nf90_get_var(gfile_loc,var_id,temp0) + uu(:,:,:)=temp0(:,:,2:nsig+1) + deallocate(temp0) + endif + if(mype.eq.mype_v) then + allocate(temp0(nx+1,ny,nsig+1)) + iret=nf90_inq_varid(gfile_loc,trim(adjustl("v_w")),var_id) + iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) + iret=nf90_get_var(gfile_loc,var_id,temp0) + uu(:,:,:)=(temp0(:,:,2:nsig+1)) + deallocate (temp0) + endif + nztmp=nsig + nzp1=nztmp+1 + do i=1,nztmp + ir=nzp1-i +!cltthinkorg call fv3uv2earth(temp1(:,:,i),uu(:,:,i),nx,ny,u,v) + if(mype==mype_u)then +!cltthinkdeb call fv3_h_to_ll(u,a,nx,ny,nxa,nya) + do j=1,ny + uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) + enddo + + call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + else +!cltthinkorg call fv3_h_to_ll(v,a,nx,ny,nxa,nya) + do j=1,nx + uorv(j,:)=half*(uu(j,:,i)+uu(j+1,:,i)) + enddo + call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + endif + kk=0 + do n=1,npe + ns=displss(n)+(ir-1)*ijn_s(n) + do j=1,ijn_s(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_s(kk) + jj=ltosj_s(kk) + work(ns)=a(ii,jj) + end do + end do + enddo ! i + deallocate(a) + deallocate (uu,uorv) + iret=nf90_close(gfile_loc) + endif ! mype + +!! scatter to ges_u,ges_v !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + call mpi_scatterv(work,ijns,displss,mpi_rtype,& + ges_u,ijns(mm1),mpi_rtype,mype_u,mpi_comm_world,ierror) + call mpi_scatterv(work,ijns,displss,mpi_rtype,& + ges_v,ijns(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) + deallocate(work) +end subroutine gsi_fv3ncdf_readuv_v1 subroutine wrfv3_netcdf(fv3filenamegin) !$$$ subprogram documentation block @@ -1538,16 +1840,9 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) work_b(:,:,k)=(work_bi(:,:,kp)-work_bi(:,:,k))*1000._r_kind enddo - write(6,*)'thinkdeb delp (nsig+1)(the actual lowest leval is ',work_bi(12,:,nsig) - write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_bi(12,:,nsig) - write(6,*)'thinkdeb delp (nsig)(the actual lowest leval is ',work_b(12,:,nsig) - write(6,*)'thinkdeb add_saved is ',add_saved - write(6,*)'thinkdeb delp (1:nsig)(the actual lowest leval is ',work_b(12,12,nsig:1:-1) - - print *,'write out ',trim(varname),' to ',trim(filename) - do k=1,nsig+1 - write(6,*)'thinkdebetal12 k, is ',k,' ',eta1_ll(k),eta2_ll(k) - enddo +! do k=1,nsig+1 +! write(6,*)' is ',k,' ',eta1_ll(k),eta2_ll(k) +! enddo call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 7f2c949858..c719b72b67 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -1211,7 +1211,7 @@ subroutine gsimain_initialize close(11) #endif - + write(6,*)'thinkdeb9990 nhr_assilation is ',nhr_assimilation if(jcap > jcap_cut)then jcap_cut = jcap+1 if(mype == 0)then diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index eae308e1a9..9b750c8318 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1319,7 +1319,7 @@ subroutine load_ensemble end if call stop2(999) end if - + write(6,*)'thinkdeb9990-1 regional_ensemble_option is ',regional_ensemble_option select case(regional_ensemble_option) case(1) From 2954a02c5269c3399f7cfde194452e705f66c622 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Fri, 19 Apr 2019 17:46:33 +0000 Subject: [PATCH 013/155] add the option ldo_enscalc_option for the program to carry out the functions of ensemble mean and recenter --- src/enkf/enkf_main.f90 | 8 +++++-- src/enkf/loadbal.f90 | 53 ++++++++++++++++++++++++++++++++++++++++++ src/enkf/params.f90 | 5 +++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/enkf/enkf_main.f90 b/src/enkf/enkf_main.f90 index fd9e54b4e5..fc07c514a7 100644 --- a/src/enkf/enkf_main.f90 +++ b/src/enkf/enkf_main.f90 @@ -75,7 +75,7 @@ program enkf_main ! reads namelist parameters. use params, only : read_namelist,letkf_flag,readin_localization,lupd_satbiasc,& numiter, nanals, lupd_obspace_serial, write_spread_diag, & - lobsdiag_forenkf, netcdf_diag, fso_cycling + lobsdiag_forenkf, ldo_enscalc_option, netcdf_diag, fso_cycling ! mpi functions and variables. use mpisetup, only: mpi_initialize, mpi_initialize_io, mpi_cleanup, nproc, & mpi_wtime, mpi_comm_world @@ -153,7 +153,7 @@ program enkf_main ! read obs, initial screening. t1 = mpi_wtime() - call readobs() + if(ldo_enscalc_option==0) call readobs() t2 = mpi_wtime() if (nproc == 0) print *,'time in read_obs =',t2-t1,'on proc',nproc @@ -166,10 +166,12 @@ program enkf_main endif ! print innovation statistics for prior on root task. + if(ldo_enscalc_option==0) then if (nproc == 0) then print *,'innovation statistics for prior:' call print_innovstats(obfit_prior, obsprd_prior) end if + end if ! read state/control vector info from anavinfo call init_controlvec() @@ -203,6 +205,7 @@ program enkf_main t1 = mpi_wtime() ! state and bias correction coefficient update iteration. + if(ldo_enscalc_option ==0 ) then if(letkf_flag) then ! do ob space update using serial filter if desired if (lupd_obspace_serial) call enkf_update() @@ -256,6 +259,7 @@ program enkf_main call obsmod_cleanup() t1 = mpi_wtime() + end if ! ldo_enscalc_option call gather_chunks() t2 = mpi_wtime() if (nproc == 0) print *,'time in gather_chunks =',t2-t1,'on proc',nproc diff --git a/src/enkf/loadbal.f90 b/src/enkf/loadbal.f90 index c278ef2915..36bc14b0eb 100644 --- a/src/enkf/loadbal.f90 +++ b/src/enkf/loadbal.f90 @@ -140,6 +140,7 @@ subroutine load_balance() ! Uses "Graham's rule", which simply ! stated, assigns each new work item to the task that currently has the ! smallest load. +use params, only: ldo_enscalc_option implicit none integer(i_kind), allocatable, dimension(:) :: rtmp,numobs !real(r_single), allocatable, dimension(:) :: buffer @@ -177,6 +178,7 @@ subroutine load_balance() numptsperproc = 0 np = 0 test_loadbal = .false. ! simple partition for testing +if(ldo_enscalc_option .ne. 0 ) test_loadbal=.true. do n=1,npts if (test_loadbal) then ! use simple partition (does not use estimated workload) for testing @@ -393,6 +395,8 @@ subroutine scatter_chunks ! decomposition from load_balance use controlvec, only: ncdim, grdin use params, only: nbackgrounds +use params, only: ldo_enscalc_option + implicit none integer(i_kind), allocatable, dimension(:) :: scounts, displs, rcounts @@ -454,6 +458,7 @@ subroutine scatter_chunks mpi_real4, mpi_comm_world, ierr) !==> compute ensemble of first guesses on each task, remove mean from anal. +if(ldo_enscalc_option ==0) then !regular enkf run !$omp parallel do schedule(dynamic,1) private(nn,i,nanal,n) do nn=1,ncdim do i=1,numptsperproc(nproc+1) @@ -471,6 +476,54 @@ subroutine scatter_chunks end do end do !$omp end parallel do +else if (ldo_enscalc_option ==1 ) then !to calculate ensemble mean +do nn=1,ncdim + do i=1,numptsperproc(nproc+1) + do nanal=1,nanals + n = ((nanal-1)*ncdim + (nn-1))*npts_max + i + anal_chunk(nanal,i,nn,nb) = recvbuf(n) + enddo + ensmean_chunk(i,nn,nb) = sum(anal_chunk(:,i,nn,nb))/float(nanals) + ensmean_chunk_prior(i,nn,nb) = ensmean_chunk(i,nn,nb) +! remove mean from ensemble. + do nanal=2,nanals + anal_chunk(nanal,i,nn,nb) = anal_chunk(nanal,i,nn,nb)-ensmean_chunk(i,nn,nb) + anal_chunk_prior(nanal,i,nn,nb)=anal_chunk(nanal,i,nn,nb) + end do + anal_chunk(1,i,nn,nb) =ensmean_chunk(i,nn,nb)- anal_chunk(1,i,nn,nb) + anal_chunk_prior(1,i,nn,nb)=0.0 + end do +end do +!$omp end parallel do + +else if (ldo_enscalc_option ==2 ) then !to recentter , the first member is the control run +do nn=1,ncdim + do i=1,numptsperproc(nproc+1) + do nanal=1,nanals + n = ((nanal-1)*ncdim + (nn-1))*npts_max + i + anal_chunk(nanal,i,nn,nb) = recvbuf(n) + enddo + ensmean_chunk(i,nn,nb) = sum(anal_chunk(2:nanals,i,nn,nb))/float(nanals-1) + ensmean_chunk_prior(i,nn,nb) = ensmean_chunk(i,nn,nb) +! remove mean from ensemble. + do nanal=2,nanals + anal_chunk(nanal,i,nn,nb) = (anal_chunk(1,i,nn,nb)-ensmean_chunk(i,nn,nb)) + end do + do nanal=2,nanals + anal_chunk_prior(nanal,i,nn,nb)=0.0 + enddo + anal_chunk(1,i,nn,nb) = 0.0 + anal_chunk_prior(1,i,nn,nb)=0.0 + end do +end do +!$omp end parallel do + +else +write(6,*)'this ldo_enscalc_option = ',ldo_enscalc_option,' is not available now' + +endif + + enddo ! loop over nbackgrounds diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index a3df212f79..3f2dc48d75 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -180,6 +180,9 @@ module params ! if true, use jacobian from GSI stored in diag file to compute ! ensemble perturbations in observation space. logical,public :: lobsdiag_forenkf = .false. +integer (i_kind), public :: ldo_enscalc_option = 0 +! true, the program will be used to calculate ensemble mean (=1) or recenter(=2) + ! if true, use netcdf diag files, otherwise use binary diags logical,public :: netcdf_diag = .false. @@ -205,7 +208,7 @@ module params paoverpb_thresh,latbound,delat,pseudo_rh,numiter,biasvar,& lupd_satbiasc,cliptracers,simple_partition,adp_anglebc,angord,& newpc4pred,nmmb,nhr_anal,nhr_state, fhr_assim,nbackgrounds,nstatefields, & - save_inflation,nobsl_max,lobsdiag_forenkf,netcdf_diag,& + save_inflation,nobsl_max,lobsdiag_forenkf, ldo_enscalc_option,netcdf_diag,& letkf_flag,massbal_adjust,use_edges,emiss_bc,iseed_perturbed_obs,npefiles,& getkf,getkf_inflation,denkf,modelspace_vloc,dfs_sort,write_spread_diag,& fso_cycling,fso_calculate,imp_physics,lupp,fv3_native From c914dbe5dc7a458ee0fea11a25c6da320fb1d5d9 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 1 May 2019 22:49:39 +0000 Subject: [PATCH 014/155] some updates while a problem is to be investigated for T --- src/enkf/controlvec.f90 | 8 + src/enkf/fv3_netcdf_mod.F90 | 8 + src/enkf/gridinfo_fv3reg.f90 | 77 +++++--- src/enkf/gridio_fv3reg.f90 | 245 ++++++++++++++++++------ src/enkf/loadbal.f90 | 5 +- src/enkf/params.f90 | 16 +- src/enkf/write_fv3regional_restarts.f90 | 3 +- 7 files changed, 260 insertions(+), 102 deletions(-) diff --git a/src/enkf/controlvec.f90 b/src/enkf/controlvec.f90 index 67fa9b57b5..369b09a5e7 100644 --- a/src/enkf/controlvec.f90 +++ b/src/enkf/controlvec.f90 @@ -267,6 +267,8 @@ subroutine write_control(no_inflate_flag) ! gather ens. mean anal. increment on root, print out max/mins. call mpi_reduce(grdin(:,:,nb), grdin_mean, npts*ncdim, mpi_real4, & mpi_sum,0,mpi_comm_io,ierr) + write(6,*)'thinkdeb2200 1' + call flush(6) if (nproc == 0) then grdin_mean = grdin_mean/real(nanals) do nvar=1,nc3d @@ -281,6 +283,8 @@ subroutine write_control(no_inflate_flag) enddo endif enddo + write(6,*)'thinkdeb2200 2' + call flush(6) if (nproc == 0) then deallocate(grdin_mean) @@ -288,6 +292,8 @@ subroutine write_control(no_inflate_flag) print *,'time to gather ens mean increment on root',t2-t1,'secs' endif + write(6,*)'thinkdeb2200 3' + call flush(6) t1 = mpi_wtime() q_ind = getindex(cvars3d, 'q') @@ -298,6 +304,8 @@ subroutine write_control(no_inflate_flag) grdin(:,(q_ind-1)*nlevs+1:q_ind*nlevs,nb)*qsat(:,:,nb) enddo end if + write(6,*)'thinkdeb2200 4' + call flush(6) call writegriddata(nanal,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin,no_inflate_flag) if (nproc == 0) then t2 = mpi_wtime() diff --git a/src/enkf/fv3_netcdf_mod.F90 b/src/enkf/fv3_netcdf_mod.F90 index f5c4761e12..696ae841d9 100644 --- a/src/enkf/fv3_netcdf_mod.F90 +++ b/src/enkf/fv3_netcdf_mod.F90 @@ -19,6 +19,7 @@ subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) end subroutine read_fv3_restart_data1d subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) @@ -29,6 +30,7 @@ subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) end subroutine read_fv3_restart_data2d subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) @@ -39,6 +41,8 @@ subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1) end subroutine read_fv3_restart_data3d subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) @@ -49,6 +53,10 @@ subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id include "read_fv3_restart_data.f90" + data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & + ubound(data_arr,3):lbound(data_arr,3):-1,lbound(data_arr,4):ubound(data_arr,4)) +!Notice, the 4th dimension is not reversed + end subroutine read_fv3_restart_data4d end module fv3_netcdf_mod diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 443fb93de9..f8610a0d25 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -67,7 +67,7 @@ module gridinfo integer,public :: npts integer,public :: ntrunc ! supported variable names in anavinfo -character(len=max_varname_length),public, dimension(10) :: vars3d_supported = (/'u ', 'v ', 'tv ', 'q ', 'oz ', 'cw ', 'tsen', 'prse', 'ql ', 'qi '/) +character(len=max_varname_length),public, dimension(8) :: vars3d_supported = (/'u ', 'v ', 't ', 'q ', 'oz ', 'cw ', 'tsen', 'prse' /) character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) ! supported variable names in anavinfo real(r_single), allocatable, dimension(:) :: ak,bk,eta1_ll,eta2_ll @@ -113,33 +113,13 @@ subroutine getgridinfo(fileprefix, reducedgrid) ! read ak,bk from ensmean fv_core.res.nc ! read nx,ny and nz from fv_core.res.nc - filename = trim(adjustl(fileprefix))//'/ensmean/INPUT/fv_core.res.nc' + filename = 'fv3sar_tile1_akbk.nc' call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& myname_,'open: '//trim(adjustl(filename)) ) - call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& myname_,'inq_dimid xaxis_1 '//trim(filename) ) - call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nx_tile),& - myname_,'inquire_dimension xaxis_1 '//trim(filename) ) - if(nx_res.ne.nx_tile) then - write(6,*)'the readin nx_tile does not equal to nx_res as expected, stop' - call stop2(25) - endif - - call nc_check( nf90_inq_dimid(file_id,'yaxis_1',dim_id),& - myname_,'inq_dimid yaxis_1 '//trim(filename) ) - call nc_check( nf90_inquire_dimension(file_id,dim_id,len=ny_tile),& - myname_,'inquire_dimension yaxis_1 '//trim(filename) ) - if(ny_res.ne.ny_tile) then - write(6,*)'the readin ny_tile does not equal to ny_res as expected, stop' - call stop2(25) - endif - - - call nc_check( nf90_inq_dimid(file_id,'zaxis_1',dim_id),& - myname_,'inq_dimid zaxis_1 '//trim(filename) ) call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1n),& - myname_,'inquire_dimension zaxis_1 '//trim(filename) ) + myname_,'inquire_dimension xaxis_1 '//trim(filename) ) if(nlevsp1n.ne.nlevsp1) then write(6,*)'the configure nlevsp1 is not consistent with the parameter & read from the data files, stop' @@ -149,6 +129,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) allocate(ak(nlevsp1),bk(nlevsp1)) + allocate(eta1_ll(nlevsp1),eta2_ll(nlevsp1)) call read_fv3_restart_data1d('ak',filename,file_id,ak) call read_fv3_restart_data1d('bk',filename,file_id,bk) @@ -163,6 +144,33 @@ subroutine getgridinfo(fileprefix, reducedgrid) ptop = eta1_ll(nlevsp1) + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) +!cltorg filename = trim(adjustl(fileprefix))//'/ensmean/INPUT/fv_core.res.nc' + filename = 'fv3sar_tile1_grid_spec.nc' + call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(filename)) ) + + call nc_check( nf90_inq_dimid(file_id,'grid_xt',dim_id),& + myname_,'inq_dimid grid_xt '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nx_tile),& + myname_,'inquire_dimension grid_xt '//trim(filename) ) + if(nx_res.ne.nx_tile) then + write(6,*)"nx_tile and nx_res are ",nx_tile,nx_res + write(6,*)'the readin nx_tile does not equal to nx_res as expected, stop' + call stop2(25) + endif + + call nc_check( nf90_inq_dimid(file_id,'grid_yt',dim_id),& + myname_,'inq_dimid grid_yt '//trim(filename) ) + call nc_check( nf90_inquire_dimension(file_id,dim_id,len=ny_tile),& + myname_,'inquire_dimension grid_yt '//trim(filename) ) + if(ny_res.ne.ny_tile) then + write(6,*)'the readin ny_tile does not equal to ny_res as expected, stop' + call stop2(25) + endif + + ! read lats/lons from C###_oro_data.tile#.nc ! (this requires path to FV3 fix dir) @@ -175,7 +183,8 @@ subroutine getgridinfo(fileprefix, reducedgrid) nn_tile0=(ntile-1)*nx_res*ny_res write(char_tile, '(i1)') ntile !cltorg filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' - filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_nxres))//'/C'//trim(adjustl(char_nyres))//'grid_spec.tile'//char_tile//'.nc' +!clt filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_nxres))//'/C'//trim(adjustl(char_nyres))//'grid_spec.tile'//char_tile//'.nc' + filename='fv3sar_tile'//char_tile//'_grid_spec.nc' call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& myname_,'open: '//trim(adjustl(filename)) ) call read_fv3_restart_data2d('grid_lont',filename,file_id,lon_tile) @@ -197,14 +206,17 @@ subroutine getgridinfo(fileprefix, reducedgrid) lonsgrd = pi*lonsgrd/180._r_single !cltthink the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) + allocate(g_prsi(nx_res,ny_res,nlevsp1)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) + allocate(spressmn(npts)) nn = 0 do ntile=1,ntiles nn_tile0=(ntile-1)*nx_res*ny_res nn=nn_tile0 write(char_tile, '(i1)') ntile !cltorg filename = trim(adjustl(datapath))//'/ensmean/fv_core.res.tile'//char_tile//'.nc' - filename = trim(adjustl(datapath))//'/ensmean/dynvars.tile'//char_tile//'.nc' +!clt filename = trim(adjustl(datapath))//'/ensmean/dynvars.tile'//char_tile//'.nc' + filename = 'fv3sar_tile'//char_tile//"_ensmean.dynvartracer" !print *,trim(adjustl(filename)) call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& myname_,'open: '//trim(adjustl(filename)) ) @@ -238,7 +250,6 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo enddo enddo - deallocate(delp,ak,bk,ps) do k=1,nlevs nn=nn_tile0 do j=1,ny_res @@ -259,17 +270,18 @@ subroutine getgridinfo(fileprefix, reducedgrid) end do logp(:,nlevs_pres) = -log(spressmn(:)) deallocate(spressmn,presslmn,pressimn) + deallocate(ak,bk,ps) deallocate(g_prsi,delp) - deallocate(eta1_ll,eta2_ll,ak,bk) - deallocate(lat_tile,lon_tile,ps) - +!cltorg deallocate(eta1_ll,eta2_ll,ak,bk) + deallocate(lat_tile,lon_tile) endif ! root task + allocate(gridloc(3,npts)) if (nproc .ne. 0) then ! allocate arrays on other (non-root) tasks allocate(latsgrd(npts),lonsgrd(npts)) allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers - allocate(gridloc(3,npts)) + allocate(eta1_ll(nlevsp1),eta2_ll(nlevsp1)) endif !call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) do k=1,nlevs_pres @@ -277,6 +289,8 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo call mpi_bcast(lonsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) call mpi_bcast(latsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) +call mpi_bcast(eta1_ll,nlevsp1,mpi_real4,0,MPI_COMM_WORLD,ierr) +call mpi_bcast(eta2_ll,nlevsp1,mpi_real4,0,MPI_COMM_WORLD,ierr) !clt ptop tothink to be defined call mpi_bcast(ptop,1,mpi_real4,0,MPI_COMM_WORLD,ierr) @@ -286,7 +300,8 @@ subroutine getgridinfo(fileprefix, reducedgrid) gridloc(2,nn) = cos(latsgrd(nn))*sin(lonsgrd(nn)) gridloc(3,nn) = sin(latsgrd(nn)) end do - +write(6,*)'end of getgridinfo ' +call flush(6) end subroutine getgridinfo subroutine gridinfo_cleanup() diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index b5d0775bb0..b397e132de 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -85,21 +85,22 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi character(len=4) char_nxres character(len=4) char_nyres - character(len=4) char_tile - character(len=24),parameter :: myname_ = 'fv3: getgridinfo' + character(len=1) char_tile + character(len=24),parameter :: myname_ = 'fv3: getgriddata' ! Define counting variables integer :: nlevsp1 integer :: i,j, k,nn,ntile,nn_tile0, nb integer :: u_ind, v_ind, tv_ind,tsen_ind, q_ind, oz_ind integer :: ps_ind, sst_ind + integer :: tmp_ind logical :: ice !====================================================================== nlevsp1=nlevs+1 u_ind = getindex(vars3d, 'u') !< indices in the state var arrays v_ind = getindex(vars3d, 'v') ! U and V (3D) - tv_ind = getindex(vars3d, 'tv') ! Tv (3D) + tv_ind = getindex(vars3d, 't') ! Tv (3D) q_ind = getindex(vars3d, 'q') ! Q (3D) oz_ind = getindex(vars3d, 'oz') ! Oz (3D) tsen_ind = getindex(vars3d, 'tsen') !sensible T (3D) @@ -112,6 +113,7 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi allocate(workvar3d(nx_res,ny_res,nlevs)) allocate(qworkvar3d(nx_res,ny_res,nlevs)) allocate(qsatworkvar3d(nx_res,ny_res,nlevs)) + allocate(tvworkvar3d(nx_res,ny_res,nlevs)) if (ntimes > 1) then write(6,*)'gridio/readgriddata: reading multiple backgrounds not yet supported' @@ -130,21 +132,23 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi nn_tile0=(ntile-1)*nx_res*ny_res write(char_tile, '(i1)') ntile - filename = trim(adjustl(datapath))//trim(adjustl(fileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) +!cltorg filename = trim(adjustl(datapath))//trim(adjustl(fileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) + filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) + fv3filename=trim(adjustl(filename))//"_dynvartracer" !---------------------------------------------------------------------- ! read u-component - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) if (u_ind > 0) then - allocate(uworkvar3d(nx_res+1,ny_res,nlevs)) + allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) varstrname = 'u' - call read_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -163,9 +167,9 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi deallocate(uworkvar3d) endif if (v_ind > 0) then - allocate(vworkvar3d(nx_res,ny_res+1,nlevs)) + allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) varstrname = 'v' - call read_fv3_restart_data3d(varstrname,filename,file_id,vworkvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -186,12 +190,10 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi if (tv_ind > 0.or.tsen_ind) then allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) - varstrname = 't' - call read_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) - if(tv_ind >0 .or. q_ind>0) then - allocate(qworkvar3d(nx_res,ny_res,nlevs)) + varstrname = 'T' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) if (q_ind > 0) then @@ -212,7 +214,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo endif - endif if(tv_ind > 0) then do k=1,nlevs do j=1,ny_res @@ -221,20 +222,22 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo enddo enddo + tvworkvar3d=workvar3d + write(6,*)'thinkdeb999 tv (10,10,10)readin is ',tvworkvar3d(10,10,10),qworkvar3d(10,10,10) else! tsen_id >0 workvar3d=tsenworkvar3d endif - + tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 do k=1,nlevs nn = nn_tile0 do j=1,ny_res do i=1,nx_res nn=nn+1 - vargrid(nn,levels(tv_ind-1)+k,nb)=workvar3d(i,j,k) + vargrid(nn,levels(tmp_ind-1)+k,nb)=workvar3d(i,j,k) enddo enddo enddo - do k = levels(tv_ind-1)+1, levels(tv_ind) + do k = levels(tmp_ind-1)+1, levels(tmp_ind) if (nproc .eq. 0) & write(6,*) 'READFVregional : t ', & & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) @@ -247,7 +250,7 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi if (oz_ind > 0) then varstrname = 'o3mr' - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -264,9 +267,11 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo endif + write(6,*)'thinkdeb220 1' + call flush(6) call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) + myname_,'close '//trim(fv3filename) ) ! set SST to zero for now if (sst_ind > 0) then vargrid(:,levels(n3d)+sst_ind,nb) = zero @@ -275,24 +280,26 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi !---------------------------------------------------------------------- ! Allocate memory for variables computed within routine + write(6,*)'thinkdeb220 2 ps_ind ',ps_ind + call flush(6) if (ps_ind > 0) then - allocate(workprsi(nx_res,ny_res,nlevs)) + allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) - varstrname = 'u' - fv3filename=trim(adjustl(filename))//"_dynvars" + fv3filename=trim(adjustl(filename))//"_dynvartracer" call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& myname_,'open: '//trim(adjustl(fv3filename)) ) - call read_fv3_restart_data3d('delp',filename,file_id,workvar3d) !cltto think different files be used + call read_fv3_restart_data3d('delp',fv3filename,file_id,workvar3d) !cltto think different files be used !print *,'min/max delp',ntile,minval(delp),maxval(delp) call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - workprsi(:,:,nlevsp1+1)=eta1_ll(nlevsp1) !etal_ll is needed + myname_,'close '//trim(fv3filename) ) + workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed do i=nlevs,1,-1 workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) enddo pswork(:,:)=workprsi(:,:,1) + write(6,*)'thinkdeb1000readin ps ptop is ',pswork(10,10),workprsi(10,10,nlevsp1) @@ -300,11 +307,11 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi do j=1,ny_res do i=1,nx_res nn=nn+1 - vargrid(nn,levels(ps_ind-1), nb) =pswork(i,j) + vargrid(nn,levels(n3d)+ps_ind, nb) =pswork(i,j) enddo enddo - + @@ -315,8 +322,10 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo enddo enddo - allocate(qsatworkvar3d(nx_res,ny_res,nlevs)) ice=.true. !tothink + write(6,*)'thinkdeb220 3, pesudo_rh is ',pseudo_rh + write(6,*)' q qsat ps, tv are ',qworkvar3d(10,10,10), qsatworkvar3d(10,10,10), workvar3d(10,10,10),tvworkvar3d(10,10,10) + call flush(6) if (pseudo_rh) then call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & nx_res*ny_res,nlevs) @@ -344,6 +353,8 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) endif + write(6,*)'thinkdeb220 10' + call flush(6) !====================================================================== ! Deallocate memory if(allocated(workvar3d)) deallocate(workvar3d) @@ -366,8 +377,9 @@ end subroutine readgriddata subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) use constants, only: zero, one,fv,half + use gridinfo,only: ak,bk,eta1_ll,eta2_ll,ptop use params, only: nbackgrounds, anlfileprefixes, fgfileprefixes - use params, only: nx_res,ny_res,nlevs,ntiles + use params, only: nx_res,ny_res,nlevs,ntiles,l_pres_add_saved use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_inq_dimid,nf90_inq_varid use netcdf, only: nf90_write,nf90_write,nf90_inquire,nf90_inquire_dimension @@ -388,27 +400,30 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl ! Define variables computed within subroutine character(len=500) :: filename character(len=:),allocatable :: fv3filename - character(len=3) :: charnanal + character(len=7) :: charnanal !---------------------------------------------------------------------- integer(i_kind) :: u_ind, v_ind, tv_ind, tsen_ind,q_ind, ps_ind,oz_ind integer(i_kind) :: w_ind, cw_ind, ph_ind integer(i_kind) file_id,var_id,dim_id - real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,uworkvar3d,& + real(r_single), dimension(:,:), allocatable ::pswork + real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,workinc3d2,uworkvar3d,& vworkvar3d,qvarworkvar3d,tvworkvar3d,tsenworkvar3d,& workprsi,qworkvar3d + !---------------------------------------------------------------------- ! Define variables required by for extracting netcdf variable ! fields character(len=19) :: DateStr + integer :: nlevsp1 ! Define variables required for netcdf variable I/O character(len=12) :: varstrname character(len=4) char_nxres character(len=4) char_nyres - character(len=4) char_tile + character(len=1) char_tile character(len=:),allocatable:: varname - character(len=24),parameter :: myname_ = 'fv3: getgridinfo' + character(len=24),parameter :: myname_ = 'fv3: writegriddata' !---------------------------------------------------------------------- ! Define counting variables @@ -416,13 +431,13 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl - real(r_single) :: ptop !---------------------------------------------------------------------- + nlevsp1=nlevs+1 u_ind = getindex(vars3d, 'u') !< indices in the state var arrays v_ind = getindex(vars3d, 'v') ! U and V (3D) - tv_ind = getindex(vars3d, 'tv') ! Tv (3D) + tv_ind = getindex(vars3d, 't') ! Tv (3D) tsen_ind = getindex(vars3d, 'tsen') ! Tv (3D) q_ind = getindex(vars3d, 'q') ! Q (3D) cw_ind = getindex(vars3d, 'cw') ! CWM for WRF-NMM @@ -441,34 +456,45 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl endif backgroundloop: do nb=1,nbackgrounds + allocate(workinc3d(nx_res,ny_res,nlevs),workinc3d2(nx_res,ny_res,nlevsp1)) + allocate(workvar3d(nx_res,ny_res,nlevs)) + allocate(qworkvar3d(nx_res,ny_res,nlevs)) + allocate(tvworkvar3d(nx_res,ny_res,nlevs)) + + + write(6,*)'thinkdeb2200 10 nanal ',nanal + call flush(6) !---------------------------------------------------------------------- ! First guess file should be copied to analysis file at scripting ! level; only variables updated by EnKF are changed - write(charnanal,'(i3.3)') nanal - filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal - call nc_check( nf90_open(trim(adjustl(filename)),nf90_write,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) + write(charnanal,'(a3, i3.3)') 'mem', nanal +!cltorg filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) do ntile=1,ntiles nn_tile0=(ntile-1)*nx_res*ny_res write(char_tile, '(i1)') ntile +!cltorg filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) + filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) + fv3filename=trim(adjustl(filename))//"_dynvartracer" - filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) !---------------------------------------------------------------------- ! read u-component - call nc_check( nf90_open(trim(adjustl(filename)),nf90_write,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_write,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) ! update CWM for WRF-NMM if (u_ind > 0) then varstrname = 'u' + allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) - call read_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + write(6,*)'thinkdeb220 11 nn_tile0 ',nn_tile0 + call flush(6) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -478,16 +504,26 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - uworkvar3d(1:nx_res,:,:)=workvar3d+workinc3d - uworkvar3d(nx_res+1,:,:)=uworkvar3d(nx_res,:,:) - call write_fv3_restart_data3d(varstrname,filename,file_id,uworkvar3d) + write(6,*)'thinkdeb220 12' + call flush(6) + uworkvar3d(:,1:ny_res,:)=workvar3d+workinc3d + uworkvar3d(:,ny_res+1,:)=uworkvar3d(:,ny_res,:) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) + deallocate(uworkvar3d) + write(6,*)'thinkdeb220 13' + call flush(6) endif if (v_ind > 0) then varstrname = 'v' + allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) + write(6,*)'thinkdeb220 14' + call flush(6) - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) + write(6,*)'thinkdeb220 15' + call flush(6) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -497,14 +533,17 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - vworkvar3d(:,1:ny_res,:)=workvar3d+workinc3d - vworkvar3d(:,ny_res+1,:)=vworkvar3d(:,ny_res,:) - call write_fv3_restart_data3d(varstrname,filename,file_id,vworkvar3d) + vworkvar3d(1:nx_res,:,:)=workvar3d+workinc3d + vworkvar3d(nx_res+1,:,:)=vworkvar3d(nx_res,:,:) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) + deallocate(vworkvar3d) endif + write(6,*)'thinkdeb220 20' + call flush(6) if (tv_ind > 0.or.tsen_ind>0 ) then - varstrname = 't' + varstrname = 'T' if(tsen_ind>0) then do k=1,nlevs nn = nn_tile0 @@ -515,9 +554,9 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) workvar3d=workvar3d+workinc3d - call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) else ! tv_ind >0 do k=1,nlevs nn = nn_tile0 @@ -529,10 +568,20 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo - call read_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) - call read_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) - tvworkvar3d=tsenworkvar3d*qworkvar3d + write(6,*)'thinkdeb220 23' + call flush(6) + varstrname = 'T' + allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + write(6,*)'thinkdeb999 tsenv (10,10,10)readinagain is ',tsenworkvar3d(10,10,10) + write(6,*)'thinkdeb999 tv workinc (10,10,10)readinagain is ',workinc3d(10,10,10) + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) + write(6,*)'thinkdeb999 tv q (10,10,10)readinagain is ',qworkvar3d(10,10,10) + tvworkvar3d=tsenworkvar3d*(one+fv*qworkvar3d) + write(6,*)'thinkdeb999 bg tv readin (10,10,10)readinagain is ',tvworkvar3d(10,10,10) tvworkvar3d=tvworkvar3d+workinc3d + write(6,*)'thinkdeb999 anl tv towritout (10,10,10)readinagain is ',tvworkvar3d(10,10,10) if(q_ind > 0) then do k=1,nlevs nn = nn_tile0 @@ -545,23 +594,36 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo qworkvar3d=qworkvar3d+workinc3d endif - tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d(i,j,k)) - call write_fv3_restart_data3d(varstrname,filename,file_id,tsenworkvar3d) + tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d) + varstrname = 'T' + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : T ', & + & k, minval(tsenworkvar3d(:,:,k)), maxval(tsenworkvar3d(:,:,k)) + enddo + + + + if(q_ind>0) then varname='sphum' - call write_fv3_restart_data3d(varstrname,filename,file_id,qworkvar3d) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) endif + deallocate(tsenworkvar3d) endif endif + write(6,*)'thinkdeb220 30' + call flush(6) if (oz_ind > 0) then varstrname = 'o3mr' - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -572,15 +634,72 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo workvar3d=workvar3d+workinc3d - call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) endif + if (ps_ind > 0) then + allocate(workprsi(nx_res,ny_res,nlevsp1)) + allocate(pswork(nx_res,ny_res)) + call read_fv3_restart_data3d('delp',filename,file_id,workvar3d) !cltto + !print *,'min/max delp',ntile,minval(delp),maxval(delp) + workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed + do i=nlevs,1,-1 + workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) + enddo + + write(6,*)'thinkdeb1000readin 2 ps ptop is ',workprsi(10,10,1),workprsi(10,10,nlevsp1) + + + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + pswork(i,j)=vargrid(nn,levels(n3d)+ps_ind,nb ) + enddo + enddo + write(6,*)'thinkdeb1000 l_pres_add_saved is ',l_pres_add_saved + if(l_pres_add_saved) then + do k=1,nlevs+1 + do j=1,ny_res + do i=1,nx_res + workinc3d2(i,j,k)=eta2_ll(k)*pswork(i,j) + enddo + enddo + enddo + workprsi=workprsi+workinc3d2 + else + workprsi(:,:,1)=workprsi(:,:,1)+pswork + do k=2,nlevsp1 + workprsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*workprsi(:,:,1) + enddo + endif + do k=1,nlevs + workvar3d(:,:,k)=(workprsi(:,:,k)-workprsi(:,:,k+1))*100.0 + enddo + + write(6,*)'thinkdeb1000write ps ptop is ',workprsi(10,10,1),workprsi(10,10,nlevsp1) + + call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + endif + + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(filename) ) !---------------------------------------------------------------------- ! update time stamp is to be considered NSTART_HOUR in NMM (HWRF) restart file. !====================================================================== end do ! tiles + if(allocated(workinc3d)) deallocate(workinc3d) + if(allocated(workinc3d2)) deallocate(workinc3d2) + if(allocated(workprsi)) deallocate(workprsi) + if(allocated(pswork)) deallocate(pswork) + if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) + if(allocated(qworkvar3d)) deallocate(qworkvar3d) + + + + end do backgroundloop ! loop over backgrounds to read in ! Return calculated values diff --git a/src/enkf/loadbal.f90 b/src/enkf/loadbal.f90 index 36bc14b0eb..cb4ab979d1 100644 --- a/src/enkf/loadbal.f90 +++ b/src/enkf/loadbal.f90 @@ -240,7 +240,8 @@ subroutine load_balance() end do ! for serial filter, partition obs for observation space update. -if (.not. letkf_flag .or. lupd_obspace_serial) then +!cltorg if (.not. letkf_flag .or. lupd_obspace_serial) then +if ((.not. letkf_flag .or. lupd_obspace_serial).and.ldo_enscalc_option==0) then allocate(numobsperproc(numproc)) allocate(iprocob(nobstot)) ! default is to partition obs simply, since @@ -477,6 +478,7 @@ subroutine scatter_chunks end do !$omp end parallel do else if (ldo_enscalc_option ==1 ) then !to calculate ensemble mean +!$omp parallel do schedule(dynamic,1) private(nn,i,nanal,n) do nn=1,ncdim do i=1,numptsperproc(nproc+1) do nanal=1,nanals @@ -497,6 +499,7 @@ subroutine scatter_chunks !$omp end parallel do else if (ldo_enscalc_option ==2 ) then !to recentter , the first member is the control run +!$omp parallel do schedule(dynamic,1) private(nn,i,nanal,n) do nn=1,ncdim do i=1,numptsperproc(nproc+1) do nanal=1,nanals diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index 3f2dc48d75..68e47bdab2 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -187,10 +187,11 @@ module params logical,public :: netcdf_diag = .false. ! use fv3 cubed-sphere tiled restart files -logical,public :: fv3_native = .false. +logical,public :: fv3_native = .true. character(len=500),public :: fv3fixpath = ' ' integer(i_kind),public :: ntiles=6 integer(i_kind),public :: nx_res=0,ny_res=0 +logical,public ::l_pres_add_saved=.true. namelist /nam_enkf/datestring,datapath,iassim_order,nvars,& covinflatemax,covinflatemin,deterministic,sortinc,& @@ -214,7 +215,7 @@ module params fso_cycling,fso_calculate,imp_physics,lupp,fv3_native namelist /nam_wrf/arw,nmm,nmm_restart -namelist /nam_fv3/fv3fixpath,nx_res,ny_res,ntiles +namelist /nam_fv3/fv3fixpath,nx_res,ny_res,ntiles,l_pres_add_saved namelist /satobs_enkf/sattypes_rad,dsis namelist /ozobs_enkf/sattypes_oz @@ -342,8 +343,6 @@ subroutine read_namelist() ! read from namelist file, doesn't seem to work from stdin with mpich open(912,file='enkf.nml',form="formatted") read(912,nam_enkf) -read(912,satobs_enkf) -read(912,ozobs_enkf) if (regional) then read(912,nam_wrf) endif @@ -351,6 +350,8 @@ subroutine read_namelist() read(912,nam_fv3) nlons = nx_res; nlats = ny_res ! (total number of pts = ntiles*res*res) endif +read(912,satobs_enkf) +read(912,ozobs_enkf) close(912) ! find number of satellite files @@ -478,10 +479,13 @@ subroutine read_namelist() print *, 'must select either arw, nmm or nmmb regional dynamical core' call stop2(19) endif - if (fv3_native .and. (fv3fixpath == ' ' .or. nx_res == 0.or.ny_res)) then - print *, 'must specify nx_res,ny_res and fv3fixpath when fv3_native is true' + if (fv3_native .and. (nx_res == 0.or.ny_res == 0)) then + print *, 'must specify nx_res,ny_res when fv3_native is true' call stop2(19) endif + if(ldo_enscalc_option .ne.0 ) then + l_pres_add_saved=.false. + endif if (letkf_flag .and. univaroz) then print *,'univaroz is not supported in LETKF!' call stop2(19) diff --git a/src/enkf/write_fv3regional_restarts.f90 b/src/enkf/write_fv3regional_restarts.f90 index 9e83469a47..c5e13d9009 100644 --- a/src/enkf/write_fv3regional_restarts.f90 +++ b/src/enkf/write_fv3regional_restarts.f90 @@ -59,7 +59,8 @@ subroutine write_fv3_restart_data4d(varname,filename,file_id,data_arr) integer(i_kind), intent(in) :: file_id integer(i_kind) :: var_id data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1,ubound(data_arr,4):lbound(data_arr,4):-1) + ubound(data_arr,3):lbound(data_arr,3):-1,lbound(data_arr,4):ubound(data_arr,4)) +!Notice, the 4th dimension is not reversed include "write_fv3_restart_data.f90" end subroutine write_fv3_restart_data4d From d837a492a4ce2ec5504f4157d68e86ea0a9dd12e Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 2 May 2019 13:48:18 +0000 Subject: [PATCH 015/155] fixed a bug which made the sphum were written to T in the output --- src/enkf/gridio_fv3reg.f90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index b397e132de..4e47818d3c 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -422,7 +422,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl character(len=4) char_nxres character(len=4) char_nyres character(len=1) char_tile - character(len=:),allocatable:: varname character(len=24),parameter :: myname_ = 'fv3: writegriddata' !---------------------------------------------------------------------- @@ -607,9 +606,14 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl if(q_ind>0) then - varname='sphum' + varstrname='sphum' call write_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : sphum ', & + & k, minval(qworkvar3d(:,:,k)), maxval(qworkvar3d(:,:,k)) + enddo endif From c586cd79384e016fa253a84098f90f473d0c52da Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Fri, 3 May 2019 22:59:22 +0000 Subject: [PATCH 016/155] deleted a few debug writing --- src/enkf/gridinfo_fv3reg.f90 | 2 -- src/enkf/gridio_fv3reg.f90 | 37 ------------------------------------ 2 files changed, 39 deletions(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index f8610a0d25..741277f3a0 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -300,8 +300,6 @@ subroutine getgridinfo(fileprefix, reducedgrid) gridloc(2,nn) = cos(latsgrd(nn))*sin(lonsgrd(nn)) gridloc(3,nn) = sin(latsgrd(nn)) end do -write(6,*)'end of getgridinfo ' -call flush(6) end subroutine getgridinfo subroutine gridinfo_cleanup() diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 4e47818d3c..91749d8ee6 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -223,7 +223,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo enddo tvworkvar3d=workvar3d - write(6,*)'thinkdeb999 tv (10,10,10)readin is ',tvworkvar3d(10,10,10),qworkvar3d(10,10,10) else! tsen_id >0 workvar3d=tsenworkvar3d endif @@ -267,8 +266,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo endif - write(6,*)'thinkdeb220 1' - call flush(6) call nc_check( nf90_close(file_id),& myname_,'close '//trim(fv3filename) ) @@ -280,8 +277,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi !---------------------------------------------------------------------- ! Allocate memory for variables computed within routine - write(6,*)'thinkdeb220 2 ps_ind ',ps_ind - call flush(6) if (ps_ind > 0) then allocate(workprsi(nx_res,ny_res,nlevsp1)) @@ -299,7 +294,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo pswork(:,:)=workprsi(:,:,1) - write(6,*)'thinkdeb1000readin ps ptop is ',pswork(10,10),workprsi(10,10,nlevsp1) @@ -323,9 +317,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo enddo ice=.true. !tothink - write(6,*)'thinkdeb220 3, pesudo_rh is ',pseudo_rh - write(6,*)' q qsat ps, tv are ',qworkvar3d(10,10,10), qsatworkvar3d(10,10,10), workvar3d(10,10,10),tvworkvar3d(10,10,10) - call flush(6) if (pseudo_rh) then call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & nx_res*ny_res,nlevs) @@ -353,8 +344,6 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) endif - write(6,*)'thinkdeb220 10' - call flush(6) !====================================================================== ! Deallocate memory if(allocated(workvar3d)) deallocate(workvar3d) @@ -462,8 +451,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl - write(6,*)'thinkdeb2200 10 nanal ',nanal - call flush(6) !---------------------------------------------------------------------- ! First guess file should be copied to analysis file at scripting ! level; only variables updated by EnKF are changed @@ -491,8 +478,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl varstrname = 'u' allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) - write(6,*)'thinkdeb220 11 nn_tile0 ',nn_tile0 - call flush(6) call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) do k=1,nlevs nn = nn_tile0 @@ -503,26 +488,18 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - write(6,*)'thinkdeb220 12' - call flush(6) uworkvar3d(:,1:ny_res,:)=workvar3d+workinc3d uworkvar3d(:,ny_res+1,:)=uworkvar3d(:,ny_res,:) call write_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) deallocate(uworkvar3d) - write(6,*)'thinkdeb220 13' - call flush(6) endif if (v_ind > 0) then varstrname = 'v' allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) - write(6,*)'thinkdeb220 14' - call flush(6) call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) - write(6,*)'thinkdeb220 15' - call flush(6) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -538,8 +515,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl deallocate(vworkvar3d) endif - write(6,*)'thinkdeb220 20' - call flush(6) if (tv_ind > 0.or.tsen_ind>0 ) then varstrname = 'T' @@ -567,20 +542,13 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo - write(6,*)'thinkdeb220 23' - call flush(6) varstrname = 'T' allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - write(6,*)'thinkdeb999 tsenv (10,10,10)readinagain is ',tsenworkvar3d(10,10,10) - write(6,*)'thinkdeb999 tv workinc (10,10,10)readinagain is ',workinc3d(10,10,10) varstrname = 'sphum' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) - write(6,*)'thinkdeb999 tv q (10,10,10)readinagain is ',qworkvar3d(10,10,10) tvworkvar3d=tsenworkvar3d*(one+fv*qworkvar3d) - write(6,*)'thinkdeb999 bg tv readin (10,10,10)readinagain is ',tvworkvar3d(10,10,10) tvworkvar3d=tvworkvar3d+workinc3d - write(6,*)'thinkdeb999 anl tv towritout (10,10,10)readinagain is ',tvworkvar3d(10,10,10) if(q_ind > 0) then do k=1,nlevs nn = nn_tile0 @@ -622,8 +590,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl endif endif - write(6,*)'thinkdeb220 30' - call flush(6) if (oz_ind > 0) then varstrname = 'o3mr' @@ -651,7 +617,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) enddo - write(6,*)'thinkdeb1000readin 2 ps ptop is ',workprsi(10,10,1),workprsi(10,10,nlevsp1) nn = nn_tile0 @@ -661,7 +626,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl pswork(i,j)=vargrid(nn,levels(n3d)+ps_ind,nb ) enddo enddo - write(6,*)'thinkdeb1000 l_pres_add_saved is ',l_pres_add_saved if(l_pres_add_saved) then do k=1,nlevs+1 do j=1,ny_res @@ -681,7 +645,6 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl workvar3d(:,:,k)=(workprsi(:,:,k)-workprsi(:,:,k+1))*100.0 enddo - write(6,*)'thinkdeb1000write ps ptop is ',workprsi(10,10,1),workprsi(10,10,nlevsp1) call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) endif From be8abe0beea1bc637625d85ef2e0be095405e7d3 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 8 May 2019 21:28:52 +0000 Subject: [PATCH 017/155] fixed a couple of bugs with code cleaning --- src/enkf/controlvec.f90 | 8 -------- src/enkf/gridinfo_fv3reg.f90 | 2 +- src/enkf/gridio_fv3reg.f90 | 10 ++++++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/enkf/controlvec.f90 b/src/enkf/controlvec.f90 index 369b09a5e7..67fa9b57b5 100644 --- a/src/enkf/controlvec.f90 +++ b/src/enkf/controlvec.f90 @@ -267,8 +267,6 @@ subroutine write_control(no_inflate_flag) ! gather ens. mean anal. increment on root, print out max/mins. call mpi_reduce(grdin(:,:,nb), grdin_mean, npts*ncdim, mpi_real4, & mpi_sum,0,mpi_comm_io,ierr) - write(6,*)'thinkdeb2200 1' - call flush(6) if (nproc == 0) then grdin_mean = grdin_mean/real(nanals) do nvar=1,nc3d @@ -283,8 +281,6 @@ subroutine write_control(no_inflate_flag) enddo endif enddo - write(6,*)'thinkdeb2200 2' - call flush(6) if (nproc == 0) then deallocate(grdin_mean) @@ -292,8 +288,6 @@ subroutine write_control(no_inflate_flag) print *,'time to gather ens mean increment on root',t2-t1,'secs' endif - write(6,*)'thinkdeb2200 3' - call flush(6) t1 = mpi_wtime() q_ind = getindex(cvars3d, 'q') @@ -304,8 +298,6 @@ subroutine write_control(no_inflate_flag) grdin(:,(q_ind-1)*nlevs+1:q_ind*nlevs,nb)*qsat(:,:,nb) enddo end if - write(6,*)'thinkdeb2200 4' - call flush(6) call writegriddata(nanal,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin,no_inflate_flag) if (nproc == 0) then t2 = mpi_wtime() diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 741277f3a0..7abd18455b 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -216,7 +216,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) write(char_tile, '(i1)') ntile !cltorg filename = trim(adjustl(datapath))//'/ensmean/fv_core.res.tile'//char_tile//'.nc' !clt filename = trim(adjustl(datapath))//'/ensmean/dynvars.tile'//char_tile//'.nc' - filename = 'fv3sar_tile'//char_tile//"_ensmean.dynvartracer" + filename = 'fv3sar_tile'//char_tile//"_ensmean_dynvartracer" !print *,trim(adjustl(filename)) call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& myname_,'open: '//trim(adjustl(filename)) ) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 91749d8ee6..f83810066c 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -237,9 +237,10 @@ subroutine readgriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefi enddo enddo do k = levels(tmp_ind-1)+1, levels(tmp_ind) - if (nproc .eq. 0) & + if (nproc .eq. 0) then write(6,*) 'READFVregional : t ', & & k, minval(vargrid(:,k,nb)), maxval(vargrid(:,k,nb)) + endif enddo endif @@ -488,7 +489,7 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - uworkvar3d(:,1:ny_res,:)=workvar3d+workinc3d + uworkvar3d(:,1:ny_res,:)=uworkvar3d(:,1:ny_res,:)+workinc3d uworkvar3d(:,ny_res+1,:)=uworkvar3d(:,ny_res,:) call write_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) deallocate(uworkvar3d) @@ -509,7 +510,7 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl enddo enddo enddo - vworkvar3d(1:nx_res,:,:)=workvar3d+workinc3d + vworkvar3d(1:nx_res,:,:)=vworkvar3d(1:nx_res,:,:)+workinc3d vworkvar3d(nx_res+1,:,:)=vworkvar3d(nx_res,:,:) call write_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) @@ -610,7 +611,8 @@ subroutine writegriddata(nanal,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_infl if (ps_ind > 0) then allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) - call read_fv3_restart_data3d('delp',filename,file_id,workvar3d) !cltto + varstrname = 'delp' + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) !cltto !print *,'min/max delp',ntile,minval(delp),maxval(delp) workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed do i=nlevs,1,-1 From 07a0aa01c1082b701f082902c2d779d52b53327a Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Fri, 10 May 2019 14:53:07 +0000 Subject: [PATCH 018/155] add fv3sar_bg_opt with new function when it = 1, with cold start fv3sar files as background --- src/gsi/gsi_rfv3io_mod.f90 | 364 ++++++++++++++++++++++++++++++++++++- src/gsi/gsimod.F90 | 3 +- 2 files changed, 363 insertions(+), 4 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index b30e356f77..f9754d5fbc 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -38,6 +38,7 @@ module gsi_rfv3io_mod implicit none public type_fv3regfilenameg public bg_fv3regfilenameg + public fv3sar_bg_opt ! directory names (hardwired for now) type type_fv3regfilenameg @@ -47,11 +48,11 @@ module gsi_rfv3io_mod character(len=:),allocatable :: tracers !='fv3_tracer' character(len=:),allocatable :: sfcdata !='fv3_sfcdata' character(len=:),allocatable :: couplerres!='coupler.res' - contains procedure , pass(this):: init=>fv3regfilename_init end type type_fv3regfilenameg + integer:: fv3sar_bg_opt=0 type(type_fv3regfilenameg):: bg_fv3regfilenameg integer(i_kind) nx,ny,nz real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) @@ -586,7 +587,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) use kinds, only: r_kind,i_kind use mpimod, only: npe use guess_grids, only: nfldsig,ges_tsen,ges_prsi - use gridmod, only: lat2,lon2,nsig,ijn,eta1_ll,ijn_s + use gridmod, only: lat2,lon2,nsig,ijn,eta1_ll,eta2_ll,ijn_s use constants, only: one,fv use gsi_metguess_mod, only: gsi_metguess_bundle use gsi_bundlemod, only: gsi_bundlegetpointer @@ -674,18 +675,45 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) ! call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'ql' ,ges_ql ,istatus );ier=ier+istatus call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'oz' ,ges_oz ,istatus );ier=ier+istatus if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) - + + if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_readuv(dynvars,ges_u,ges_v) + else + call gsi_fv3ncdf_readuv_v1(dynvars,ges_u,ges_v) + endif + if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'T','t',ges_tsen(1,1,1,it),mype_t) + else + call gsi_fv3ncdf_read_v1(dynvars,'','T',ges_tsen(1,1,1,it),mype_t) + endif + + if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi,mype_p) ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) do i=nsig,1,-1 ges_prsi(:,:,i,it)=ges_prsi(:,:,i,it)*0.001_r_kind+ges_prsi(:,:,i+1,it) enddo ges_ps(:,:)=ges_prsi(:,:,1,it) + else + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',ges_ps,mype_p) + ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) + do k=1,nsig + ges_prsi(:,:,k,it)=eta1_ll(k)+eta2_ll(k)*ges_ps + enddo + endif + + + + + + if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',ges_q,mype_q) ! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',ges_oz,mype_oz) + else + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',ges_q,mype_q) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',ges_oz,mype_oz) + endif !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do k=1,nsig @@ -1579,10 +1607,18 @@ subroutine wrfv3_netcdf(fv3filenamegin) add_saved=.true. ! write out + if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_write(dynvars,'T',ges_tsen(1,1,1,it),mype_t,add_saved) call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) call gsi_fv3ncdf_writeuv(dynvars,ges_u,ges_v,mype_v,add_saved) call gsi_fv3ncdf_writeps(dynvars,'delp',ges_ps,mype_p,add_saved) + else + call gsi_fv3ncdf_write(dynvars,'t',ges_tsen(1,1,1,it),mype_t,add_saved) + call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) + call gsi_fv3ncdf_writeuv_v1(dynvars,ges_u,ges_v,mype_v,add_saved) + call gsi_fv3ncdf_writeps_v1(dynvars,'ps',ges_ps,mype_p,add_saved) + + endif end subroutine wrfv3_netcdf @@ -1853,6 +1889,328 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) deallocate(work,work_sub) end subroutine gsi_fv3ncdf_writeps +subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_nemsio_writeuv +! pgrmmr: wu +! +! abstract: gather u/v fields to mype_io, put u/v in FV3 model defined directions & orders +! then write out +! +! program history log: +! 2019-04-22 lei modified from gsi_nemsio_writeuv_v1 for update +! u_w,v_w,u_s,v_s in the cold start files! +! input argument list: +! varu,varv +! add_saved - true: add analysis increments to readin guess then write out +! - false: write out total analysis fields +! mype_io +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use constants, only: half,zero + use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype + use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig, & + ijn,displs_g,itotsub,iglobal, & + nlon_regional,nlat_regional + use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll, & + fv3uv2earth,earthuv2fv3 + use general_commvars_mod, only: ltosi,ltosj + use netcdf, only: nf90_open,nf90_close,nf90_noerr + use netcdf, only: nf90_write,nf90_inq_varid + use netcdf, only: nf90_put_var,nf90_get_var + + implicit none + character(len=*),intent(in) :: dynvars !='fv3_dynvars' + + real(r_kind) ,intent(in ) :: varu(lat2,lon2,nsig) + real(r_kind) ,intent(in ) :: varv(lat2,lon2,nsig) + integer(i_kind),intent(in ) :: mype_io + logical ,intent(in ) :: add_saved + + integer(i_kind) :: gfile_loc + integer(i_kind) :: u_wgrd_VarId,v_wgrd_VarId + integer(i_kind) :: u_sgrd_VarId,v_sgrd_VarId + integer(i_kind) i,j,mm1,n,k,ns,kr,m + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_au,work_av + real(r_kind),allocatable,dimension(:,:,:):: work_bu_s,work_bv_s + real(r_kind),allocatable,dimension(:,:,:):: work_bu_w,work_bv_w + real(r_kind),allocatable,dimension(:,:):: u,v,workau2,workav2 + real(r_kind),allocatable,dimension(:,:):: workbu_s2,workbv_s2 + real(r_kind),allocatable,dimension(:,:):: workbu_w2,workbv_w2 + + mm1=mype+1 + + allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) +!!!!!! gather analysis u !! revers k !!!!!!!!!!! + do k=1,nsig + kr=nsig+1-k + do i=1,lon1 + do j=1,lat1 + work_sub(j,i,kr)=varu(j+1,i+1,k) + end do + end do + enddo + call mpi_gatherv(work_sub,ijnz(mm1),mpi_rtype, & + work,ijnz,displsz_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + allocate( work_au(nlat,nlon,nsig),work_av(nlat,nlon,nsig)) + ns=0 + do m=1,npe + do k=1,nsig + do n=displs_g(m)+1,displs_g(m)+ijn(m) + ns=ns+1 + work_au(ltosi(n),ltosj(n),k)=work(ns) + end do + enddo + enddo + endif ! mype + +!!!!!! gather analysis v !! reverse k !!!!!!!!!!!!!!!!!! + do k=1,nsig + kr=nsig+1-k + do i=1,lon1 + do j=1,lat1 + work_sub(j,i,kr)=varv(j+1,i+1,k) + end do + end do + enddo + call mpi_gatherv(work_sub,ijnz(mm1),mpi_rtype, & + work,ijnz,displsz_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + ns=0 + do m=1,npe + do k=1,nsig + do n=displs_g(m)+1,displs_g(m)+ijn(m) + ns=ns+1 + work_av(ltosi(n),ltosj(n),k)=work(ns) + end do + enddo + enddo + deallocate(work,work_sub) +!clt u and v would contain winds at either D-grid or A-grid +!clt do not diretly use them in between fv3uv2eath and fv3_h_to_ll unless paying +!attent to the actual storage layout + call check( nf90_open(trim(dynvars ),nf90_write,gfile_loc) ) + + allocate( u(nlon_regional,nlat_regional)) + allocate( v(nlon_regional,nlat_regional)) + + allocate( work_bu_s(nlon_regional,nlat_regional+1,nsig)) + allocate( work_bv_s(nlon_regional,nlat_regional+1,nsig)) + allocate( work_bu_w(nlon_regional+1,nlat_regional,nsig)) + allocate( work_bv_w(nlon_regional+1,nlat_regional,nsig)) + + + + call check( nf90_inq_varid(gfile_loc,'u_s',u_sgrd_VarId) ) + call check( nf90_inq_varid(gfile_loc,'u_w',u_wgrd_VarId) ) + call check( nf90_inq_varid(gfile_loc,'v_s',v_sgrd_VarId) ) + call check( nf90_inq_varid(gfile_loc,'v_w',v_wgrd_VarId) ) + + if(add_saved)then + allocate( workau2(nlat,nlon),workav2(nlat,nlon)) + allocate( workbu_w2(nlon_regional+1,nlat_regional)) + allocate( workbv_w2(nlon_regional+1,nlat_regional)) + allocate( workbu_s2(nlon_regional,nlat_regional+1)) + allocate( workbv_s2(nlon_regional,nlat_regional+1)) +!!!!!!!! readin work_b !!!!!!!!!!!!!!!! + call check( nf90_get_var(gfile_loc,u_sgrd_VarId,work_bu_s) ) + call check( nf90_get_var(gfile_loc,u_wgrd_VarId,work_bu_w) ) + call check( nf90_get_var(gfile_loc,v_sgrd_VarId,work_bv_s) ) + call check( nf90_get_var(gfile_loc,v_wgrd_VarId,work_bv_w) ) + do k=1,nsig + do j=1,nlat_regional + u(:,j)=half * (work_bu_s(:,j,k)+ work_bu_s(:,j+1,k)) + enddo + do i=1,nlon_regional + v(i,:)=half*(work_bv_w(i,:,k)+work_bv_w(i+1,:,k)) + enddo + call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat) +!!!!!!!! find analysis_inc: work_a !!!!!!!!!!!!!!!! + work_au(:,:,k)=work_au(:,:,k)-workau2(:,:) + work_av(:,:,k)=work_av(:,:,k)-workav2(:,:) + call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) +!!!!!!!! add analysis_inc to readin work_b !!!!!!!!!!!!!!!! + do i=2,nlon_regional-1 + workbu_w2(i,:)=half*(u(i,:)+u(i+1,:)) + workbv_w2(i,:)=half*(v(i,:)+v(i+1,:)) + enddo + workbu_w2(1,:)=u(1,:) + workbv_w2(1,:)=v(1,:) + workbu_w2(nlon_regional+1,:)=u(nlon_regional,:) + workbv_w2(nlon_regional+1,:)=v(nlon_regional,:) + + do j=2,nlat_regional-1 + workbu_s2(:,j)=half*(u(:,j)+u(:,j+1)) + workbv_s2(:,j)=half*(v(:,j)+v(:,j+1)) + enddo + workbu_s2(:,1)=u(:,1) + workbv_s2(:,1)=v(:,1) + workbu_s2(:,nlat_regional+1)=u(:,nlat_regional) + workbv_s2(:,nlat_regional+1)=v(:,nlat_regional) + + + + work_bu_w(:,:,k)=work_bu_w(:,:,k)+workbu_w2(:,:) + work_bu_s(:,:,k)=work_bu_s(:,:,k)+workbu_s2(:,:) + work_bv_w(:,:,k)=work_bv_w(:,:,k)+workbv_w2(:,:) + work_bv_s(:,:,k)=work_bv_s(:,:,k)+workbv_s2(:,:) + enddo + deallocate(workau2,workav2) + deallocate(workbu_w2,workbv_w2) + deallocate(workbu_s2,workbv_s2) + else + do k=1,nsig + call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) + + do i=2,nlon_regional-1 + work_bu_w(i,:,k)=half*(u(i,:)+u(i+1,:)) + work_bv_w(i,:,k)=half*(v(i,:)+v(i+1,:)) + enddo + work_bu_w(1,:,k)=u(1,:) + work_bv_w(1,:,k)=v(1,:) + work_bu_w(nlon_regional+1,:,k)=u(nlon_regional,:) + work_bv_w(nlon_regional+1,:,k)=v(nlon_regional,:) + + do j=2,nlat_regional-1 + work_bu_s(:,j,k)=half*(u(:,j)+u(:,j+1)) + work_bv_s(:,j,k)=half*(v(:,j)+v(:,j+1)) + enddo + work_bu_s(:,1,k)=u(:,1) + work_bv_s(:,1,k)=v(:,1) + work_bu_s(:,nlat_regional+1,k)=u(:,nlat_regional) + work_bv_s(:,nlat_regional+1,k)=v(:,nlat_regional) + + + enddo + endif + + deallocate(work_au,work_av,u,v) + print *,'write out u/v to ',trim(dynvars ) + call check( nf90_put_var(gfile_loc,u_wgrd_VarId,work_bu_w) ) + call check( nf90_put_var(gfile_loc,u_sgrd_VarId,work_bu_s) ) + call check( nf90_put_var(gfile_loc,v_wgrd_VarId,work_bv_w) ) + call check( nf90_put_var(gfile_loc,v_sgrd_VarId,work_bv_s) ) + call check( nf90_close(gfile_loc) ) + deallocate(work_bu_w,work_bv_w) + deallocate(work_bu_s,work_bv_s) + end if !mype_io + + if(allocated(work))deallocate(work) + if(allocated(work_sub))deallocate(work_sub) + +end subroutine gsi_fv3ncdf_writeuv_v1 + +subroutine gsi_fv3ncdf_writeps_v1(filename,varname,var,mype_io,add_saved) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_nemsio_writeps +! pgrmmr: wu +! +! abstract: write out analyzed "delp" to fv_core.res.nest02.tile7.nc +! +! program history log: +! 2019-04 lei, modified from gsi_nemsio_writeps to deal with cold start files +! +! input argument list: +! varu,varv +! add_saved +! mype - mpi task id +! mype_io +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use mpimod, only: mpi_rtype,mpi_comm_world,ierror,mype + use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig + use gridmod, only: ijn,displs_g,itotsub,iglobal + use gridmod, only: nlon_regional,nlat_regional,eta1_ll,eta2_ll + use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll + use general_commvars_mod, only: ltosi,ltosj + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_write,nf90_inq_varid + use netcdf, only: nf90_put_var,nf90_get_var + implicit none + + real(r_kind) ,intent(in ) :: var(lat2,lon2) + integer(i_kind),intent(in ) :: mype_io + logical ,intent(in ) :: add_saved + character(*) ,intent(in ) :: varname,filename + + integer(i_kind) :: VarId,gfile_loc + integer(i_kind) i,j,mm1,k,kr,kp + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:):: work_sub,work_a + real(r_kind),allocatable,dimension(:,:):: work_b,work_bi + real(r_kind),allocatable,dimension(:,:):: workb2,worka2 + + + mm1=mype+1 + allocate( work(max(iglobal,itotsub)),work_sub(lat1,lon1) ) + do i=1,lon1 + do j=1,lat1 + work_sub(j,i)=var(j+1,i+1) + end do + end do + call mpi_gatherv(work_sub,ijn(mm1),mpi_rtype, & + work,ijn,displs_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + allocate( work_a(nlat,nlon)) + do i=1,iglobal + work_a(ltosi(i),ltosj(i))=work(i) + end do + allocate( work_bi(nlon_regional,nlat_regional)) + allocate( work_b(nlon_regional,nlat_regional)) + call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) + call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + work_a=work_a*1000.0_r_kind + if(add_saved)then + allocate( workb2(nlon_regional,nlat_regional)) + allocate( worka2(nlat,nlon)) +!!!!!!!! read in guess delp !!!!!!!!!!!!!! + call check( nf90_get_var(gfile_loc,VarId,work_b) ) + call fv3_h_to_ll(work_b,worka2,nlon_regional,nlat_regional,nlon,nlat) +!!!!!!! analysis_inc Psfc: work_a + work_a(:,:)=work_a(:,:)-worka2(:,:) + call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + work_b(:,:)=work_b(:,:)+workb2(:,:) + else + call fv3_ll_to_h(work_a,work_b,nlon,nlat,nlon_regional,nlat_regional,.true.) + +! do k=1,nsig+1 +! write(6,*)' is ',k,' ',eta1_ll(k),eta2_ll(k) +! enddo + endif + + call check( nf90_put_var(gfile_loc,VarId,work_b) ) + call check( nf90_close(gfile_loc) ) + deallocate(worka2,workb2) + deallocate(work_b,work_a,work_bi) + + end if !mype_io + + deallocate(work,work_sub) +end subroutine gsi_fv3ncdf_writeps_v1 subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) !$$$ subprogram documentation block diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 5d4c892132..e7d280c818 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -153,6 +153,7 @@ module gsimod radiance_obstype_destroy use gsi_nstcouplermod, only: gsi_nstcoupler_init_nml use gsi_nstcouplermod, only: nst_gsi,nstinfo,zsea1,zsea2,fac_dtl,fac_tsl + use gsi_rfv3io_mod,only : fv3sar_bg_opt implicit none @@ -921,7 +922,7 @@ module gsimod ! ! namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,& - pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& + pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_bg_opt,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& jcap_ens_test,beta_s0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& grid_ratio_ens, & oz_univ_static,write_ens_sprd,use_localization_grid,use_gfs_ens, & From fe0bb13f2867ccb601415866b73ecaa4487dd71b Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 13 Jun 2019 17:32:08 +0000 Subject: [PATCH 019/155] replace subroutines in mod_fv3_lola.f90 by ones in mod_fv3_lolgrid.f90 for following dual resolution capabilities --- src/gsi/gsi_rfv3io_mod.f90 | 109 +++-- src/gsi/mod_fv3_lola.f90 | 1 - src/gsi/mod_fv3_lolgrid.f90 | 891 ++++++++++++++++++++++++++++++++++++ 3 files changed, 950 insertions(+), 51 deletions(-) create mode 100644 src/gsi/mod_fv3_lolgrid.f90 diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index f9754d5fbc..f8b612cf5f 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -35,6 +35,7 @@ module gsi_rfv3io_mod use kinds, only: r_kind,i_kind use gridmod, only: nlon_regional,nlat_regional + use mod_fv3_lolgrid, only: p_fv3sar2anlgrid implicit none public type_fv3regfilenameg public bg_fv3regfilenameg @@ -178,9 +179,12 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use mpimod, only: mype - use mod_fv3_lola, only: generate_anl_grid +!cltorg use mod_fv3_lola, only: generate_anl_grid + use mod_fv3_lolgrid, only: generate_regular_grids use gridmod, only:nsig,regional_time,regional_fhr,aeta1_ll,aeta2_ll use gridmod, only:nlon_regional,nlat_regional,eta1_ll,eta2_ll + use gridmod, only:region_lat,region_lon,nlat,nlon + use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx use kinds, only: i_kind,r_kind use constants, only: half,zero use mpimod, only: mpi_comm_world,ierror,mpi_itype,mpi_rtype @@ -202,6 +206,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) character(len=128) :: name integer(i_kind) myear,mmonth,mday,mhour,mminute,msecond real(r_kind),allocatable:: abk_fv3(:) + coupler_res_filenam=fv3filenamegin%couplerres grid_spec=fv3filenamegin%grid_spec @@ -326,7 +331,11 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) endif !!!!!!! setup A grid and interpolation/rotation coeff. - call generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) + call generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2anlgrid, & + nlat,nlon,region_lat,region_lon, & + region_dx,region_dy, & + region_dxi,region_dyi, & + coeffx,coeffy) deallocate (grid_lon,grid_lat,grid_lont,grid_latt) deallocate (ak,bk,abk_fv3) @@ -757,7 +766,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable - use mod_fv3_lola, only: fv3_h_to_ll,nxa,nya + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nxa,nya use constants, only: grav implicit none @@ -831,7 +840,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) if(allocated(sfc )) deallocate(sfc ) allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,i,sfc) - call fv3_h_to_ll(sfc(:,:,1),a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(sfc(:,:,1),a,nx,ny,nxa,nya,p_fv3sar2anlgrid) kk=0 do n=1,npe @@ -879,7 +888,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) iret=nf90_close(gfile_loc) k=k_orog - call fv3_h_to_ll(sfc1,a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(sfc1,a,nx,ny,nxa,nya,p_fv3sar2anlgrid) kk=0 do n=1,npe @@ -951,7 +960,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inq_varid use netcdf, only: nf90_inquire_variable - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s implicit none @@ -1000,7 +1009,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) iret=nf90_get_var(gfile_loc,var_id,uu) write(6,*)'thinkdeb999 varname ',trim(adjustl(varname)) write(6,*)'thinkdeb999 in readeps uu ps is ',uu(10,10,1) - call fv3_h_to_ll(uu(:,:,1),a,nx,ny,nlon,nlat) + call fv3_h_to_ll_regular_grids(uu(:,:,1),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) write(6,*)'thinkdeb999 in readeps aps is ',a(10,10) kk=0 do n=1,npe @@ -1056,7 +1065,7 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s implicit none @@ -1113,7 +1122,7 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) nzp1=nz+1 do i=1,nz ir=nzp1-i - call fv3_h_to_ll(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat) + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat,p_fv3sar2anlgrid) kk=0 do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) @@ -1174,7 +1183,7 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s implicit none @@ -1238,7 +1247,7 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) nzp1=nztmp+1 do i=1,nztmp ir=nzp1-i - call fv3_h_to_ll(uu(:,:,i),a,nx,ny,nlon,nlat) + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) kk=0 do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) @@ -1293,7 +1302,7 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll,nya,nxa,fv3uv2earth + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s implicit none @@ -1365,11 +1374,11 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) nzp1=nz+1 do i=1,nz ir=nzp1-i - call fv3uv2earth(temp1(:,:,i),uu(:,:,i),nx,ny,u,v) + call fv3uv2earth_regular_grids(temp1(:,:,i),uu(:,:,i),nx,ny,u,v,p_fv3sar2anlgrid) if(mype==mype_u)then - call fv3_h_to_ll(u,a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(u,a,nx,ny,nxa,nya,p_fv3sar2anlgrid) else - call fv3_h_to_ll(v,a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(v,a,nx,ny,nxa,nya,p_fv3sar2anlgrid) endif kk=0 do n=1,npe @@ -1424,7 +1433,7 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll,nya,nxa,fv3uv2earth + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s implicit none @@ -1518,13 +1527,13 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) enddo - call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(uorv(:,:),a,nx,ny,nxa,nya,p_fv3sar2anlgrid) else !cltthinkorg call fv3_h_to_ll(v,a,nx,ny,nxa,nya) do j=1,nx uorv(j,:)=half*(uu(j,:,i)+uu(j+1,:,i)) enddo - call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + call fv3_h_to_ll_regular_grids(uorv(:,:),a,nx,ny,nxa,nya,p_fv3sar2anlgrid) endif kk=0 do n=1,npe @@ -1651,8 +1660,8 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig, & ijn,displs_g,itotsub,iglobal, & nlon_regional,nlat_regional - use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll, & - fv3uv2earth,earthuv2fv3 + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids, & + fv3uv2earth_regular_grids,earthuv2fv3_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close,nf90_noerr use netcdf, only: nf90_write,nf90_inq_varid @@ -1741,15 +1750,15 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) call check( nf90_get_var(gfile_loc,ugrd_VarId,work_bu) ) call check( nf90_get_var(gfile_loc,vgrd_VarId,work_bv) ) do k=1,nsig - call fv3uv2earth(work_bu(1,1,k),work_bv(1,1,k),nlon_regional,nlat_regional,u,v) - call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat) - call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat) + call fv3uv2earth_regular_grids(work_bu(1,1,k),work_bv(1,1,k),nlon_regional,nlat_regional,u,v,p_fv3sar2anlgrid) + call fv3_h_to_ll_regular_grids(u,workau2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) + call fv3_h_to_ll_regular_grids(v,workav2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!!! find analysis_inc: work_a !!!!!!!!!!!!!!!! work_au(:,:,k)=work_au(:,:,k)-workau2(:,:) work_av(:,:,k)=work_av(:,:,k)-workav2(:,:) - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) - call earthuv2fv3(u,v,nlon_regional,nlat_regional,workbu2,workbv2) + call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call earthuv2fv3_regular_grids(u,v,nlon_regional,nlat_regional,workbu2,workbv2,p_fv3sar2anlgrid) !!!!!!!! add analysis_inc to readin work_b !!!!!!!!!!!!!!!! work_bu(:,:,k)=work_bu(:,:,k)+workbu2(:,:) work_bv(:,:,k)=work_bv(:,:,k)+workbv2(:,:) @@ -1757,9 +1766,9 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) deallocate(workau2,workbu2,workav2,workbv2) else do k=1,nsig - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) - call earthuv2fv3(u,v,nlon_regional,nlat_regional,work_bu(:,:,k),work_bv(:,:,k)) + call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call earthuv2fv3_regular_grids(u,v,nlon_regional,nlat_regional,work_bu(:,:,k),work_bv(:,:,k),p_fv3sar2anlgrid) enddo endif @@ -1804,7 +1813,7 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig use gridmod, only: ijn,displs_g,itotsub,iglobal use gridmod, only: nlon_regional,nlat_regional,eta1_ll,eta2_ll - use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close use netcdf, only: nf90_write,nf90_inq_varid @@ -1853,17 +1862,17 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) do i=2,nsig+1 work_bi(:,:,i)=work_b(:,:,i-1)*0.001_r_kind+work_bi(:,:,i-1) enddo - call fv3_h_to_ll(work_bi(:,:,nsig+1),worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll_regular_grids(work_bi(:,:,nsig+1),worka2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!! analysis_inc Psfc: work_a work_a(:,:)=work_a(:,:)-worka2(:,:) - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) do k=1,nsig+1 kr=nsig+2-k !!!!!!! ges_prsi+hydrostatic analysis_inc !!!!!!!!!!!!!!!! work_bi(:,:,k)=work_bi(:,:,k)+eta2_ll(kr)*workb2(:,:) enddo else - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) do k=1,nsig+1 kr=nsig+2-k !!!!!!! Psfc_ges+hydrostatic analysis_inc !!!!!!!!!!!!!!!! @@ -1920,8 +1929,8 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig, & ijn,displs_g,itotsub,iglobal, & nlon_regional,nlat_regional - use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll, & - fv3uv2earth,earthuv2fv3 + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids, & + fv3uv2earth_regular_grids,earthuv2fv3_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close,nf90_noerr use netcdf, only: nf90_write,nf90_inq_varid @@ -2036,13 +2045,13 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) do i=1,nlon_regional v(i,:)=half*(work_bv_w(i,:,k)+work_bv_w(i+1,:,k)) enddo - call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat) - call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll_regular_grids(u,workau2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) + call fv3_h_to_ll_regular_grids(v,workav2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!!! find analysis_inc: work_a !!!!!!!!!!!!!!!! work_au(:,:,k)=work_au(:,:,k)-workau2(:,:) work_av(:,:,k)=work_av(:,:,k)-workav2(:,:) - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) !!!!!!!! add analysis_inc to readin work_b !!!!!!!!!!!!!!!! do i=2,nlon_regional-1 workbu_w2(i,:)=half*(u(i,:)+u(i+1,:)) @@ -2074,8 +2083,8 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) deallocate(workbu_s2,workbv_s2) else do k=1,nsig - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) do i=2,nlon_regional-1 work_bu_w(i,:,k)=half*(u(i,:)+u(i+1,:)) @@ -2144,7 +2153,7 @@ subroutine gsi_fv3ncdf_writeps_v1(filename,varname,var,mype_io,add_saved) use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig use gridmod, only: ijn,displs_g,itotsub,iglobal use gridmod, only: nlon_regional,nlat_regional,eta1_ll,eta2_ll - use mod_fv3_lola, only: fv3_ll_to_h,fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close use netcdf, only: nf90_write,nf90_inq_varid @@ -2189,13 +2198,13 @@ subroutine gsi_fv3ncdf_writeps_v1(filename,varname,var,mype_io,add_saved) allocate( worka2(nlat,nlon)) !!!!!!!! read in guess delp !!!!!!!!!!!!!! call check( nf90_get_var(gfile_loc,VarId,work_b) ) - call fv3_h_to_ll(work_b,worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll_regular_grids(work_b,worka2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!! analysis_inc Psfc: work_a work_a(:,:)=work_a(:,:)-worka2(:,:) - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) work_b(:,:)=work_b(:,:)+workb2(:,:) else - call fv3_ll_to_h(work_a,work_b,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a,work_b,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) ! do k=1,nsig+1 ! write(6,*)' is ',k,' ',eta1_ll(k),eta2_ll(k) @@ -2239,8 +2248,8 @@ subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig use gridmod, only: ijn,displs_g,itotsub,iglobal - use mod_fv3_lola, only: fv3_ll_to_h - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close use netcdf, only: nf90_write,nf90_inq_varid @@ -2299,16 +2308,16 @@ subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) call check( nf90_get_var(gfile_loc,VarId,work_b) ) do k=1,nsig - call fv3_h_to_ll(work_b(:,:,k),worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll_regular_grids(work_b(:,:,k),worka2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! work_a(:,:,k)=work_a(:,:,k)-worka2(:,:) - call fv3_ll_to_h(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) work_b(:,:,k)=work_b(:,:,k)+workb2(:,:) enddo deallocate(worka2,workb2) else do k=1,nsig - call fv3_ll_to_h(work_a(1,1,k),work_b(1,1,k),nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a(1,1,k),work_b(1,1,k),nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) enddo endif diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 index c59526952a..7f7a62399b 100644 --- a/src/gsi/mod_fv3_lola.f90 +++ b/src/gsi/mod_fv3_lola.f90 @@ -110,7 +110,6 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx use gridmod, only:init_general_transform,region_dy,region_dx use mpimod, only: mype - use egrid2agrid_mod, only: egrid2agrid_parm implicit none real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 new file mode 100644 index 0000000000..7a4cef06e4 --- /dev/null +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -0,0 +1,891 @@ +module mod_fv3_lolgrid +!$$$ module documentation block +! . . . . +! module: mod_fv3_lola +! prgmmr: parrish +! +! abstract: This module contains routines to interpolate from a single +! fv3 D grid tile to a rotated lat-lon analysis grid which completely +! covers the fv3 tile. Points beyond the fv3 tile are +! filled with nearest fv3 edge values, but have no actual +! impact on the analysis. +! +! program history log: +! 2017-02-24 parrish--initial documentation (patterned after +! mod_fv3_to_a.f90) +! 2017-10-10 wu w - setup interpolation and trnsform coeff in generate_anl_grid +! add routines earthuv2fv3, fv3uv2earth, fv3_h_to_ll +! fv3_ll_to_h +! +! subroutines included: +! sub generate_anl_grid +! sub earthuv2fv3 +! sub fv3uv2earth +! sub fv3_h_to_ll +! sub fv3_ll_to_h +! sub rotate2deg +! sub unrotate2deg +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + +! DIAGRAM: D-Grid layout: +! +! 1 nx +! . . (U,H) +! +! 1 nx +1 +! . . (V) + +! U U U U U U + ny +1 (for U) +! V H V H V H V H V H V H V + ny (for V,H) +! U U U U U U xh(i) = i dx=1 +! V H V H V H V H V H V H V xu(i) = i +! U U U U U U xv(i) = i-0.5 +! V H V H V H V H V H V H V +! U U U U U U yh(j) = j dy=1 +! V H V H V H V H V H V H V yu(j) = j-0.5 +! U U U U U U yv(j) = j +! V H V H V H V H V H V H V +! U U U U U U +! V H V H V H V H V H V H V + 1 (for V,H) +! U U U U U U + 1 (for U) + +! U(nx ,ny +1),V(nx +1,ny ),H(nx ,ny ) + + use kinds, only: r_kind,i_kind + implicit none +! + private + public :: generate_regular_grids + public :: fv3_h_to_ll_regular_grids,fv3_ll_to_h_regular_grids + public :: fv3uv2earth_regular_grids,earthuv2fv3_regular_grids + public :: fv3sar2grid_parm + public :: p_fv3sar2anlgrid + public :: p_fv3sar2ensgrid + public :: nxa,nya + type fv3sar2grid_parm + logical bilinear + integer(i_kind) nxout,nyout,nx,ny + real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 + integer(i_kind),pointer,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp + real(r_kind) ,pointer,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 + real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv + integer(i_kind),pointer,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + end type + type (fv3sar2grid_parm)::p_fv3sar2anlgrid,p_fv3sar2ensgrid + integer(i_kind) nxa,nya + + +contains + +subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2grid,& + nlatout,nlonout,region_lat_out,region_lon_out, & + region_dx_out,region_dy_out, & + region_dxi_out,region_dyi_out, & + coeffx_out,coeffy_out) +!$$$ subprogram documentation block +! . . . . +! subprogram: generate_ens_grid +!clt modified from generate_anl_grid +! prgmmr: parrish +! +! abstract: define rotated lat-lon analysis grid which is centered on fv3 tile +! and oriented to completely cover the tile. +! +! program history log: +! 2017-05-02 parrish +! 2017-10-10 wu - 1. setup analysis A-grid, +! 2. compute/setup FV3 to A grid interpolation parameters +! 3. compute/setup A to FV3 grid interpolation parameters +! 4. setup weightings for wind conversion from FV3 to earth +! +! input argument list: +! nx, ny - number of cells = nx*ny +! grid_lon ,grid_lat - longitudes and latitudes of fv3 grid cell corners +! grid_lont,grid_latt - longitudes and latitudes of fv3 grid cell centers +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: quarter,one,two,half,zero,deg2rad,rearth,rad2deg + use gridmod, only:grid_ratio_fv3_regional + use mpimod, only: mype + use gridmod, only:init_general_transform + implicit none + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + real(r_kind),allocatable,intent(out):: region_lat_out(:,:),region_lon_out(:,:) + real(r_kind),allocatable,intent(out):: region_dx_out(:,:),region_dy_out(:,:) + real(r_kind),allocatable,intent(out):: region_dxi_out(:,:),region_dyi_out(:,:) + real(r_kind),allocatable,optional, intent(out):: coeffx_out(:,:),coeffy_out(:,:) + integer(i_kind), intent(out):: nlatout,nlonout + + + real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 + integer(i_kind),pointer,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp + real(r_kind) ,pointer,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 + real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv + integer(i_kind),pointer,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + + real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b + real(r_kind),allocatable,dimension(:)::ybh_a,ya_a,ya_b,yy + real(r_kind),allocatable,dimension(:,:)::xbh_b,ybh_b + real(r_kind) dlat,dlon,dyy,dxx,dyyi,dxxi + real(r_kind) dyyh,dxxh + + + integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + real(r_kind) , intent(inout) :: grid_lon(nx+1,ny+1) ! fv3 cell corner longitudes + real(r_kind) , intent(inout) :: grid_lont(nx,ny) ! fv3 cell center longitudes + real(r_kind) , intent(inout) :: grid_lat(nx+1,ny+1) ! fv3 cell corner latitudes + real(r_kind) , intent(inout) :: grid_latt(nx,ny) ! fv3 cell center latitudes + logical :: bilinear + integer(i_kind) i,j,ir,jr,n + real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in + real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an + real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon + real(r_kind) adlon,adlat,alon,clat,clon + integer(i_kind) nxout,nyout + integer(i_kind) nlonh,nlath,nxh,nyh + integer(i_kind) ib1,ib2,jb1,jb2,jj + + integer(i_kind) nord_e2a + real(r_kind)gxa,gya + + real(r_kind) x(nx+1,ny+1),y(nx+1,ny+1),z(nx+1,ny+1), xr,yr,zr,xu,yu,zu,rlat,rlon + real(r_kind) xv,yv,zv,vval + real(r_kind) cx,cy + real(r_kind) uval,ewval,nsval + + real(r_kind) d(4),ds + integer(i_kind) kk,k + + + nord_e2a=4 + bilinear=.false. + p_fv3sar2grid%bilinear=bilinear + + +! create xc,yc,zc for the cell centers. + allocate(xc(nx,ny)) + allocate(yc(nx,ny)) + allocate(zc(nx,ny)) + allocate(gclat(nx,ny)) + allocate(gclon(nx,ny)) + allocate(gcrlat(nx,ny)) + allocate(gcrlon(nx,ny)) + do j=1,ny + do i=1,nx + xc(i,j)=cos(grid_latt(i,j)*deg2rad)*cos(grid_lont(i,j)*deg2rad) + yc(i,j)=cos(grid_latt(i,j)*deg2rad)*sin(grid_lont(i,j)*deg2rad) + zc(i,j)=sin(grid_latt(i,j)*deg2rad) + enddo + enddo + +! compute center as average x,y,z coordinates of corners of domain -- + + xcent=quarter*(xc(1,1)+xc(1,ny)+xc(nx,1)+xc(nx,ny)) + ycent=quarter*(yc(1,1)+yc(1,ny)+yc(nx,1)+yc(nx,ny)) + zcent=quarter*(zc(1,1)+zc(1,ny)+zc(nx,1)+zc(nx,ny)) + + rnorm=one/sqrt(xcent**2+ycent**2+zcent**2) + xcent=rnorm*xcent + ycent=rnorm*ycent + zcent=rnorm*zcent + centlat=asin(zcent)*rad2deg + centlon=atan2(ycent,xcent)*rad2deg + +!! compute new lats, lons + call rotate2deg(grid_lont,grid_latt,gcrlon,gcrlat, & + centlon,centlat,nx,ny) + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! compute analysis A-grid lats, lons +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +!--------------------------obtain analysis grid dimensions nxout,nyout + p_fv3sar2grid%nx=nx + p_fv3sar2grid%ny=ny + nxout=1+nint((nx-one)/grid_ratio_fv3_regional) + p_fv3sar2grid%nxout=nxout + nyout=1+nint((ny-one)/grid_ratio_fv3_regional) + p_fv3sar2grid%nyout=nyout + nlatout=p_fv3sar2grid%nyout + nlonout=p_fv3sar2grid%nxout + nxa=nx + nya=ny ! for compatiability + if(mype==0) print *,'nlatout,nlonout = ',nlatout,nlonout + +!--------------------------obtain analysis grid spacing + dlat=(maxval(gcrlat)-minval(gcrlat))/(ny-1) + dlon=(maxval(gcrlon)-minval(gcrlon))/(nx-1) + adlat=dlat*grid_ratio_fv3_regional + adlon=dlon*grid_ratio_fv3_regional + +!-------setup analysis A-grid; find center of the domain + nlonh=nlonout/2 + nlath=nlatout/2 + + if(nlonh*2==nlonout)then + clon=adlon/two + cx=half + else + clon=adlon + cx=one + endif + + if(nlath*2==nlatout)then + clat=adlat/two + cy=half + else + clat=adlat + cy=one + endif + +! +!-----setup analysis A-grid from center of the domain +! + allocate(rlat_in(nlatout,nlonout),rlon_in(nlatout,nlonout)) + do j=1,nlonout + alon=(j-nlonh)*adlon-clon + do i=1,nlatout + rlon_in(i,j)=alon + enddo + enddo + + + do j=1,nlonout + do i=1,nlatout + rlat_in(i,j)=(i-nlath)*adlat-clat + enddo + enddo + + if (allocated(region_dx_out )) deallocate(region_dx_out ) !clt will correspond + !to region_dx_ens and so on + if (allocated(region_dy_out )) deallocate(region_dy_out ) + allocate(region_dx_out(nlatout,nlonout),region_dy_out(nlatout,nlonout)) + allocate(region_dxi_out(nlatout,nlonout),region_dyi_out(nlatout,nlonout)) + if (present(coeffx_out)) allocate(coeffx_out(nlatout,nlonout)) + if (present(coeffy_out)) allocate(coeffy_out(nlatout,nlonout)) + dyy=rearth*adlat*deg2rad + dyyi=one/dyy + dyyh=half/dyy + do j=1,nlonout + do i=1,nlatout + region_dy_out(i,j)=dyy + region_dyi_out(i,j)=dyyi + enddo + enddo + if (present(coeffy_out)) coeffy_out=dyyh + + do i=1,nlatout + dxx=rearth*cos(rlat_in(i,1)*deg2rad)*adlon*deg2rad + dxxi=one/dxx + dxxh=half/dxx + do j=1,nlonout + region_dx_out(i,j)=dxx + region_dxi_out(i,j)=dxxi + enddo + enddo + if (present(coeffx_out)) coeffx_out=dxxh + + +! +!---------- setup region_lat,region_lon in earth coord +! + if (allocated(region_lat_out)) deallocate(region_lat_out) + if (allocated(region_lon_out)) deallocate(region_lon_out) + allocate(region_lat_out(nlatout,nlonout),region_lon_out(nlatout,nlonout)) + + call unrotate2deg(region_lon_out,region_lat_out,rlon_in,rlat_in, & + centlon,centlat,nlatout,nlonout) + + if (present(coeffx_out)) then ! if coeffx_out is present, this is for analysis grid + allocate(glat_an(nlonout,nlatout),glon_an(nlonout,nlatout)) + region_lat_out=region_lat_out*deg2rad + region_lon_out=region_lon_out*deg2rad + + do j=1,nlatout + do i=1,nlonout + glat_an(i,j)=region_lat_out(j,i) + glon_an(i,j)=region_lon_out(j,i) + enddo + enddo + + call init_general_transform(glat_an,glon_an) + + deallocate(glat_an,glon_an) + + endif +!--------------------compute all combinations of relative coordinates + + allocate(xbh_a(nx),xbh_b(nx,ny),xa_a(nxout),xa_b(nxout)) + allocate(ybh_a(ny),ybh_b(nx,ny),ya_a(nyout),ya_b(nyout)) + + nxh=nx/2 + nyh=ny/2 + +!!!!!! fv3 rotated grid; not equal spacing, non_orthogonal !!!!!! + do j=1,ny + jr=ny+1-j + do i=1,nx + ir=nx+1-i + xbh_b(ir,jr)=gcrlon(i,j)/dlon + end do + end do + do j=1,ny + jr=ny+1-j + do i=1,nx + ir=nx+1-i + ybh_b(ir,jr)=gcrlat(i,j)/dlat + end do + end do + +!!!! define analysis A grid !!!!!!!!!!!!! + do j=1,nxout + xa_a(j)=(float(j-nlonh)-cx)*grid_ratio_fv3_regional + end do + do i=1,nyout + ya_a(i)=(float(i-nlath)-cy)*grid_ratio_fv3_regional + end do + +!!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! + allocate ( p_fv3sar2grid%fv3dx(nxout,nyout),p_fv3sar2grid%fv3dx1(nxout,nyout),p_fv3sar2grid%fv3dy(nxout,nyout),p_fv3sar2grid%fv3dy1(nxout,nyout) ) + allocate ( p_fv3sar2grid%fv3ix(nxout,nyout),p_fv3sar2grid%fv3ixp(nxout,nyout),p_fv3sar2grid%fv3jy(nxout,nyout),p_fv3sar2grid%fv3jyp(nxout,nyout) ) + fv3dx=p_fv3sar2grid%fv3dx + fv3dx1=p_fv3sar2grid%fv3dx1 + fv3dy=p_fv3sar2grid%fv3dy + fv3dy1=p_fv3sar2grid%fv3dy1 + fv3ix=p_fv3sar2grid%fv3ix + fv3ixp=p_fv3sar2grid%fv3ixp + fv3jy=p_fv3sar2grid%fv3jy + fv3jyp=p_fv3sar2grid%fv3jyp + + allocate(yy(ny)) + +! iteration to find the fv3 grid cell + jb1=1 + ib1=1 + do j=1,nyout + do i=1,nxout + do n=1,3 + gxa=xa_a(i) + if(gxa < xbh_b(1,jb1))then + gxa= 1 + else if(gxa > xbh_b(nx,jb1))then + gxa= nx + else + call grdcrd1(gxa,xbh_b(1,jb1),nx,1) + endif + ib2=ib1 + ib1=gxa + do jj=1,ny + yy(jj)=ybh_b(ib1,jj) + enddo + gya=ya_a(j) + if(gya < yy(1))then + gya= 1 + else if(gya > yy(ny))then + gya= ny + else + call grdcrd1(gya,yy,ny,1) + endif + jb2=jb1 + jb1=gya + + if((ib1 == ib2) .and. (jb1 == jb2)) exit + if(n==3 ) then +!!!!!!! if not converge, find the nearest corner point + d(1)=(xa_a(i)-xbh_b(ib1,jb1))**2+(ya_a(j)-ybh_b(ib1,jb1))**2 + d(2)=(xa_a(i)-xbh_b(ib1+1,jb1))**2+(ya_a(j)-ybh_b(ib1+1,jb1))**2 + d(3)=(xa_a(i)-xbh_b(ib1,jb1+1))**2+(ya_a(j)-ybh_b(ib1,jb1+1))**2 + d(4)=(xa_a(i)-xbh_b(ib1+1,jb1+1))**2+(ya_a(j)-ybh_b(ib1+1,jb1+1))**2 + kk=1 + do k=2,4 + if(d(k) xa_a(nxout))then + gxa= nxout + else + call grdcrd1(gxa,xa_a,nxout,1) + endif + a3ix(j,i)=int(gxa) + a3ix(j,i)=min(max(1,a3ix(j,i)),nxout) + a3dx(j,i)=max(zero,min(one,gxa-a3ix(j,i))) + a3dx1(j,i)=one-a3dx(j,i) + a3ixp(j,i)=min(nxout,a3ix(j,i)+1) + end do + end do + + do i=1,nx + do j=1,ny + gya=ybh_b(i,j) + if(gya < ya_a(1))then + gya= 1 + else if(gya > ya_a(nyout))then + gya= nyout + else + call grdcrd1(gya,ya_a,nyout,1) + endif + a3jy(j,i)=int(gya) + a3jy(j,i)=min(max(1,a3jy(j,i)),nyout) + a3dy(j,i)=max(zero,min(one,gya-a3jy(j,i))) + a3dy1(j,i)=one-a3dy(j,i) + a3jyp(j,i)=min(ny,a3jy(j,i)+1) + end do + end do + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!! find coefficients for wind conversion btw FV3 & earth +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + allocate ( p_fv3sar2grid%cangu(nx,ny+1),p_fv3sar2grid%sangu(nx,ny+1),p_fv3sar2grid%cangv(nx+1,ny),p_fv3sar2grid%sangv(nx+1,ny) ) + cangu=p_fv3sar2grid%cangu + sangu=p_fv3sar2grid%sangu + sangu=p_fv3sar2grid%cangv + sangu=p_fv3sar2grid%sangv + +! 1. compute x,y,z at cell cornor from grid_lon, grid_lat + + do j=1,ny+1 + do i=1,nx+1 + x(i,j)=cos(grid_lat(i,j)*deg2rad)*cos(grid_lon(i,j)*deg2rad) + y(i,j)=cos(grid_lat(i,j)*deg2rad)*sin(grid_lon(i,j)*deg2rad) + z(i,j)=sin(grid_lat(i,j)*deg2rad) + enddo + enddo + +! 2 find angles to E-W and N-S for U edges + + do j=1,ny+1 + do i=1,nx +! center lat/lon of the edge + rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) +! vector to center of the edge + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) +! vector of the edge + xu= x(i+1,j)-x(i,j) + yu= y(i+1,j)-y(i,j) + zu= z(i+1,j)-z(i,j) +! find angle with cross product + uval=sqrt((xu**2+yu**2+zu**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + cangu(i,j)=(-yr*xu+xr*yu)/ewval/uval + sangu(i,j)=(-xr*zr*xu-zr*yr*yu+(xr*xr+yr*yr)*zu) / nsval/uval + enddo + enddo + +! 3 find angles to E-W and N-S for V edges + do j=1,ny + do i=1,nx+1 + rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) + xv= x(i,j+1)-x(i,j) + yv= y(i,j+1)-y(i,j) + zv= z(i,j+1)-z(i,j) + vval=sqrt((xv**2+yv**2+zv**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + cangv(i,j)=(-yr*xv+xr*yv)/ewval/vval + sangv(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval + enddo + enddo + deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) +end subroutine generate_regular_grids +subroutine earthuv2fv3_regular_grids(u,v,nx,ny,u_out,v_out,p_fv3sar2grid) +!$$$ subprogram documentation block +! . . . . +! subprogram: earthuv2fv3 +! prgmmr: wu 2017-06-15 +! +! abstract: project earth UV to fv3 UV and interpolate to edge of the cell +! +! program history log: +! +! +! input argument list: +! u,v - earth wind components at center of the cell +! nx,ny - dimensions +! +! output argument list: +! u_out,v_out - output fv3 winds on the cell boundaries +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: half + implicit none + + integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + real(r_kind),intent(in ) :: u(nx,ny),v(nx,ny) + real(r_kind),intent( out) :: u_out(nx,ny+1),v_out(nx+1,ny) + integer(i_kind) i,j + real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv + cangu=p_fv3sar2grid%cangu + sangu=p_fv3sar2grid%sangu + sangu=p_fv3sar2grid%cangv + sangu=p_fv3sar2grid%sangv + + +!!!!!!! earth u/v to covariant u/v + j=1 + do i=1,nx + u_out(i,j)= u(i,j)*cangu(i,j)+v(i,j)*sangu(i,j) + end do + + do j=2,ny + do i=1,nx + u_out(i,j)=half *( (u(i,j)+u(i,j-1))*cangu(i,j)+(v(i,j)+v(i,j-1))*sangu(i,j) ) + end do + end do + j=ny + do i=1,nx + u_out(i,j+1)= u(i,j)*cangu(i,j+1)+v(i,j)*sangu(i,j+1) + end do + + do j=1,ny + v_out(1,j)=u(1,j)*cangv(1,j)+v(1,j)*sangv(1,j) + do i=2,nx + v_out(i,j)=half *( (u(i,j)+u(i-1,j))*cangv(i,j)+(v(i,j)+v(i-1,j))*sangv(i,j) ) + end do + v_out(nx+1,j)=u(nx,j)*cangv(nx+1,j)+v(nx,j)*sangv(nx+1,j) + end do +end subroutine earthuv2fv3_regular_grids + +subroutine fv3uv2earth_regular_grids(u,v,nx,ny,u_out,v_out,p_fv3sar2grid) +!$$$ subprogram documentation block +! . . . . +! subprogram: fv3uv2earth +! prgmmr: wu 2017-06-15 +! +! abstract: project fv3 UV to earth UV and interpolate to the center of the cells +! +! program history log: +! +! +! input argument list: +! u,v - fv3 winds on the cell boundaries +! nx,ny - dimensions +! +! output argument list: +! u_out,v_out - output earth wind components at center of the cell +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: half + implicit none + + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + real(r_kind),intent(in ) :: u(nx,ny+1),v(nx+1,ny) + real(r_kind),intent( out) :: u_out(nx,ny),v_out(nx,ny) + integer(i_kind) i,j + real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv + cangu=p_fv3sar2grid%cangu + sangu=p_fv3sar2grid%sangu + sangu=p_fv3sar2grid%cangv + sangu=p_fv3sar2grid%sangv + + do j=1,ny + do i=1,nx + u_out(i,j)=half *( (u(i,j)*sangv(i,j)-v(i,j)*sangu(i,j))/(cangu(i,j)*sangv(i,j)-sangu(i,j)*cangv(i,j)) & + +(u(i,j+1)*sangv(i+1,j)-v(i+1,j)*sangu(i,j+1))/(cangu(i,j+1)*sangv(i+1,j)-sangu(i,j+1)*cangv(i+1,j))) + v_out(i,j)=half *( (u(i,j)*cangv(i,j)-v(i,j)*cangu(i,j))/(sangu(i,j)*cangv(i,j)-cangu(i,j)*sangv(i,j)) & + +(u(i,j+1)*cangv(i+1,j)-v(i+1,j)*cangu(i,j+1))/(sangu(i,j+1)*cangv(i+1,j)-cangu(i,j+1)*sangv(i+1,j))) + end do + end do + return +end subroutine fv3uv2earth_regular_grids +subroutine fv3_h_to_ll_regular_grids(b_in,a,nb,mb,na,ma,p_fv3sar2grid) +!$$$ subprogram documentation block +! . . . . +! subprogram: fv3_h_to_ll +! prgmmr: wu 2017-05-30 +! +! abstract: interpolate from rotated fv3 grid to A grid. +! Interpolation choices 1)bilinear both ways +! 2)inverse-distance weighting average +! reverse E-W and N-S directions & reverse i,j for output array a(nlat,nlon) +! +! program history log: +! +! +! input argument list: +! mb,nb - fv3 dimensions +! ma,na - a dimensions +! b - input variable b +! xb,yb - b array x and y coordinates +! xa,ya - a array coordinates (xa in xb units, ya in yb units) +! +! output argument list: +! a - output interpolated array +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use constants, only: zero,one + implicit none + + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + integer(i_kind),intent(in ) :: mb,nb,ma,na + real(r_kind) ,intent(in ) :: b_in(nb,mb) + real(r_kind) ,intent( out) :: a(ma,na) + + real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 + integer(i_kind),pointer,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp + logical :: bilinear + integer(i_kind) i,j,ir,jr,mbp,nbp + real(r_kind) b(nb,mb) + + bilinear= p_fv3sar2grid%bilinear + fv3dx=p_fv3sar2grid%fv3dx + fv3dx1=p_fv3sar2grid%fv3dx1 + fv3dy=p_fv3sar2grid%fv3dy + fv3dy1=p_fv3sar2grid%fv3dy1 + fv3ix=p_fv3sar2grid%fv3ix + fv3ixp=p_fv3sar2grid%fv3ixp + fv3jy=p_fv3sar2grid%fv3jy + fv3jyp=p_fv3sar2grid%fv3jyp + +!!!!!!!!! reverse E-W and N-S + mbp=mb+1 + nbp=nb+1 + do j=1,mb + jr=mbp-j + do i=1,nb + ir=nbp-i + b(ir,jr)=b_in(i,j) + end do + end do +!!!!!!!!! interpolate to A grid & reverse ij for array a(lat,lon) + if(bilinear)then ! bilinear interpolation + do j=1,ma + do i=1,na + a(j,i)=fv3dx1(i,j)*(fv3dy1(i,j)*b(fv3ix (i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ix (i,j),fv3jyp(i,j))) & + +fv3dx (i,j)*(fv3dy1(i,j)*b(fv3ixp(i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ixp(i,j),fv3jyp(i,j))) + end do + end do + else ! inverse-distance weighting average + do j=1,ma + do i=1,na + a(j,i)=fv3dx(i,j)*b(fv3ix (i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ix (i,j),fv3jyp(i,j)) & + +fv3dx1(i,j)*b(fv3ixp(i,j),fv3jy(i,j))+fv3dy1(i,j)*b(fv3ixp(i,j),fv3jyp(i,j)) + end do + end do + endif + return +end subroutine fv3_h_to_ll_regular_grids + +subroutine fv3_ll_to_h_regular_grids(a,b,nxa,nya,nxb,nyb,rev_flg,p_fv3sar2grid) +!$$$ subprogram documentation block +! . . . . +! subprogram: fv3_ll_to_h +! prgmmr: wu 2017-05-30 +! +! abstract: interpolate from analysis A grid to rotated fv3 grid. +! Interpolation is bilinear both ways. Reverse E-W and N-S and +! reverse i,j for output array b(nxb,nyb) +! +! program history log: +! +! +! input argument list: +! nxa,nya - a array dimensions +! nxb,nyb - b array dimensions +! +! b - input variable b +! rev_flg - flag for reverse i,j order +! output argument list: +! a - output interpolated array +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: zero,one + implicit none + + integer(i_kind),intent(in ) :: nyb,nxb,nya,nxa + real(r_kind) ,intent(in ) :: a(nya,nxa) + logical ,intent(in ) :: rev_flg + real(r_kind) ,intent( out) :: b(nxb*nyb) + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + real(r_kind) ,pointer,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 + integer(i_kind),pointer,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + logical:: linear + + integer(i_kind) i,j,ir,jr,nybp,nxbp,ijr + + a3dx =p_fv3sar2grid%a3dx + a3dx1=p_fv3sar2grid%a3dx1 + a3dy =p_fv3sar2grid%a3dy + a3dy1=p_fv3sar2grid%a3dy1 + + a3ix =p_fv3sar2grid%a3ix + a3ixp =p_fv3sar2grid%a3ixp + a3jy =p_fv3sar2grid%a3jy + a3jyp=p_fv3sar2grid%a3jyp + + if(rev_flg)then +!!!!!!!!!! output in reverse E-W, N-S and reversed i,j !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + nybp=nyb+1 + nxbp=nxb+1 + do i=1,nyb + ir=nybp-i + ijr=(ir-1)*nxb + do j=1,nxb + jr=nxbp-j + b(jr+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & + +a3dy (i,j)*(a3dx1(i,j)*a(a3jyp(i,j),a3ix(i,j))+a3dx(i,j)*a(a3jyp(i,j),a3ixp(i,j))) + end do + end do + else +!!!!!!!!!! output order as input W-E S-N and (i:lat,j:lon) !!!!!!!!!!! + do j=1,nxb + ijr=(j-1)*nyb + do i=1,nyb + b(i+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & + +a3dy (i,j)*(a3dx1(i,j)*a(a3jyp(i,j),a3ix(i,j))+a3dx(i,j)*a(a3jyp(i,j),a3ixp(i,j))) + end do + end do + endif +end subroutine fv3_ll_to_h_regular_grids + + +end module mod_fv3_lolgrid From 72fbef9a74e744f0cb199838fcacfdf934270cff Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Sat, 22 Jun 2019 17:17:55 +0000 Subject: [PATCH 020/155] HAFS: Update the submodules. --- .gitmodules | 3 ++- fix | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index f4bfd21ee7..cd366203c3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,8 @@ [submodule "fix"] path = fix url = gerrit:GSI-fix - + branch = master [submodule "libsrc"] path = libsrc url = gerrit:GSI-libsrc + branch = master diff --git a/fix b/fix index c3cca5fbd3..5f49d74bcb 160000 --- a/fix +++ b/fix @@ -1 +1 @@ -Subproject commit c3cca5fbd34b7547f30618d06e4d27828827d68c +Subproject commit 5f49d74bcb4551abc037e2ceefde3355ecb6ad15 From 3cc1eb0a36e2569558062c551a5f20ded029e588 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Mon, 1 Jul 2019 15:15:32 +0000 Subject: [PATCH 021/155] comitt a few debug write commands temperarily --- src/gsi/gesinfo.f90 | 2 +- src/gsi/gsi_unformatted.F90 | 3 +++ src/gsi/read_obs.F90 | 3 ++- src/gsi/setuprhsall.f90 | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gsi/gesinfo.f90 b/src/gsi/gesinfo.f90 index c5c3e897c8..ee4a6b7444 100644 --- a/src/gsi/gesinfo.f90 +++ b/src/gsi/gesinfo.f90 @@ -497,7 +497,7 @@ subroutine gesinfo fha(2)=nhr_assimilation endif call w3movdat(fha,ida,jda) - + iedate(1:5)=(/jda(1),jda(2),jda(3),jda(5),jda(6)/) iadateend=jda(1)*1000000+jda(2)*10000+jda(3)*100+jda(5) diff --git a/src/gsi/gsi_unformatted.F90 b/src/gsi/gsi_unformatted.F90 index 1e5a4a5bff..7438fc9837 100644 --- a/src/gsi/gsi_unformatted.F90 +++ b/src/gsi/gsi_unformatted.F90 @@ -156,6 +156,7 @@ subroutine open_(unit,file,class,newunit,action,position,status,iostat,silent) #ifdef _DO_NOT_SUPPORT_OPEN_WITH_CONVERT_ convert_="_NOT_SUPPORTED_" ! open(file with the compiler default convert + write(6,*)'thinkdeb 1' if(newunit_) then open(newunit=unit,file=file,access='sequential',form='unformatted', & action=action_,position=position_,status=status_,iostat=iostat_) @@ -166,8 +167,10 @@ subroutine open_(unit,file,class,newunit,action,position,status,iostat,silent) #else convert_="_NOT_FOUND_" ! set a difault value + write(6,*)'thinkdeb 2' call lookup_(class_,convert_,silent=silent) ! may override convert value, if an entry of class_ is found. call lookup_(file ,convert_,silent=silent) ! may override convert value, if an entry of file is found. + write(6,*)'thinkdeb 2.2' select case(convert_) case("","_NOT_FOUND_") ! open(file) with the compiler default convert diff --git a/src/gsi/read_obs.F90 b/src/gsi/read_obs.F90 index bdabfc8efe..1937df3b67 100644 --- a/src/gsi/read_obs.F90 +++ b/src/gsi/read_obs.F90 @@ -1822,8 +1822,9 @@ subroutine read_obs(ndata,mype) write(lunsave) super_val1 write(lunsave) nobs_sub close(lunsave) + write(6,*) 'thinkdeb in read_obs 1' + call flush(6) endif - ! End of routine return end subroutine read_obs diff --git a/src/gsi/setuprhsall.f90 b/src/gsi/setuprhsall.f90 index ba17c0cb30..1edb2e8df2 100644 --- a/src/gsi/setuprhsall.f90 +++ b/src/gsi/setuprhsall.f90 @@ -492,13 +492,16 @@ subroutine setuprhsall(ndata,mype,init_pass,last_pass) end if + write(6,*)'thinkdeb999 setuprhsall ndatinobs ',ndat,nsat1(1) ! Loop over data types to process do is=1,ndat nobs=nsat1(is) + write(6,*)'thinkdeb999 setuprhsall ditype is ',ditype(is) if(nobs > 0)then read(lunin,iostat=ier) obstype,isis,nreal,nchanl + write(6,*)'thinkdeb999 setuprhsall obtyp is ', obstype ! if(mype == mype_diaghdr(is)) then ! write(6,300) obstype,isis,nreal,nchanl !300 format(' SETUPALL:,obstype,isis,nreal,nchanl=',a12,a20,i5,i5) From 68c349926c8283752de5cf41f96cd877b82fe85f Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Mon, 1 Jul 2019 16:06:35 +0000 Subject: [PATCH 022/155] check in some temperary debug lines --- src/gsi/gesinfo.f90 | 4 ++ src/gsi/gsi_rfv3io_mod.f90 | 4 +- src/gsi/mod_fv3_lolgrid.f90 | 104 ++++++++++++++++++------------------ src/gsi/radinfo.f90 | 4 +- src/gsi/read_goesndr.f90 | 4 ++ 5 files changed, 65 insertions(+), 55 deletions(-) diff --git a/src/gsi/gesinfo.f90 b/src/gsi/gesinfo.f90 index 871830a3ea..94d8c90d0b 100644 --- a/src/gsi/gesinfo.f90 +++ b/src/gsi/gesinfo.f90 @@ -154,6 +154,7 @@ subroutine gesinfo idate4(5)=regional_time(5) ! minutes hourg=regional_fhr ! fcst hour minuteg=regional_fmin ! fcst minute + write(6,*)'thinkdeb3 regional_fmin ',regional_fmin ! Handle RURTMA date: get iadatemn iadatemn(1)=regional_time(1) ! year iadatemn(2)=regional_time(2) ! month @@ -461,6 +462,7 @@ subroutine gesinfo end if fha=zero; ida=0; jda=0 fha(2)=ihourg ! relative time interval in hours + write(6,*)'thinkdeb3 minuteg is ',minuteg if(regional) fha(3)=minuteg ! relative time interval in minutes ida(1)=iyr ! year ida(2)=idate4(2) ! month @@ -468,6 +470,8 @@ subroutine gesinfo ida(4)=0 ! time zone ida(5)=idate4(1) ! hour if(regional) ida(6)=idate4(5) ! minute + write(6,*)'thinkdeb fha ida, jda ',fha,ida,jda + call flush(6) call w3movdat(fha,ida,jda) iadate(1)=jda(1) ! year iadate(2)=jda(2) ! mon diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index f8b612cf5f..5df5410828 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -181,7 +181,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) use mpimod, only: mype !cltorg use mod_fv3_lola, only: generate_anl_grid use mod_fv3_lolgrid, only: generate_regular_grids - use gridmod, only:nsig,regional_time,regional_fhr,aeta1_ll,aeta2_ll + use gridmod, only:nsig,regional_time,regional_fhr,regional_fmin,aeta1_ll,aeta2_ll use gridmod, only:nlon_regional,nlat_regional,eta1_ll,eta2_ll use gridmod, only:region_lat,region_lon,nlat,nlon use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx @@ -227,6 +227,8 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) regional_time(5)=mminute regional_time(6)=msecond regional_fhr=zero ! forecast hour set zero for now + regional_fmin=zero ! forecast min set zero for now + write(6,*)'thinkdeb regional_time is ',regional_time !!!!!!!!!! grid_spec !!!!!!!!!!!!!!! ierr=0 diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 7a4cef06e4..151b78cc94 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -70,11 +70,11 @@ module mod_fv3_lolgrid type fv3sar2grid_parm logical bilinear integer(i_kind) nxout,nyout,nx,ny - real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 - integer(i_kind),pointer,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp - real(r_kind) ,pointer,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 - real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv - integer(i_kind),pointer,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + real(r_kind) ,pointer,dimension(:,:):: fv3dx=>null(),fv3dx1=>null(),fv3dy=>null(),fv3dy1=>null() + integer(i_kind),pointer,dimension(:,:):: fv3ix=>null(),fv3ixp=>null(),fv3jy=>null(),fv3jyp=>null() + real(r_kind) ,pointer,dimension(:,:):: a3dx=>null(),a3dx1=>null(),a3dy=>null(),a3dy1=>null() + real(r_kind) ,pointer,dimension(:,:):: cangu=>null(),sangu=>null(),cangv=>null(),sangv=>null() + integer(i_kind),pointer,dimension(:,:):: a3ix=>null(),a3ixp=>null(),a3jy=>null(),a3jyp=>null() end type type (fv3sar2grid_parm)::p_fv3sar2anlgrid,p_fv3sar2ensgrid integer(i_kind) nxa,nya @@ -221,8 +221,8 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ p_fv3sar2grid%nyout=nyout nlatout=p_fv3sar2grid%nyout nlonout=p_fv3sar2grid%nxout - nxa=nx - nya=ny ! for compatiability + nxa=nxout + nya=nyout ! for compatiability if(mype==0) print *,'nlatout,nlonout = ',nlatout,nlonout !--------------------------obtain analysis grid spacing @@ -361,14 +361,14 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ !!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! allocate ( p_fv3sar2grid%fv3dx(nxout,nyout),p_fv3sar2grid%fv3dx1(nxout,nyout),p_fv3sar2grid%fv3dy(nxout,nyout),p_fv3sar2grid%fv3dy1(nxout,nyout) ) allocate ( p_fv3sar2grid%fv3ix(nxout,nyout),p_fv3sar2grid%fv3ixp(nxout,nyout),p_fv3sar2grid%fv3jy(nxout,nyout),p_fv3sar2grid%fv3jyp(nxout,nyout) ) - fv3dx=p_fv3sar2grid%fv3dx - fv3dx1=p_fv3sar2grid%fv3dx1 - fv3dy=p_fv3sar2grid%fv3dy - fv3dy1=p_fv3sar2grid%fv3dy1 - fv3ix=p_fv3sar2grid%fv3ix - fv3ixp=p_fv3sar2grid%fv3ixp - fv3jy=p_fv3sar2grid%fv3jy - fv3jyp=p_fv3sar2grid%fv3jyp + fv3dx=>p_fv3sar2grid%fv3dx + fv3dx1=>p_fv3sar2grid%fv3dx1 + fv3dy=>p_fv3sar2grid%fv3dy + fv3dy1=>p_fv3sar2grid%fv3dy1 + fv3ix=>p_fv3sar2grid%fv3ix + fv3ixp=>p_fv3sar2grid%fv3ixp + fv3jy=>p_fv3sar2grid%fv3jy + fv3jyp=>p_fv3sar2grid%fv3jyp allocate(yy(ny)) @@ -502,15 +502,15 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ !!!!!compute A to fv3 grid interpolation parameters !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1111 allocate ( p_fv3sar2grid%a3dx(ny,nx),p_fv3sar2grid%a3dx1(ny,nx),p_fv3sar2grid%a3dy(ny,nx),p_fv3sar2grid%a3dy1(ny,nx) ) allocate ( p_fv3sar2grid%a3ix(ny,nx),p_fv3sar2grid%a3ixp(ny,nx),p_fv3sar2grid%a3jy(ny,nx),p_fv3sar2grid%a3jyp(ny,nx) ) - a3dx =p_fv3sar2grid%a3dx - a3dx1=p_fv3sar2grid%a3dx1 - a3dy =p_fv3sar2grid%a3dy - a3dy1=p_fv3sar2grid%a3dy1 - - a3ix =p_fv3sar2grid%a3ix - a3ixp =p_fv3sar2grid%a3ixp - a3jy =p_fv3sar2grid%a3jy - a3jyp=p_fv3sar2grid%a3jyp + a3dx =>p_fv3sar2grid%a3dx + a3dx1=>p_fv3sar2grid%a3dx1 + a3dy =>p_fv3sar2grid%a3dy + a3dy1=>p_fv3sar2grid%a3dy1 + + a3ix =>p_fv3sar2grid%a3ix + a3ixp =>p_fv3sar2grid%a3ixp + a3jy =>p_fv3sar2grid%a3jy + a3jyp=>p_fv3sar2grid%a3jyp do i=1,nx do j=1,ny @@ -553,10 +553,10 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! allocate ( p_fv3sar2grid%cangu(nx,ny+1),p_fv3sar2grid%sangu(nx,ny+1),p_fv3sar2grid%cangv(nx+1,ny),p_fv3sar2grid%sangv(nx+1,ny) ) - cangu=p_fv3sar2grid%cangu - sangu=p_fv3sar2grid%sangu - sangu=p_fv3sar2grid%cangv - sangu=p_fv3sar2grid%sangv + cangu=>p_fv3sar2grid%cangu + sangu=>p_fv3sar2grid%sangu + cangv=>p_fv3sar2grid%cangv + sangv=>p_fv3sar2grid%sangv ! 1. compute x,y,z at cell cornor from grid_lon, grid_lat @@ -646,10 +646,10 @@ subroutine earthuv2fv3_regular_grids(u,v,nx,ny,u_out,v_out,p_fv3sar2grid) real(r_kind),intent( out) :: u_out(nx,ny+1),v_out(nx+1,ny) integer(i_kind) i,j real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv - cangu=p_fv3sar2grid%cangu - sangu=p_fv3sar2grid%sangu - sangu=p_fv3sar2grid%cangv - sangu=p_fv3sar2grid%sangv + cangu=>p_fv3sar2grid%cangu + sangu=>p_fv3sar2grid%sangu + cangv=>p_fv3sar2grid%cangv + sangv=>p_fv3sar2grid%sangv !!!!!!! earth u/v to covariant u/v @@ -711,10 +711,10 @@ subroutine fv3uv2earth_regular_grids(u,v,nx,ny,u_out,v_out,p_fv3sar2grid) real(r_kind),intent( out) :: u_out(nx,ny),v_out(nx,ny) integer(i_kind) i,j real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv - cangu=p_fv3sar2grid%cangu - sangu=p_fv3sar2grid%sangu - sangu=p_fv3sar2grid%cangv - sangu=p_fv3sar2grid%sangv + cangu=>p_fv3sar2grid%cangu + sangu=>p_fv3sar2grid%sangu + cangv=>p_fv3sar2grid%cangv + sangv=>p_fv3sar2grid%sangv do j=1,ny do i=1,nx @@ -771,14 +771,14 @@ subroutine fv3_h_to_ll_regular_grids(b_in,a,nb,mb,na,ma,p_fv3sar2grid) real(r_kind) b(nb,mb) bilinear= p_fv3sar2grid%bilinear - fv3dx=p_fv3sar2grid%fv3dx - fv3dx1=p_fv3sar2grid%fv3dx1 - fv3dy=p_fv3sar2grid%fv3dy - fv3dy1=p_fv3sar2grid%fv3dy1 - fv3ix=p_fv3sar2grid%fv3ix - fv3ixp=p_fv3sar2grid%fv3ixp - fv3jy=p_fv3sar2grid%fv3jy - fv3jyp=p_fv3sar2grid%fv3jyp + fv3dx=>p_fv3sar2grid%fv3dx + fv3dx1=>p_fv3sar2grid%fv3dx1 + fv3dy=>p_fv3sar2grid%fv3dy + fv3dy1=>p_fv3sar2grid%fv3dy1 + fv3ix=>p_fv3sar2grid%fv3ix + fv3ixp=>p_fv3sar2grid%fv3ixp + fv3jy=>p_fv3sar2grid%fv3jy + fv3jyp=>p_fv3sar2grid%fv3jyp !!!!!!!!! reverse E-W and N-S mbp=mb+1 @@ -852,15 +852,15 @@ subroutine fv3_ll_to_h_regular_grids(a,b,nxa,nya,nxb,nyb,rev_flg,p_fv3sar2grid) integer(i_kind) i,j,ir,jr,nybp,nxbp,ijr - a3dx =p_fv3sar2grid%a3dx - a3dx1=p_fv3sar2grid%a3dx1 - a3dy =p_fv3sar2grid%a3dy - a3dy1=p_fv3sar2grid%a3dy1 + a3dx =>p_fv3sar2grid%a3dx + a3dx1=>p_fv3sar2grid%a3dx1 + a3dy =>p_fv3sar2grid%a3dy + a3dy1=>p_fv3sar2grid%a3dy1 - a3ix =p_fv3sar2grid%a3ix - a3ixp =p_fv3sar2grid%a3ixp - a3jy =p_fv3sar2grid%a3jy - a3jyp=p_fv3sar2grid%a3jyp + a3ix =>p_fv3sar2grid%a3ix + a3ixp =>p_fv3sar2grid%a3ixp + a3jy =>p_fv3sar2grid%a3jy + a3jyp=>p_fv3sar2grid%a3jyp if(rev_flg)then !!!!!!!!!! output in reverse E-W, N-S and reversed i,j !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/gsi/radinfo.f90 b/src/gsi/radinfo.f90 index 62229d0689..a62f170c4c 100644 --- a/src/gsi/radinfo.f90 +++ b/src/gsi/radinfo.f90 @@ -1063,8 +1063,8 @@ subroutine radinfo_read(miter) open(lunout,file='satbias_ang.out',form='formatted') write(lunout,'(I5)') maxscan do j=1,jpch_rad - write(lunout,'(I5,1x,A20,2x,I4,e15.6/100(4x,10f7.3/))') & - j,nusis(j),nuchan(j),tlapmean(j),(cbias(i,j),i=1,maxscan) + !cltthinkdeb write(lunout,'(I5,1x,A20,2x,I4,e15.6/100(4x,10f7.3/))') & +!cltthinkdeb j,nusis(j),nuchan(j),tlapmean(j),(cbias(i,j),i=1,maxscan) end do close(lunout) end if diff --git a/src/gsi/read_goesndr.f90 b/src/gsi/read_goesndr.f90 index 636d6acbce..b9e740e747 100644 --- a/src/gsi/read_goesndr.f90 +++ b/src/gsi/read_goesndr.f90 @@ -302,6 +302,10 @@ subroutine read_goesndr(mype,val_goes,ithin,rmesh,jsatid,infile,& ! if not proper satellite/detector read next bufr record if (ksatid /=lsatid) cycle read_loop if(obstype /= 'sndr')then + +!cltorg if(abs(hdr(8)-ldetect).gt. 100) cycle read_loop !cltthinkdeb to + !avoid large value of hdr(8) (100000??) would cause nint(hdr(8)) aborted when + !compiled with debug mode if(ldetect /= nint(hdr(8)))cycle read_loop end if From b18b85e553e515a95d0b84425746ccc7cfc0dc6d Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Tue, 9 Jul 2019 20:31:42 +0000 Subject: [PATCH 023/155] minor modifications --- src/gsi/mod_fv3_lolgrid.f90 | 5 +++-- src/gsi/prt_guess.f90 | 31 +++++++++++++++++-------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 151b78cc94..c3bf99d131 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -309,10 +309,11 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ call unrotate2deg(region_lon_out,region_lat_out,rlon_in,rlat_in, & centlon,centlat,nlatout,nlonout) - if (present(coeffx_out)) then ! if coeffx_out is present, this is for analysis grid - allocate(glat_an(nlonout,nlatout),glon_an(nlonout,nlatout)) region_lat_out=region_lat_out*deg2rad region_lon_out=region_lon_out*deg2rad + if (present(coeffx_out)) then ! if coeffx_out is present, this is for analysis grid + write(6,*)'thinkdeb250 present coeffx_out' + allocate(glat_an(nlonout,nlatout),glon_an(nlonout,nlatout)) do j=1,nlatout do i=1,nlonout diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 5b44e71652..78692f9420 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -71,7 +71,7 @@ subroutine prt_guess(sgrep) character(len=4) :: cvar(nvars+3) !******************************************************************************* - + write(6,*)'thinkdeb250 in prt_guess' ntsig = ntguessig ntsfc = ntguessfc @@ -92,7 +92,7 @@ subroutine prt_guess(sgrep) ier=ier+istatus call gsi_bundlegetpointer (gsi_metguess_bundle(ntsig),'oz',ges_oz_it,istatus) ier=ier+istatus - if (ier/=0) return ! this is a fundamental routine, when some not found just return +!cltthinkdeb if (ier/=0) return ! this is a fundamental routine, when some not found just return ! get pointer to cloud water condensate call gsi_metguess_get('clouds::3d',n_actual_clouds,ier) @@ -112,7 +112,7 @@ subroutine prt_guess(sgrep) ier=99 endif end if - if (ier/=0) return ! this is a fundamental routine, when some not found just return +!cltorgthink if (ier/=0) return ! this is a fundamental routine, when some not found just return cvar( 1)='U ' cvar( 2)='V ' @@ -129,16 +129,16 @@ subroutine prt_guess(sgrep) cvar(13)='radb' cvar(14)='pcpb' cvar(15)='aftb' - + zloc=0.0 zloc(1) = sum (ges_u_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2) = sum (ges_v_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(3) = sum (ges_tv_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(4) = sum (ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(5) = sum (ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(6) = sum (ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(7) = sum (ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(8) = sum (ges_div_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(9) = sum (ges_vor_it (2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(7) = sum (ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(8) = sum (ges_div_it (2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(9) = sum (ges_vor_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(10) = sum (ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(11) = sum (ges_ps_it (2:lat1+1,2:lon1+1 )) zloc(12) = sum (sfct (2:lat1+1,2:lon1+1, ntsfc)) @@ -148,21 +148,21 @@ subroutine prt_guess(sgrep) zloc(nvars+4) = minval(ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(nvars+5) = minval(ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(nvars+6) = minval(ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+7) = minval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+8) = minval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+9) = minval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+7) = minval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+8) = minval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+9) = minval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) zloc(nvars+10) = minval(ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(nvars+11) = minval(ges_ps_it (2:lat1+1,2:lon1+1 )) - zloc(nvars+12) = minval(sfct (2:lat1+1,2:lon1+1, ntsfc)) +!clt zloc(nvars+12) = minval(sfct (2:lat1+1,2:lon1+1, ntsfc)) zloc(2*nvars+1) = maxval(ges_u_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+2) = maxval(ges_v_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+3) = maxval(ges_tv_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+4) = maxval(ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+5) = maxval(ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(2*nvars+6) = maxval(ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+7) = maxval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+8) = maxval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+9) = maxval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+7) = maxval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+8) = maxval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+9) = maxval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+10) = maxval(ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(2*nvars+11) = maxval(ges_ps_it (2:lat1+1,2:lon1+1 )) zloc(2*nvars+12) = maxval(sfct (2:lat1+1,2:lon1+1, ntsfc)) @@ -193,6 +193,9 @@ subroutine prt_guess(sgrep) enddo ! Duplicated part of vector + predx=0.0 !cltthink + predxp=0.0 !cltthink + predt=0.0 !cltthink if (nsclen>0) then zmin(nvars+1) = minval(predx(:,:)) zmax(nvars+1) = maxval(predx(:,:)) From 2daa61e22d9fb1b9c367fb0eb4e615a4659e24ae Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 10 Jul 2019 16:00:54 +0000 Subject: [PATCH 024/155] after some cleaning up --- src/gsi/gsi_rfv3io_mod.f90 | 14 +------------- src/gsi/hybrid_ensemble_isotropic.F90 | 1 - src/gsi/prt_guess.f90 | 27 +++++++++++++-------------- src/gsi/read_dbz_netcdf.f90 | 1 - src/gsi/setuprhsall.f90 | 3 --- 5 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index f9754d5fbc..44862bdbce 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -265,10 +265,6 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) iret=nf90_get_var(gfile_loc,k,grid_lont) endif enddo - write(6,*)'thinkdeb9992 grid_lont i j=12, is ',grid_lont(10:100:10,12) - write(6,*)'thinkdeb9992 grid_lont i j=240 is ',grid_lont(10:100:10,24) - write(6,*)'thinkdeb9992 grid_latt i=12 is ',grid_latt(12, 12:112:10) - write(6,*)'thinkdeb9992 grid_latt i=240 is ',grid_latt(240,10:112:10) iret=nf90_close(gfile_loc) @@ -985,9 +981,8 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) allocate(a(nlat,nlon)) iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) - write(6,*)'thinkdeb99 iret,var_id is ',var_id if(iret/=nf90_noerr) then - write(6,*)'thinkdeb999 wrong to get var_id ',var_id + write(6,*)' wrong to get var_id ',var_id endif iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) @@ -995,13 +990,9 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) allocate(dim_id(ndim)) iret=nf90_inquire_variable(gfile_loc,var_id,dimids=dim_id) if(allocated(uu )) deallocate(uu ) -!cltorg allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) allocate(uu(nx,ny,1)) iret=nf90_get_var(gfile_loc,var_id,uu) - write(6,*)'thinkdeb999 varname ',trim(adjustl(varname)) - write(6,*)'thinkdeb999 in readeps uu ps is ',uu(10,10,1) call fv3_h_to_ll(uu(:,:,1),a,nx,ny,nlon,nlat) - write(6,*)'thinkdeb999 in readeps aps is ',a(10,10) kk=0 do n=1,npe do j=1,ijn_s(n) @@ -1333,10 +1324,8 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) allocate(u(dim(1),dim(4))) allocate(v(dim(1),dim(4))) - write(6,*)'thinkdeb999 0 u,v dims are',dim(1),dim(4) iret=nf90_inq_varid(gfile_loc,trim(adjustl("xaxis_1")),k) !thinkdeb iret=nf90_get_var(gfile_loc,k,u(:,1)) - write(6,*)'thinkdeb9992 in origin readuv ',u(1:10,1) do k=ndimensions+1,nvariables iret=nf90_inquire_variable(gfile_loc,k,name,len) @@ -1349,7 +1338,6 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) ! NOTE: dimension of variables on native fv3 grid. ! u and v have an extra row in one of the dimensions if(allocated(uu)) deallocate(uu) - write(6,*)'thinkdeb999 varname dim is ',(trim(name)),dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)) allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,k,uu) if(trim(name)=='u'.or.trim(name)=='U') then diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 9b750c8318..c46c6d75a0 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1319,7 +1319,6 @@ subroutine load_ensemble end if call stop2(999) end if - write(6,*)'thinkdeb9990-1 regional_ensemble_option is ',regional_ensemble_option select case(regional_ensemble_option) case(1) diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 5b44e71652..9015ad01b9 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -71,7 +71,6 @@ subroutine prt_guess(sgrep) character(len=4) :: cvar(nvars+3) !******************************************************************************* - ntsig = ntguessig ntsfc = ntguessfc @@ -92,7 +91,7 @@ subroutine prt_guess(sgrep) ier=ier+istatus call gsi_bundlegetpointer (gsi_metguess_bundle(ntsig),'oz',ges_oz_it,istatus) ier=ier+istatus - if (ier/=0) return ! this is a fundamental routine, when some not found just return +!cltthinkdeb if (ier/=0) return ! this is a fundamental routine, when some not found just return ! get pointer to cloud water condensate call gsi_metguess_get('clouds::3d',n_actual_clouds,ier) @@ -112,7 +111,7 @@ subroutine prt_guess(sgrep) ier=99 endif end if - if (ier/=0) return ! this is a fundamental routine, when some not found just return +!cltorgthink if (ier/=0) return ! this is a fundamental routine, when some not found just return cvar( 1)='U ' cvar( 2)='V ' @@ -129,16 +128,16 @@ subroutine prt_guess(sgrep) cvar(13)='radb' cvar(14)='pcpb' cvar(15)='aftb' - + zloc=0.0 zloc(1) = sum (ges_u_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2) = sum (ges_v_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(3) = sum (ges_tv_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(4) = sum (ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(5) = sum (ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(6) = sum (ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(7) = sum (ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(8) = sum (ges_div_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(9) = sum (ges_vor_it (2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(7) = sum (ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(8) = sum (ges_div_it (2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(9) = sum (ges_vor_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(10) = sum (ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(11) = sum (ges_ps_it (2:lat1+1,2:lon1+1 )) zloc(12) = sum (sfct (2:lat1+1,2:lon1+1, ntsfc)) @@ -148,21 +147,21 @@ subroutine prt_guess(sgrep) zloc(nvars+4) = minval(ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(nvars+5) = minval(ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(nvars+6) = minval(ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+7) = minval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+8) = minval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(nvars+9) = minval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+7) = minval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+8) = minval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(nvars+9) = minval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) zloc(nvars+10) = minval(ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(nvars+11) = minval(ges_ps_it (2:lat1+1,2:lon1+1 )) - zloc(nvars+12) = minval(sfct (2:lat1+1,2:lon1+1, ntsfc)) +!clt zloc(nvars+12) = minval(sfct (2:lat1+1,2:lon1+1, ntsfc)) zloc(2*nvars+1) = maxval(ges_u_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+2) = maxval(ges_v_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+3) = maxval(ges_tv_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+4) = maxval(ges_q_it (2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+5) = maxval(ges_tsen (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(2*nvars+6) = maxval(ges_oz_it (2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+7) = maxval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+8) = maxval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) - zloc(2*nvars+9) = maxval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+7) = maxval(ges_cwmr_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+8) = maxval(ges_div_it(2:lat1+1,2:lon1+1,1:nsig)) +!clt zloc(2*nvars+9) = maxval(ges_vor_it(2:lat1+1,2:lon1+1,1:nsig)) zloc(2*nvars+10) = maxval(ges_prsl (2:lat1+1,2:lon1+1,1:nsig,ntsig)) zloc(2*nvars+11) = maxval(ges_ps_it (2:lat1+1,2:lon1+1 )) zloc(2*nvars+12) = maxval(sfct (2:lat1+1,2:lon1+1, ntsfc)) diff --git a/src/gsi/read_dbz_netcdf.f90 b/src/gsi/read_dbz_netcdf.f90 index 8db72363e9..e800dd14b8 100644 --- a/src/gsi/read_dbz_netcdf.f90 +++ b/src/gsi/read_dbz_netcdf.f90 @@ -599,7 +599,6 @@ subroutine read_dbz_mrms_netcdf(nread,ndata,nodata,infile,obstype,lunout,sis,nob write(6,*)'READ_dBZ: # ndata =',ndata !---Write observation to scratch file---! - write(6,*)'thinkmype is ',mype, ' ',maxdat,nchanl,ndata call count_obs(ndata,maxdat,ilat,ilon,cdata_all,nobs) write(lunout) obstype,sis,maxdat,nchanl,ilat,ilon diff --git a/src/gsi/setuprhsall.f90 b/src/gsi/setuprhsall.f90 index 7874763e3a..eefc71890c 100644 --- a/src/gsi/setuprhsall.f90 +++ b/src/gsi/setuprhsall.f90 @@ -495,16 +495,13 @@ subroutine setuprhsall(ndata,mype,init_pass,last_pass) end if - write(6,*)'thinkdeb999 setuprhsall ndatinobs ',ndat,nsat1(1) ! Loop over data types to process do is=1,ndat nobs=nsat1(is) - write(6,*)'thinkdeb999 setuprhsall ditype is ',ditype(is) if(nobs > 0)then read(lunin,iostat=ier) obstype,isis,nreal,nchanl - write(6,*)'thinkdeb999 setuprhsall obtyp is ', obstype ! if(mype == mype_diaghdr(is)) then ! write(6,300) obstype,isis,nreal,nchanl !300 format(' SETUPALL:,obstype,isis,nreal,nchanl=',a12,a20,i5,i5) From 49a015783d5eeff84bdfbd9c66a71961491cdec7 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 10 Jul 2019 16:30:44 +0000 Subject: [PATCH 025/155] mainly for cleaning up --- src/gsi/gsi_rfv3io_mod.f90 | 13 +------------ src/gsi/hybrid_ensemble_isotropic.F90 | 1 - src/gsi/mod_fv3_lolgrid.f90 | 1 - src/gsi/prt_guess.f90 | 6 ------ src/gsi/radinfo.f90 | 5 +++-- 5 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 5df5410828..ef1fd4c19a 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -272,10 +272,6 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) iret=nf90_get_var(gfile_loc,k,grid_lont) endif enddo - write(6,*)'thinkdeb9992 grid_lont i j=12, is ',grid_lont(10:100:10,12) - write(6,*)'thinkdeb9992 grid_lont i j=240 is ',grid_lont(10:100:10,24) - write(6,*)'thinkdeb9992 grid_latt i=12 is ',grid_latt(12, 12:112:10) - write(6,*)'thinkdeb9992 grid_latt i=240 is ',grid_latt(240,10:112:10) iret=nf90_close(gfile_loc) @@ -996,9 +992,8 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) allocate(a(nlat,nlon)) iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) - write(6,*)'thinkdeb99 iret,var_id is ',var_id if(iret/=nf90_noerr) then - write(6,*)'thinkdeb999 wrong to get var_id ',var_id + write(6,*)' wrong to get var_id ',var_id endif iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) @@ -1009,10 +1004,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) !cltorg allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) allocate(uu(nx,ny,1)) iret=nf90_get_var(gfile_loc,var_id,uu) - write(6,*)'thinkdeb999 varname ',trim(adjustl(varname)) - write(6,*)'thinkdeb999 in readeps uu ps is ',uu(10,10,1) call fv3_h_to_ll_regular_grids(uu(:,:,1),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) - write(6,*)'thinkdeb999 in readeps aps is ',a(10,10) kk=0 do n=1,npe do j=1,ijn_s(n) @@ -1344,10 +1336,8 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) allocate(u(dim(1),dim(4))) allocate(v(dim(1),dim(4))) - write(6,*)'thinkdeb999 0 u,v dims are',dim(1),dim(4) iret=nf90_inq_varid(gfile_loc,trim(adjustl("xaxis_1")),k) !thinkdeb iret=nf90_get_var(gfile_loc,k,u(:,1)) - write(6,*)'thinkdeb9992 in origin readuv ',u(1:10,1) do k=ndimensions+1,nvariables iret=nf90_inquire_variable(gfile_loc,k,name,len) @@ -1360,7 +1350,6 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) ! NOTE: dimension of variables on native fv3 grid. ! u and v have an extra row in one of the dimensions if(allocated(uu)) deallocate(uu) - write(6,*)'thinkdeb999 varname dim is ',(trim(name)),dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)) allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,k,uu) if(trim(name)=='u'.or.trim(name)=='U') then diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 9b750c8318..c46c6d75a0 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1319,7 +1319,6 @@ subroutine load_ensemble end if call stop2(999) end if - write(6,*)'thinkdeb9990-1 regional_ensemble_option is ',regional_ensemble_option select case(regional_ensemble_option) case(1) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index c3bf99d131..2764f6ee67 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -312,7 +312,6 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ region_lat_out=region_lat_out*deg2rad region_lon_out=region_lon_out*deg2rad if (present(coeffx_out)) then ! if coeffx_out is present, this is for analysis grid - write(6,*)'thinkdeb250 present coeffx_out' allocate(glat_an(nlonout,nlatout),glon_an(nlonout,nlatout)) do j=1,nlatout diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 78692f9420..92ec543fa2 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -71,7 +71,6 @@ subroutine prt_guess(sgrep) character(len=4) :: cvar(nvars+3) !******************************************************************************* - write(6,*)'thinkdeb250 in prt_guess' ntsig = ntguessig ntsfc = ntguessfc @@ -92,7 +91,6 @@ subroutine prt_guess(sgrep) ier=ier+istatus call gsi_bundlegetpointer (gsi_metguess_bundle(ntsig),'oz',ges_oz_it,istatus) ier=ier+istatus -!cltthinkdeb if (ier/=0) return ! this is a fundamental routine, when some not found just return ! get pointer to cloud water condensate call gsi_metguess_get('clouds::3d',n_actual_clouds,ier) @@ -112,7 +110,6 @@ subroutine prt_guess(sgrep) ier=99 endif end if -!cltorgthink if (ier/=0) return ! this is a fundamental routine, when some not found just return cvar( 1)='U ' cvar( 2)='V ' @@ -193,9 +190,6 @@ subroutine prt_guess(sgrep) enddo ! Duplicated part of vector - predx=0.0 !cltthink - predxp=0.0 !cltthink - predt=0.0 !cltthink if (nsclen>0) then zmin(nvars+1) = minval(predx(:,:)) zmax(nvars+1) = maxval(predx(:,:)) diff --git a/src/gsi/radinfo.f90 b/src/gsi/radinfo.f90 index a62f170c4c..251b0498a2 100644 --- a/src/gsi/radinfo.f90 +++ b/src/gsi/radinfo.f90 @@ -1063,8 +1063,9 @@ subroutine radinfo_read(miter) open(lunout,file='satbias_ang.out',form='formatted') write(lunout,'(I5)') maxscan do j=1,jpch_rad - !cltthinkdeb write(lunout,'(I5,1x,A20,2x,I4,e15.6/100(4x,10f7.3/))') & -!cltthinkdeb j,nusis(j),nuchan(j),tlapmean(j),(cbias(i,j),i=1,maxscan) +!clt, when compiled with debug mode, the following line may cause abortion + write(lunout,'(I5,1x,A20,2x,I4,e15.6/100(4x,10f7.3/))') & + j,nusis(j),nuchan(j),tlapmean(j),(cbias(i,j),i=1,maxscan) end do close(lunout) end if From 2e72cf26b678669ca41954f951db9cca5f2f8e25 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Tue, 23 Jul 2019 13:59:45 +0000 Subject: [PATCH 026/155] a basic version for dual resolution capability for FV3SAR ensembles --- src/gsi/gsi_rfv3io_mod.f90 | 121 +++++++ src/gsi/hybrid_ensemble_isotropic.F90 | 8 + src/gsi/mod_fv3_lolgrid.f90 | 469 ++++++++++++++++++++++++++ 3 files changed, 598 insertions(+) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index ef1fd4c19a..35a4a3a89b 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -36,6 +36,7 @@ module gsi_rfv3io_mod use kinds, only: r_kind,i_kind use gridmod, only: nlon_regional,nlat_regional use mod_fv3_lolgrid, only: p_fv3sar2anlgrid + use mod_fv3_lolgrid, only: p_fv3sar2ensgrid implicit none public type_fv3regfilenameg public bg_fv3regfilenameg @@ -65,6 +66,7 @@ module gsi_rfv3io_mod private ! set subroutines to public public :: gsi_rfv3io_get_grid_specs + public :: gsi_rfv3io_get_ens_grid_specs public :: gsi_fv3ncdf_read public :: gsi_fv3ncdf_read_v1 public :: gsi_fv3ncdf_readuv @@ -340,6 +342,125 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) return end subroutine gsi_rfv3io_get_grid_specs +subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_rfv3io_get_ens_grid_specs +! modified from gsi_rfv3io_get_grid_specs +! pgrmmr: parrish org: np22 date: 2017-04-03 +! +! abstract: obtain grid dimensions nx,ny and grid definitions +! grid_x,grid_xt,grid_y,grid_yt,grid_lon,grid_lont,grid_lat,grid_latt +! nz,ak(nz),bk(nz) +! +! program history log: +! 2017-04-03 parrish - initial documentation +! 2017-10-10 wu - setup A grid and interpolation coeff with generate_anl_grid +! 2018-02-16 wu - read in time info from file coupler.res +! read in lat, lon at the center and corner of the grid cell +! from file fv3_grid_spec, and vertical grid infor from file fv3_akbk +! setup A grid and interpolation/rotation coeff +! input argument list: +! grid_spec +! ak_bk +! lendian_out +! +! output argument list: +! ierr +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf, only: nf90_inquire_variable + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens + use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens + use mpimod, only: mype +!cltorg use mod_fv3_lola, only: generate_anl_grid + use mod_fv3_lolgrid, only: definecoef_regular_grids + use gridmod, only:region_lat,region_lon,nlat,nlon + use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx + use kinds, only: i_kind,r_kind + use constants, only: half,zero + use mpimod, only: mpi_comm_world,ierror,mpi_itype,mpi_rtype + + implicit none + + character(:),allocatable,intent(in) :: grid_spec + integer(i_kind) gfile_grid_spec,gfile_ak_bk,gfile_dynvars + integer(i_kind) gfile_tracers,gfile_sfcdata +! integer(i_kind) :: gfile +! save gfile + + type (type_fv3regfilenameg) :: fv3filenamegin + integer(i_kind),intent( out) :: ierr + integer(i_kind) i,k,ndimensions,iret,nvariables,nattributes,unlimiteddimid + integer(i_kind) len,gfile_loc + character(len=128) :: name + + + +!!!!! set regional_time +!cltorg open(24,file='coupler.res',form='formatted') + +!!!!!!!!!! grid_spec !!!!!!!!!!!!!!! + iret=nf90_open(trim(grid_spec),nf90_nowrite,gfile_grid_spec) + if(iret/=nf90_noerr) then + write(6,*)' problem opening1 ',trim(grid_spec),', Status = ',iret + ierr=1 + return + endif + + iret=nf90_inquire(gfile_grid_spec,ndimensions,nvariables,nattributes,unlimiteddimid) + gfile_loc=gfile_grid_spec + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc,k,name,len) + if(trim(name)=='grid_xt') nx=len + if(trim(name)=='grid_yt') ny=len + enddo + if(mype==0)write(6,*),'nx,ny=',nx,ny + +!!! get nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,nz,ak,bk + + allocate(grid_lat(nx+1,ny+1)) + allocate(grid_lon(nx+1,ny+1)) + allocate(grid_latt(nx,ny)) + allocate(grid_lont(nx,ny)) + + do k=ndimensions+1,nvariables + iret=nf90_inquire_variable(gfile_loc,k,name,len) + if(trim(name)=='grid_lat') then + iret=nf90_get_var(gfile_loc,k,grid_lat) + endif + if(trim(name)=='grid_lon') then + iret=nf90_get_var(gfile_loc,k,grid_lon) + endif + if(trim(name)=='grid_latt') then + iret=nf90_get_var(gfile_loc,k,grid_latt) + endif + if(trim(name)=='grid_lont') then + iret=nf90_get_var(gfile_loc,k,grid_lont) + endif + enddo + + iret=nf90_close(gfile_loc) + +!!! get ak,bk + + + +!!!!!!! setup A grid and interpolation/rotation coeff. + call definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & + nlat_ens,nlon_ens,region_lat_ens,region_lon_ens) + + deallocate (grid_lon,grid_lat,grid_lont,grid_latt) + + return +end subroutine gsi_rfv3io_get_ens_grid_specs subroutine read_fv3_files(mype) !$$$ subprogram documentation block diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index c46c6d75a0..bd91fe63ab 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3857,6 +3857,8 @@ subroutine hybens_grid_setup use constants, only: zero,one use control_vectors, only: cvars3d,nc2d,nc3d use gridmod, only: region_lat,region_lon,region_dx,region_dy + use hybrid_ensemble_parameters, only:regional_ensemble_option + use gsi_rfv3io_mod,only:gsi_rfv3io_get_ens_grid_specs implicit none @@ -3865,6 +3867,8 @@ subroutine hybens_grid_setup logical,allocatable::vector(:) real(r_kind) eps,r_e real(r_kind) rlon_a(nlon),rlat_a(nlat),rlon_e(nlon),rlat_e(nlat) + character(:),allocatable:: fv3_spec_grid_filename + integer :: ierr nord_e2a=4 ! soon, move this to hybrid_ensemble_parameters @@ -3951,6 +3955,10 @@ subroutine hybens_grid_setup else if(dual_res) then call get_region_dx_dy_ens(region_dx_ens,region_dy_ens) + if(regional_ensemble_option) then + fv3_spec_grid_filename="fv3_ens_grid_spec" + call gsi_rfv3io_get_ens_grid_specs(fv3_spec_grid_filename,ierr) + endif else region_dx_ens=region_dx region_dy_ens=region_dy diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 2764f6ee67..a474194417 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -61,6 +61,7 @@ module mod_fv3_lolgrid ! private public :: generate_regular_grids + public :: definecoef_regular_grids public :: fv3_h_to_ll_regular_grids,fv3_ll_to_h_regular_grids public :: fv3uv2earth_regular_grids,earthuv2fv3_regular_grids public :: fv3sar2grid_parm @@ -611,7 +612,475 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ enddo enddo deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) + deallocate(rlat_in,rlon_in) end subroutine generate_regular_grids +subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2grid,& + nlatin,nlonin,region_lat_in,region_lon_in) +!$$$ subprogram documentation block +! . . . . +! subprogram: generate_??ens_grid +!clt modified from generate_regular_grid +! prgmmr: parrish +! +! abstract: define rotated lat-lon analysis grid which is centered on fv3 tile +! and oriented to completely cover the tile. +! +! program history log: +! 2017-05-02 parrish +! 2017-10-10 wu - 1. setup analysis A-grid, +! 2. compute/setup FV3 to A grid interpolation parameters +! 3. compute/setup A to FV3 grid interpolation parameters +! 4. setup weightings for wind conversion from FV3 to earth +! +! input argument list: +! nx, ny - number of cells = nx*ny +! grid_lon ,grid_lat - longitudes and latitudes of fv3 grid cell corners +! grid_lont,grid_latt - longitudes and latitudes of fv3 grid cell centers +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: quarter,one,two,half,zero,deg2rad,rearth,rad2deg + use gridmod, only:grid_ratio_fv3_regional + use mpimod, only: mype + use gridmod, only:init_general_transform + implicit none + type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid + real(r_kind),allocatable,intent(out):: region_lat_in(:,:),region_lon_in(:,:) + integer(i_kind), intent(out):: nlatin,nlonin + + + real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 + integer(i_kind),pointer,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp + real(r_kind) ,pointer,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 + real(r_kind) ,pointer,dimension(:,:):: cangu,sangu,cangv,sangv + integer(i_kind),pointer,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + + real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b + real(r_kind),allocatable,dimension(:)::ybh_a,ya_a,ya_b,yy + real(r_kind),allocatable,dimension(:,:)::xbh_b,ybh_b + real(r_kind) dlat,dlon,dyy,dxx,dyyi,dxxi + real(r_kind) dyyh,dxxh + + + integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + real(r_kind) , intent(inout) :: grid_lon(nx+1,ny+1) ! fv3 cell corner longitudes + real(r_kind) , intent(inout) :: grid_lont(nx,ny) ! fv3 cell center longitudes + real(r_kind) , intent(inout) :: grid_lat(nx+1,ny+1) ! fv3 cell corner latitudes + real(r_kind) , intent(inout) :: grid_latt(nx,ny) ! fv3 cell center latitudes + logical :: bilinear + integer(i_kind) i,j,ir,jr,n + real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in + real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an + real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon + real(r_kind) adlon,adlat,alon,clat,clon + integer(i_kind) nxout,nyout + integer(i_kind) nlonh,nlath,nxh,nyh + integer(i_kind) ib1,ib2,jb1,jb2,jj + integer (i_kind):: index0 + + integer(i_kind) nord_e2a + real(r_kind)gxa,gya + + real(r_kind) x(nx+1,ny+1),y(nx+1,ny+1),z(nx+1,ny+1), xr,yr,zr,xu,yu,zu,rlat,rlon + real(r_kind) xv,yv,zv,vval + real(r_kind) cx,cy + real(r_kind) uval,ewval,nsval + + real(r_kind) d(4),ds + integer(i_kind) kk,k + + + nord_e2a=4 + bilinear=.false. + p_fv3sar2grid%bilinear=bilinear + + +! create xc,yc,zc for the cell centers. + allocate(xc(nx,ny)) + allocate(yc(nx,ny)) + allocate(zc(nx,ny)) + allocate(gclat(nx,ny)) + allocate(gclon(nx,ny)) + allocate(gcrlat(nx,ny)) + allocate(gcrlon(nx,ny)) + do j=1,ny + do i=1,nx + xc(i,j)=cos(grid_latt(i,j)*deg2rad)*cos(grid_lont(i,j)*deg2rad) + yc(i,j)=cos(grid_latt(i,j)*deg2rad)*sin(grid_lont(i,j)*deg2rad) + zc(i,j)=sin(grid_latt(i,j)*deg2rad) + enddo + enddo + +! compute center as average x,y,z coordinates of corners of domain -- + + xcent=quarter*(xc(1,1)+xc(1,ny)+xc(nx,1)+xc(nx,ny)) + ycent=quarter*(yc(1,1)+yc(1,ny)+yc(nx,1)+yc(nx,ny)) + zcent=quarter*(zc(1,1)+zc(1,ny)+zc(nx,1)+zc(nx,ny)) + + rnorm=one/sqrt(xcent**2+ycent**2+zcent**2) + xcent=rnorm*xcent + ycent=rnorm*ycent + zcent=rnorm*zcent + centlat=asin(zcent)*rad2deg + centlon=atan2(ycent,xcent)*rad2deg + +!! compute new lats, lons + call rotate2deg(grid_lont,grid_latt,gcrlon,gcrlat, & + centlon,centlat,nx,ny) + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! compute analysis A-grid lats, lons +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +!--------------------------obtain analysis grid dimensions nxout,nyout + p_fv3sar2grid%nx=nx + p_fv3sar2grid%ny=ny + nxout=nlonin + p_fv3sar2grid%nxout=nxout + nyout=nlatin + p_fv3sar2grid%nyout=nyout + nxa=nxout + nya=nyout ! for compatiability + if(mype==0) print *,'nlatin,nlonin = ',nlatin,nlonin + +!--------------------------obtain analysis grid spacing + dlat=(maxval(gcrlat)-minval(gcrlat))/(ny-1) + dlon=(maxval(gcrlon)-minval(gcrlon))/(nx-1) + adlat=dlat*grid_ratio_fv3_regional + adlon=dlon*grid_ratio_fv3_regional + +!-------setup analysis A-grid; find center of the domain + nlonh=nlonin/2 + nlath=nlatin/2 + + if(nlonh*2==nlonin)then + clon=adlon/two + cx=half + else + clon=adlon + cx=one + endif + + if(nlath*2==nlatin)then + clat=adlat/two + cy=half + else + clat=adlat + cy=one + endif + allocate(rlat_in(nlatin,nlonin),rlon_in(nlatin,nlonin)) + call rotate2deg(region_lon_in,region_lat_in,rlon_in,rlat_in, & + clon,clat,nlatin,nlonin) + +! +!-----setup analysis A-grid from center of the domain +! +!--------------------compute all combinations of relative coordinates + + allocate(xbh_a(nx),xbh_b(nx,ny),xa_a(nxout),xa_b(nxout)) + allocate(ybh_a(ny),ybh_b(nx,ny),ya_a(nyout),ya_b(nyout)) + + nxh=nx/2 + nyh=ny/2 + +!!!!!! fv3 rotated grid; not equal spacing, non_orthogonal !!!!!! + do j=1,ny + jr=ny+1-j + do i=1,nx + ir=nx+1-i + xbh_b(ir,jr)=gcrlon(i,j)/dlon + end do + end do + do j=1,ny + jr=ny+1-j + do i=1,nx + ir=nx+1-i + ybh_b(ir,jr)=gcrlat(i,j)/dlat + end do + end do + +!!!! define analysis A grid !!!!!!!!!!!!! + + + + do j=1,nxout + xa_a(j)=(float(j-nlonh)-cx)*grid_ratio_fv3_regional + end do + do i=1,nyout + ya_a(i)=(float(i-nlath)-cy)*grid_ratio_fv3_regional + end do + + index0=1 +!cltthinkdeb should region_lon_in be in degree or not? + do j=1,nxa + xa_a(j)= (rlon_in(index0,j)-clon)/dlon + end do + do i=1,nya + ya_a(i)= (rlat_in(i,index0)-clat)/dlon + end do + +!!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! + allocate ( p_fv3sar2grid%fv3dx(nxout,nyout),p_fv3sar2grid%fv3dx1(nxout,nyout),p_fv3sar2grid%fv3dy(nxout,nyout),p_fv3sar2grid%fv3dy1(nxout,nyout) ) + allocate ( p_fv3sar2grid%fv3ix(nxout,nyout),p_fv3sar2grid%fv3ixp(nxout,nyout),p_fv3sar2grid%fv3jy(nxout,nyout),p_fv3sar2grid%fv3jyp(nxout,nyout) ) + fv3dx=>p_fv3sar2grid%fv3dx + fv3dx1=>p_fv3sar2grid%fv3dx1 + fv3dy=>p_fv3sar2grid%fv3dy + fv3dy1=>p_fv3sar2grid%fv3dy1 + fv3ix=>p_fv3sar2grid%fv3ix + fv3ixp=>p_fv3sar2grid%fv3ixp + fv3jy=>p_fv3sar2grid%fv3jy + fv3jyp=>p_fv3sar2grid%fv3jyp + + allocate(yy(ny)) + +! iteration to find the fv3 grid cell + jb1=1 + ib1=1 + do j=1,nyout + do i=1,nxout + do n=1,3 + gxa=xa_a(i) + if(gxa < xbh_b(1,jb1))then + gxa= 1 + else if(gxa > xbh_b(nx,jb1))then + gxa= nx + else + call grdcrd1(gxa,xbh_b(1,jb1),nx,1) + endif + ib2=ib1 + ib1=gxa + do jj=1,ny + yy(jj)=ybh_b(ib1,jj) + enddo + gya=ya_a(j) + if(gya < yy(1))then + gya= 1 + else if(gya > yy(ny))then + gya= ny + else + call grdcrd1(gya,yy,ny,1) + endif + jb2=jb1 + jb1=gya + + if((ib1 == ib2) .and. (jb1 == jb2)) exit + if(n==3 ) then +!!!!!!! if not converge, find the nearest corner point + d(1)=(xa_a(i)-xbh_b(ib1,jb1))**2+(ya_a(j)-ybh_b(ib1,jb1))**2 + d(2)=(xa_a(i)-xbh_b(ib1+1,jb1))**2+(ya_a(j)-ybh_b(ib1+1,jb1))**2 + d(3)=(xa_a(i)-xbh_b(ib1,jb1+1))**2+(ya_a(j)-ybh_b(ib1,jb1+1))**2 + d(4)=(xa_a(i)-xbh_b(ib1+1,jb1+1))**2+(ya_a(j)-ybh_b(ib1+1,jb1+1))**2 + kk=1 + do k=2,4 + if(d(k)p_fv3sar2grid%a3dx + a3dx1=>p_fv3sar2grid%a3dx1 + a3dy =>p_fv3sar2grid%a3dy + a3dy1=>p_fv3sar2grid%a3dy1 + + a3ix =>p_fv3sar2grid%a3ix + a3ixp =>p_fv3sar2grid%a3ixp + a3jy =>p_fv3sar2grid%a3jy + a3jyp=>p_fv3sar2grid%a3jyp + + do i=1,nx + do j=1,ny + gxa=xbh_b(i,j) + if(gxa < xa_a(1))then + gxa= 1 + else if(gxa > xa_a(nxout))then + gxa= nxout + else + call grdcrd1(gxa,xa_a,nxout,1) + endif + a3ix(j,i)=int(gxa) + a3ix(j,i)=min(max(1,a3ix(j,i)),nxout) + a3dx(j,i)=max(zero,min(one,gxa-a3ix(j,i))) + a3dx1(j,i)=one-a3dx(j,i) + a3ixp(j,i)=min(nxout,a3ix(j,i)+1) + end do + end do + + do i=1,nx + do j=1,ny + gya=ybh_b(i,j) + if(gya < ya_a(1))then + gya= 1 + else if(gya > ya_a(nyout))then + gya= nyout + else + call grdcrd1(gya,ya_a,nyout,1) + endif + a3jy(j,i)=int(gya) + a3jy(j,i)=min(max(1,a3jy(j,i)),nyout) + a3dy(j,i)=max(zero,min(one,gya-a3jy(j,i))) + a3dy1(j,i)=one-a3dy(j,i) + a3jyp(j,i)=min(ny,a3jy(j,i)+1) + end do + end do + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!! find coefficients for wind conversion btw FV3 & earth +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + allocate ( p_fv3sar2grid%cangu(nx,ny+1),p_fv3sar2grid%sangu(nx,ny+1),p_fv3sar2grid%cangv(nx+1,ny),p_fv3sar2grid%sangv(nx+1,ny) ) + cangu=>p_fv3sar2grid%cangu + sangu=>p_fv3sar2grid%sangu + cangv=>p_fv3sar2grid%cangv + sangv=>p_fv3sar2grid%sangv + +! 1. compute x,y,z at cell cornor from grid_lon, grid_lat + + do j=1,ny+1 + do i=1,nx+1 + x(i,j)=cos(grid_lat(i,j)*deg2rad)*cos(grid_lon(i,j)*deg2rad) + y(i,j)=cos(grid_lat(i,j)*deg2rad)*sin(grid_lon(i,j)*deg2rad) + z(i,j)=sin(grid_lat(i,j)*deg2rad) + enddo + enddo + +! 2 find angles to E-W and N-S for U edges + + do j=1,ny+1 + do i=1,nx +! center lat/lon of the edge + rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) +! vector to center of the edge + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) +! vector of the edge + xu= x(i+1,j)-x(i,j) + yu= y(i+1,j)-y(i,j) + zu= z(i+1,j)-z(i,j) +! find angle with cross product + uval=sqrt((xu**2+yu**2+zu**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + cangu(i,j)=(-yr*xu+xr*yu)/ewval/uval + sangu(i,j)=(-xr*zr*xu-zr*yr*yu+(xr*xr+yr*yr)*zu) / nsval/uval + enddo + enddo + +! 3 find angles to E-W and N-S for V edges + do j=1,ny + do i=1,nx+1 + rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) + xv= x(i,j+1)-x(i,j) + yv= y(i,j+1)-y(i,j) + zv= z(i,j+1)-z(i,j) + vval=sqrt((xv**2+yv**2+zv**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + cangv(i,j)=(-yr*xv+xr*yv)/ewval/vval + sangv(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval + enddo + enddo + deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) + deallocate(rlat_in,rlon_in) +end subroutine definecoef_regular_grids subroutine earthuv2fv3_regular_grids(u,v,nx,ny,u_out,v_out,p_fv3sar2grid) !$$$ subprogram documentation block ! . . . . From 25a001be589937da1b71090ba33fca8c59a6a130 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 24 Jul 2019 20:28:03 +0000 Subject: [PATCH 027/155] the first basic version added with l_both_fv3sar_gfs_ens option --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 24 ++++++++++++++----- src/gsi/get_gefs_for_regional.f90 | 28 ++++++++++++---------- src/gsi/gsimod.F90 | 3 ++- src/gsi/hybrid_ensemble_isotropic.F90 | 8 +++++-- src/gsi/hybrid_ensemble_parameters.f90 | 5 ++++ 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 1aa50ec710..46c14c1967 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -36,6 +36,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) use constants, only: zero,one,half,zero_single,rd_over_cp,one_tenth use mpimod, only: mpi_comm_world,ierror,mype use hybrid_ensemble_parameters, only: n_ens,grd_ens + use hybrid_ensemble_parameters, only: l_both_fv3sar_gfs_ens, n_ens_gfs,n_ens_fv3sar use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d use gsi_bundlemod, only: gsi_bundlecreate @@ -73,6 +74,17 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) character(255) filelists(ntlevs_ens) character(255) ensfilenam_str type(type_fv3regfilenameg)::fv3_filename + integer(i_kind):: imem_start,n_fv3sar + if(n_ens.ne.(n_ens_gfs+n_ens_fv3sar)) then + write(6,*)'wrong, the sum of n_ens_gfs and n_ens_fv3sar not equal n_ens, stop' + call stop2(222) + endif + if(l_both_fv3sar_gfs_ens) then + imem_start=n_ens_gfs+1 + else + imem_start=1 + + endif call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ! Allocate bundle to hold mean of ensemble members @@ -94,7 +106,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! INITIALIZE ENSEMBLE MEAN ACCUMULATORS en_bar(m)%values=zero - do n=1,n_ens + do n=imem_start,n_ens en_perts(n,m)%valuesr4 = zero enddo @@ -103,8 +115,9 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) kapr=one/rd_over_cp ! ! LOOP OVER ENSEMBLE MEMBERS - do n=1,n_ens - write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n + do n_fv3sar=1,n_ens_fv3sar + n=n_ens_gfs+n_fv3sar + write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n_fv3sar 22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) ! DEFINE INPUT FILE NAME fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe @@ -232,7 +245,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) enddo ! ! CALCULATE ENSEMBLE MEAN - bar_norm = one/float(n_ens) + bar_norm = one/float(n_ens_fv3sar) en_bar(m)%values=en_bar(m)%values*bar_norm ! Copy pbar to module array. ps_bar may be needed for vertical localization @@ -256,7 +269,6 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) end if end do - call mpi_barrier(mpi_comm_world,ierror) ! ! CALCULATE ENSEMBLE SPREAD call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) @@ -265,7 +277,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS sig_norm=sqrt(one/max(one,n_ens-one)) - do n=1,n_ens + do n=imem_start,n_ens do i=1,nelen en_perts(n,m)%valuesr4(i)=(en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i))*sig_norm end do diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 99ec40b1b4..501c9f1a10 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -38,6 +38,7 @@ subroutine get_gefs_for_regional use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_a1,grd_e1,p_e2a,uv_hyb_ens,dual_res + use hybrid_ensemble_parameters, only: n_ens_gfs use hybrid_ensemble_parameters, only: full_ensemble,q_hyb_ens,l_ens_in_diff_time,write_ens_sprd use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path,jcap_ens !use hybrid_ensemble_parameters, only: add_bias_perturbation @@ -211,7 +212,8 @@ subroutine get_gefs_for_regional do n=1,200 read(10,'(a)',err=20,end=40)filename enddo -40 n_ens=n-1 +40 n_ens_gfs=n-1 +!cltorg 40 n_ens=n-1 ! set n_ens_temp depending on if we want to add bias perturbation to the ensemble @@ -474,13 +476,13 @@ subroutine get_gefs_for_regional grd_gfs%nlat,sp_gfs%rlats,grd_gfs%nlon,sp_gfs%rlons,nord_g2r,p_g2r) ! allocate mix ensemble space--horizontal on regional domain, vertical still gefs - allocate(st_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate(vp_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate( t_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate(rh_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate(oz_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate(cw_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens)) - allocate( p_eg_nmmb(grd_mix%lat2,grd_mix%lon2,n_ens)) + allocate(st_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate(vp_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate( t_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate(rh_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate(oz_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate(cw_eg(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig,n_ens_gfs)) + allocate( p_eg_nmmb(grd_mix%lat2,grd_mix%lon2,n_ens_gfs)) st_eg=zero ; vp_eg=zero ; t_eg=zero ; rh_eg=zero ; oz_eg=zero ; cw_eg=zero p_eg_nmmb=zero @@ -488,7 +490,7 @@ subroutine get_gefs_for_regional rewind(10) inithead=.true. - do n=1,n_ens + do n=1,n_ens_gfs read(10,'(a)',err=20,end=20)filename filename=trim(ensemble_path) // trim(filename) ! write(filename,100) n @@ -816,7 +818,7 @@ subroutine get_gefs_for_regional ! compute mean state stbar=zero ; vpbar=zero ; tbar=zero ; rhbar=zero ; ozbar=zero ; cwbar=zero pbar_nmmb=zero - do n=1,n_ens + do n=1,n_ens_gfs do k=1,grd_mix%nsig do j=1,grd_mix%lon2 do i=1,grd_mix%lat2 @@ -837,7 +839,7 @@ subroutine get_gefs_for_regional end do ! Convert to mean - bar_norm = one/float(n_ens) + bar_norm = one/float(n_ens_gfs) do k=1,grd_mix%nsig do j=1,grd_mix%lon2 do i=1,grd_mix%lat2 @@ -870,7 +872,7 @@ subroutine get_gefs_for_regional !www ensemble perturbation for all but the first member if full_ensemble if(full_ensemble)n1=2 - do n=n1,n_ens + do n=n1,n_ens_gfs do k=1,grd_mix%nsig do j=1,grd_mix%lon2 do i=1,grd_mix%lat2 @@ -966,7 +968,7 @@ subroutine get_gefs_for_regional allocate(rht(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig)) allocate(ozt(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig)) allocate(cwt(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig)) - do n=1,n_ens + do n=1,n_ens_gfs do j=1,grd_ens%lon2 do i=1,grd_ens%lat2 do k=1,grd_mix%nsig diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index e7d280c818..5ffba82003 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -121,6 +121,7 @@ module gsimod readin_localization,write_ens_sprd,eqspace_ensgrid,grid_ratio_ens,& readin_beta,use_localization_grid,use_gfs_ens,q_hyb_ens,i_en_perts_io, & l_ens_in_diff_time,ensemble_path,ens_fast_read + use hybrid_ensemble_parameters,only : l_both_fv3sar_gfs_ens,n_ens_gfs,n_ens_fv3sar use rapidrefresh_cldsurf_mod, only: init_rapidrefresh_cldsurf, & dfi_radar_latent_heat_time_period,metar_impact_radius,& metar_impact_radius_lowcloud,l_gsd_terrain_match_surftobs, & @@ -921,7 +922,7 @@ module gsimod ! ens_fast_read - read ensemble in parallel; default '.false.' ! ! - namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,& + namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,n_ens_fv3sar,l_both_fv3sar_gfs_ens,nlon_ens,nlat_ens,jcap_ens,& pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_bg_opt,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& jcap_ens_test,beta_s0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& grid_ratio_ens, & diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index bd91fe63ab..9df3570777 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1175,6 +1175,7 @@ subroutine load_ensemble use get_fv3_regional_ensperts_mod, only: get_fv3_regional_ensperts_class use get_wrf_nmm_ensperts_mod, only: get_wrf_nmm_ensperts_class use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens + use hybrid_ensemble_parameters, only: l_both_fv3sar_gfs_ens use mpimod, only: mpi_comm_world,ierror implicit none @@ -1330,8 +1331,7 @@ subroutine load_ensemble elseif(i_en_perts_io==3) then ! get en_perts from save files call en_perts_get_from_save_fulldomain else - call get_gefs_for_regional - call mpi_barrier(mpi_comm_world,ierror) + call mpi_barrier(mpi_comm_world,ierror) !thinkdeb why a mpi barrier is needed here endif ! pseudo_hybens = .true.: pseudo ensemble hybrid option for hwrf @@ -1359,6 +1359,10 @@ subroutine load_ensemble call get_nmmb_ensperts case(5) ! regional_ensemble_option = 5: ensembles are fv3 regional. + if (l_both_fv3sar_gfs_ens) then ! first read in gfs ensembles for regional + call get_gefs_for_regional +!clthink do we need mpi_bar here? + endif call fv3_regional_enspert%get_fv3_regional_ensperts(en_perts,nelen,ps_bar) diff --git a/src/gsi/hybrid_ensemble_parameters.f90 b/src/gsi/hybrid_ensemble_parameters.f90 index ca7d25a726..efb7a83f92 100644 --- a/src/gsi/hybrid_ensemble_parameters.f90 +++ b/src/gsi/hybrid_ensemble_parameters.f90 @@ -253,6 +253,7 @@ module hybrid_ensemble_parameters ! set passed variables to public public :: generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test,l_hyb_ens,& s_ens_h,oz_univ_static,vvlocal + public :: n_ens_gfs,n_ens_fv3sar public :: uv_hyb_ens,q_hyb_ens,s_ens_v,beta_s0,aniso_a_en,s_ens_hv,s_ens_vv public :: readin_beta,beta_s,beta_e public :: readin_localization @@ -287,6 +288,7 @@ module hybrid_ensemble_parameters public :: region_lat_ens,region_lon_ens public :: region_dx_ens,region_dy_ens public :: ens_fast_read + public :: l_both_fv3sar_gfs_ens logical l_hyb_ens,uv_hyb_ens,q_hyb_ens,oz_univ_static logical aniso_a_en @@ -304,8 +306,10 @@ module hybrid_ensemble_parameters logical vvlocal logical l_ens_in_diff_time logical ens_fast_read + logical l_both_fv3sar_gfs_ens integer(i_kind) i_en_perts_io integer(i_kind) n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test + integer(i_kind) n_ens_gfs,n_ens_fv3sar real(r_kind) beta_s0,s_ens_h,s_ens_v,grid_ratio_ens type(sub2grid_info),save :: grd_ens,grd_loc,grd_sploc,grd_anl,grd_e1,grd_a1 type(spec_vars),save :: sp_ens,sp_loc @@ -409,6 +413,7 @@ subroutine init_hybrid_ensemble_parameters i_en_perts_io=0 ! default for en_pert IO. 0 is no IO ensemble_path = './' ! default for path to ensemble members ens_fast_read=.false. + l_both_fv3sar_gfs_ens=.false. end subroutine init_hybrid_ensemble_parameters From ab5a339170202111d5cebe5b0b7709fc2fbe084c Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Fri, 9 Aug 2019 15:28:41 +0000 Subject: [PATCH 028/155] cleaning a couple of remaining debuging lines in fv3_regional_interface.f90 --- src/gsi/fv3_regional_interface.f90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gsi/fv3_regional_interface.f90 b/src/gsi/fv3_regional_interface.f90 index a0d92fff01..80ce16ba88 100644 --- a/src/gsi/fv3_regional_interface.f90 +++ b/src/gsi/fv3_regional_interface.f90 @@ -40,9 +40,6 @@ subroutine convert_fv3_regional ak_bk='fv3_akbk' ! vertical grid information call bg_fv3regfilenameg%init(grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') call gsi_rfv3io_get_grid_specs(bg_fv3regfilenameg,ierr) - call mpi_barrier(mpi_comm_world,ierror) - write(6,*)'after gsi_rfv3io_get_grid_specs' - call flush(6) if(ierr/=0)then write(6,*)' problem in convert_fv3_regional - get_grid_specs Status = ',ierr call stop2 (555) From 96273585a51f468e44b969478ff425f1842bafde Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Thu, 15 Aug 2019 17:27:35 +0000 Subject: [PATCH 029/155] cleaning up a few remaining debug lines --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 5 ----- src/gsi/gsi_rfv3io_mod.f90 | 2 -- src/gsi/gsi_unformatted.F90 | 3 --- src/gsi/gsimod.F90 | 1 - src/gsi/prt_guess.f90 | 2 +- src/gsi/read_obs.F90 | 2 -- 6 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 1aa50ec710..78690940a5 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -409,12 +409,9 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens ! do it=1,nfldsig - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is ',fv3sar_ensemble_opt if(fv3sar_ensemble_opt.eq.0 ) then - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 0 ' call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) else - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 1 ' call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v) endif if(fv3sar_ensemble_opt.eq.0) then @@ -434,8 +431,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps - write(6,*)'thinkdeb999 etal eta2 in hpa,k = ',k ,' ',eta1_ll(k),eta2_ll(k),g_ps(10,10) - write(6,*)'thinkdeb999 g_prsi in hpa,k = ',k ,' ',g_prsi(10,10,k) enddo diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 130bfc5142..c1906fc89b 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -1499,9 +1499,7 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) nzp1=nztmp+1 do i=1,nztmp ir=nzp1-i -!cltthinkorg call fv3uv2earth(temp1(:,:,i),uu(:,:,i),nx,ny,u,v) if(mype==mype_u)then -!cltthinkdeb call fv3_h_to_ll(u,a,nx,ny,nxa,nya) do j=1,ny uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) enddo diff --git a/src/gsi/gsi_unformatted.F90 b/src/gsi/gsi_unformatted.F90 index 7438fc9837..1e5a4a5bff 100644 --- a/src/gsi/gsi_unformatted.F90 +++ b/src/gsi/gsi_unformatted.F90 @@ -156,7 +156,6 @@ subroutine open_(unit,file,class,newunit,action,position,status,iostat,silent) #ifdef _DO_NOT_SUPPORT_OPEN_WITH_CONVERT_ convert_="_NOT_SUPPORTED_" ! open(file with the compiler default convert - write(6,*)'thinkdeb 1' if(newunit_) then open(newunit=unit,file=file,access='sequential',form='unformatted', & action=action_,position=position_,status=status_,iostat=iostat_) @@ -167,10 +166,8 @@ subroutine open_(unit,file,class,newunit,action,position,status,iostat,silent) #else convert_="_NOT_FOUND_" ! set a difault value - write(6,*)'thinkdeb 2' call lookup_(class_,convert_,silent=silent) ! may override convert value, if an entry of class_ is found. call lookup_(file ,convert_,silent=silent) ! may override convert value, if an entry of file is found. - write(6,*)'thinkdeb 2.2' select case(convert_) case("","_NOT_FOUND_") ! open(file) with the compiler default convert diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index a3680ee3f0..e021a1ad89 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -1271,7 +1271,6 @@ subroutine gsimain_initialize close(11) #endif - write(6,*)'thinkdeb9990 nhr_assilation is ',nhr_assimilation if(jcap > jcap_cut)then jcap_cut = jcap+1 if(mype == 0)then diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 9015ad01b9..f61181daf4 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -91,7 +91,7 @@ subroutine prt_guess(sgrep) ier=ier+istatus call gsi_bundlegetpointer (gsi_metguess_bundle(ntsig),'oz',ges_oz_it,istatus) ier=ier+istatus -!cltthinkdeb if (ier/=0) return ! this is a fundamental routine, when some not found just return + if (ier/=0) return ! this is a fundamental routine, when some not found just return ! get pointer to cloud water condensate call gsi_metguess_get('clouds::3d',n_actual_clouds,ier) diff --git a/src/gsi/read_obs.F90 b/src/gsi/read_obs.F90 index b90dfcd752..f068111c06 100644 --- a/src/gsi/read_obs.F90 +++ b/src/gsi/read_obs.F90 @@ -1877,8 +1877,6 @@ subroutine read_obs(ndata,mype) write(lunsave) super_val1 write(lunsave) nobs_sub close(lunsave) - write(6,*) 'thinkdeb in read_obs 1' - call flush(6) endif ! End of routine return From 2d2ff95e743a5e4ca04d4130818142cdbf44fe94 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Fri, 23 Aug 2019 16:38:44 +0000 Subject: [PATCH 030/155] a trival modification to actual argument of stop2 in controlvec.f90 --- src/enkf/controlvec.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/enkf/controlvec.f90 b/src/enkf/controlvec.f90 index 67fa9b57b5..c21f335028 100644 --- a/src/enkf/controlvec.f90 +++ b/src/enkf/controlvec.f90 @@ -156,7 +156,7 @@ subroutine init_controlvec() print *,'Error: 2D variable ', cvars2d(i), ' is not supported in current version.' print *,'Supported variables: ', vars2d_supported endif - call stop2(502) + call stop2(5021) endif enddo do i = 1, nc3d @@ -165,7 +165,7 @@ subroutine init_controlvec() print *,'Error: 3D variable ', cvars3d(i), ' is not supported in current version.' print *,'Supported variables: ', vars3d_supported endif - call stop2(502) + call stop2(5022) endif enddo From 8bffd30fe448b20b0bdb61bb29d0eac37b483a32 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Sat, 24 Aug 2019 15:20:22 +0000 Subject: [PATCH 031/155] delete output to satbias_angle.out following the gsi master --- src/gsi/radinfo.f90 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/gsi/radinfo.f90 b/src/gsi/radinfo.f90 index d065d6f034..4d54e7f067 100644 --- a/src/gsi/radinfo.f90 +++ b/src/gsi/radinfo.f90 @@ -1065,16 +1065,6 @@ subroutine radinfo_read(miter) end if end do - if (mype==mype_rad) then - open(lunout,file='satbias_ang.out',form='formatted') - write(lunout,'(I5)') maxscan - do j=1,jpch_rad -!clt, when compiled with debug mode, the following line may cause abortion - write(lunout,'(I5,1x,A20,2x,I4,e15.6/100(4x,10f7.3/))') & - j,nusis(j),nuchan(j),tlapmean(j),(cbias(i,j),i=1,maxscan) - end do - close(lunout) - end if end if endif From fdfd6ba90037d85c37e07068307cbebb5cc5e480 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 28 Aug 2019 18:28:17 +0000 Subject: [PATCH 032/155] after merging with gsi master --- src/gsi/compute_derived.f90 | 6 ++++++ src/gsi/cplr_get_fv3_regional_ensperts.f90 | 7 +------ src/gsi/gesinfo.f90 | 4 ---- src/gsi/get_gefs_for_regional.f90 | 8 +++++--- src/gsi/gridmod.F90 | 4 ++++ src/gsi/gsimod.F90 | 2 +- src/gsi/hybrid_ensemble_isotropic.F90 | 2 +- src/gsi/prt_guess.f90 | 2 +- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/gsi/compute_derived.f90 b/src/gsi/compute_derived.f90 index a33dbe1f41..2406cd1b4d 100644 --- a/src/gsi/compute_derived.f90 +++ b/src/gsi/compute_derived.f90 @@ -322,9 +322,15 @@ subroutine compute_derived(mype,init_pass) ! NOTE: tropopause pressure is not needed for 2dvar option if(regional)then + call gsi_bundlegetpointer (gsi_metguess_bundle(it),'q',ges_q,ier) + if(ier == 0) then !clt for being now call tpause(mype,'temp') + endif else ! (regional) + call gsi_bundlegetpointer (gsi_metguess_bundle(it),'q',ges_q,ier)!clt for being now just to get ier + if(ier == 0) then !clt for being now call tpause(mype,'pvoz') + endif end if ! (regional) endif ! (init_pass) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 46c14c1967..fee75689df 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -275,7 +275,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) call mpi_barrier(mpi_comm_world,ierror) ! ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS - sig_norm=sqrt(one/max(one,n_ens-one)) + sig_norm=sqrt(one/max(one,n_ens_fv3sar-one)) do n=imem_start,n_ens do i=1,nelen @@ -421,12 +421,9 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens ! do it=1,nfldsig - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is ',fv3sar_ensemble_opt if(fv3sar_ensemble_opt.eq.0 ) then - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 0 ' call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) else - write(6,*)'thinkdeb999 fv3sar_ensemble_opt is 1 ' call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v) endif if(fv3sar_ensemble_opt.eq.0) then @@ -446,8 +443,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps - write(6,*)'thinkdeb999 etal eta2 in hpa,k = ',k ,' ',eta1_ll(k),eta2_ll(k),g_ps(10,10) - write(6,*)'thinkdeb999 g_prsi in hpa,k = ',k ,' ',g_prsi(10,10,k) enddo diff --git a/src/gsi/gesinfo.f90 b/src/gsi/gesinfo.f90 index 94d8c90d0b..871830a3ea 100644 --- a/src/gsi/gesinfo.f90 +++ b/src/gsi/gesinfo.f90 @@ -154,7 +154,6 @@ subroutine gesinfo idate4(5)=regional_time(5) ! minutes hourg=regional_fhr ! fcst hour minuteg=regional_fmin ! fcst minute - write(6,*)'thinkdeb3 regional_fmin ',regional_fmin ! Handle RURTMA date: get iadatemn iadatemn(1)=regional_time(1) ! year iadatemn(2)=regional_time(2) ! month @@ -462,7 +461,6 @@ subroutine gesinfo end if fha=zero; ida=0; jda=0 fha(2)=ihourg ! relative time interval in hours - write(6,*)'thinkdeb3 minuteg is ',minuteg if(regional) fha(3)=minuteg ! relative time interval in minutes ida(1)=iyr ! year ida(2)=idate4(2) ! month @@ -470,8 +468,6 @@ subroutine gesinfo ida(4)=0 ! time zone ida(5)=idate4(1) ! hour if(regional) ida(6)=idate4(5) ! minute - write(6,*)'thinkdeb fha ida, jda ',fha,ida,jda - call flush(6) call w3movdat(fha,ida,jda) iadate(1)=jda(1) ! year iadate(2)=jda(2) ! mon diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 82ee70328b..9344ffa98c 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -212,15 +212,17 @@ subroutine get_gefs_for_regional do n=1,200 read(10,'(a)',err=20,end=40)filename enddo -40 n_ens_gfs=n-1 +40 n_ens_temp=n-1 +write(6,*)'the number of ensemble members in the filelist is ',n_ens_temp +write(6,*)'The actual number to be used of the first ensembles is ',n_ens_gfs !cltorg 40 n_ens=n-1 ! set n_ens_temp depending on if we want to add bias perturbation to the ensemble if(add_bias_perturbation) then - n_ens_temp=n_ens+1 + n_ens_temp=n_ens_gfs+1 else - n_ens_temp=n_ens + n_ens_temp=n_ens_gfs end if rewind (10) diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index e95f3cdb56..d8ab0c4ac5 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -1105,6 +1105,7 @@ subroutine init_reg_glob_ll(mype,lendian_in) (regional_time (i),i=1,6) regional_fhr=zero ! with wrf nmm fcst hr is not currently available. + regional_fmin=zero ! for being now if(diagnostic_reg.and.mype==0) then write(6,'(" in init_reg_glob_ll, yr,mn,dy,h,m,s=",6i6)') & @@ -1284,6 +1285,7 @@ subroutine init_reg_glob_ll(mype,lendian_in) rewind lendian_in read(lendian_in) regional_time,nlon_regional,nlat_regional,nsig,pt,nsig_soil regional_fhr=zero ! with wrf mass core fcst hr is not currently available. + regional_fmin=zero ! with wrf mass core fcst mn is not currently available. if(diagnostic_reg.and.mype==0) then write(6,'(" in init_reg_glob_ll, yr,mn,dy,h,m,s=",6i6)') regional_time @@ -1619,6 +1621,7 @@ subroutine init_reg_glob_ll(mype,lendian_in) dy_mc(nlon_regional,nlat_regional)) regional_fhr=zero !that is not available/nor seems currently necessary + regional_fmin=zero !that is not available/nor seems currently necessary read(lendian_in) aeta1,aeta2 ! 2 to skip read(lendian_in) eta1,eta2 ! 3 to skip @@ -1724,6 +1727,7 @@ subroutine init_reg_glob_ll(mype,lendian_in) rewind lendian_in read(lendian_in) regional_time,nlon_regional,nlat_regional,nsig regional_fhr=zero ! with twodvar analysis fcst hr is not currently available. + regional_fmin=zero ! with twodvar analysis fcst hr is not currently available. if(diagnostic_reg.and.mype==0) then write(6,'(" in init_reg_glob_ll, yr,mn,dy,h,m,s=",6i6)')regional_time diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 82fc6bf6f6..442270e24b 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -936,7 +936,7 @@ module gsimod ! ens_fast_read - read ensemble in parallel; default '.false.' ! ! - namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,n_ens_fv3sar,l_both_fv3sar_gfs_ens,nlon_ens,nlat_ens,jcap_ens,& + namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,l_both_fv3sar_gfs_ens,n_ens_gfs,n_ens_fv3sar,nlon_ens,nlat_ens,jcap_ens,& pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_bg_opt,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& jcap_ens_test,beta_s0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& grid_ratio_ens, & diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index debe8495ec..95f75f5e1c 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -1331,7 +1331,7 @@ subroutine load_ensemble elseif(i_en_perts_io==3) then ! get en_perts from save files call en_perts_get_from_save_fulldomain else - call mpi_barrier(mpi_comm_world,ierror) !thinkdeb why a mpi barrier is needed here + call get_gefs_for_regional endif ! pseudo_hybens = .true.: pseudo ensemble hybrid option for hwrf diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 92ec543fa2..fac1b9829d 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -91,7 +91,7 @@ subroutine prt_guess(sgrep) ier=ier+istatus call gsi_bundlegetpointer (gsi_metguess_bundle(ntsig),'oz',ges_oz_it,istatus) ier=ier+istatus - + if(ier /=0 ) return !cltthink ! get pointer to cloud water condensate call gsi_metguess_get('clouds::3d',n_actual_clouds,ier) if (n_actual_clouds>0) then From 10cf1ecdae2eda065f8b8f3b0d731573944d695b Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 26 Sep 2019 16:32:26 +0000 Subject: [PATCH 033/155] add some modifications for Hera transfered from M. Pots 's branch --- CMakeLists.txt | 2 +- cmake/Modules/platforms/Hera.cmake | 42 +++++ cmake/Modules/setHOST.cmake | 10 +- cmake/Modules/setPlatformVariables.cmake | 2 +- modulefiles/modulefile.ProdGSI.hera | 38 ++++ regression/regression_param.sh | 46 ++--- regression/regression_var.sh | 10 +- ush/build_all_cmake.sh | 6 +- ush/sub_hera | 213 +++++++++++++++++++++++ 9 files changed, 331 insertions(+), 38 deletions(-) create mode 100644 cmake/Modules/platforms/Hera.cmake create mode 100755 modulefiles/modulefile.ProdGSI.hera create mode 100755 ush/sub_hera diff --git a/CMakeLists.txt b/CMakeLists.txt index 7245ff5ecb..0033302108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ project(GSI) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Gaea.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Jet.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/S4.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Theia.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Hera.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-C.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-D.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS.cmake) diff --git a/cmake/Modules/platforms/Hera.cmake b/cmake/Modules/platforms/Hera.cmake new file mode 100644 index 0000000000..9fce9a3a47 --- /dev/null +++ b/cmake/Modules/platforms/Hera.cmake @@ -0,0 +1,42 @@ +macro (setHERA) + message("Setting paths for HERA") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "OFF") + + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() + diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake index 711420ca9f..a4f3628b30 100644 --- a/cmake/Modules/setHOST.cmake +++ b/cmake/Modules/setHOST.cmake @@ -3,7 +3,7 @@ macro( setHOST ) message("The hostname is ${HOSTNAME}" ) string(REGEX MATCH "s4-" HOST-S4 ${HOSTNAME} ) string(REGEX MATCH "gaea" HOST-Gaea ${HOSTNAME} ) - string(REGEX MATCH "tfe[0-9]" HOST-Theia ${HOSTNAME} ) + string(REGEX MATCH "hfe[0-9]" HOST-Hera ${HOSTNAME} ) if(EXISTS /jetmon) set(HOST-Jet "True" ) endif() @@ -46,11 +46,11 @@ macro( setHOST ) set( host "WCOSS" ) set( HOST-WCOSS "TRUE" ) setWCOSS() - elseif( HOST-Theia ) - set( host "Theia" ) + elseif( HOST-Hera ) + set( host "Hera" ) option(BUILD_CORELIBS "Build the Core libraries " OFF) - setTHEIA() - set( HOST-Theia "TRUE" ) + setHERA() + set( HOST-Hera "TRUE" ) elseif( HOST-Gaea ) set( host "Gaea" ) option(BUILD_CORELIBS "Build the Core libraries " On) diff --git a/cmake/Modules/setPlatformVariables.cmake b/cmake/Modules/setPlatformVariables.cmake index 31b271bf2e..728e1a3e7f 100644 --- a/cmake/Modules/setPlatformVariables.cmake +++ b/cmake/Modules/setPlatformVariables.cmake @@ -2,7 +2,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/platforms/Jet.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-C.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/S4.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Theia.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Hera.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/Gaea.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/Cheyenne.cmake) include(${CMAKE_CURRENT_LIST_DIR}/platforms/Discover.cmake) diff --git a/modulefiles/modulefile.ProdGSI.hera b/modulefiles/modulefile.ProdGSI.hera new file mode 100755 index 0000000000..20841355c4 --- /dev/null +++ b/modulefiles/modulefile.ProdGSI.hera @@ -0,0 +1,38 @@ +#%Module###################################################################### +## Russ.Treadon@noaa.gov +## NOAA/NWS/NCEP/EMC +## GDAS_ENKF v6.2.3 +##_____________________________________________________ +#set ver v6.2.3 + +set COMP ifort +set COMP_MP mpfort +set COMP_MPI mpiifort + +set C_COMP icc +set C_COMP_MP mpcc + +# Known conflicts + +# Load compiler, mpi, and hdf5/netcdf +module load intel/18.0.5.274 +module load impi/2018.0.4 +module load hdf5/1.10.4 +module load netcdf/4.6.1 + +# Load libraries +module use -a /contrib/da/spack/share/spack/modules/linux-centos7-x86_64 +module load bacio/v2.1.0-intel-18.0.5 +module load bufr/v11.2.0-intel-18.0.5 +module load cmake/3.9.0-intel-18.0.5 +module load nemsio/v2.2.3-intel-18.0.5-impi +module load sfcio/v1.1.0-intel-18.0.5 +module load sigio/v2.1.0-intel-18.0.5-impi +module load sp/v2.0.2-intel-18.0.5 +module load w3emc/v2.2.0-intel-18.0.5-impi +module load w3nco/v2.0.6-intel-18.0.5-impi +module load crtm/v2.2.3-intel-18.0.5 + +# Load ndate +module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles +module load prod_util diff --git a/regression/regression_param.sh b/regression/regression_param.sh index 0cc409c532..3898ea4854 100755 --- a/regression/regression_param.sh +++ b/regression/regression_param.sh @@ -2,10 +2,10 @@ regtest=$1 case $machine in - Theia) - sub_cmd="sub_theia" - memnode=64 - numcore=24 + Hera) + sub_cmd="sub_hera" + memnode=83 + numcore=40 ;; WCOSS) sub_cmd="sub_wcoss -a GDAS-T2O -d $PWD" @@ -40,7 +40,7 @@ esac # Maximum memory per task for above machines # wcoss_c : 64 Gb / 24 cores = 2.67 Gb / core # wcoss_d : 128 Gb / 28 cores = 4.57 Gb / core -# theia : 64 Gb / 24 cores = 2.67 Gb / core +# hera : 83 Gb / 40 cores = 2.075 Gb / core # discover: # s4 : # cheyenne: @@ -53,7 +53,7 @@ case $regtest in global_T62) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:50:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:50:00" ; popts[2]="12/9/" ; ropts[2]="/2" elif [[ "$machine" = "Cheyenne" ]]; then @@ -86,7 +86,7 @@ case $regtest in global_T62_ozonly) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="12/1/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="12/3/" ; ropts[2]="/2" elif [[ "$machine" = "Cheyenne" ]]; then @@ -119,7 +119,7 @@ case $regtest in global_4dvar_T62) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="12/5/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -144,7 +144,7 @@ case $regtest in if [ "$debug" = ".true." ] ; then topts[1]="0:45:00" - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then popts[1]="12/5/" elif [[ "$machine" = "WCOSS" ]]; then popts[1]="16/4/" @@ -163,7 +163,7 @@ case $regtest in global_hybrid_T126) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="12/5/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -196,7 +196,7 @@ case $regtest in global_4denvar_T126) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="6/8/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="6/10/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -226,7 +226,7 @@ case $regtest in global_fv3_4denvar_T126) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:35:00" ; popts[1]="6/8/" ; ropts[1]="/1" topts[2]="0:35:00" ; popts[2]="6/10/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -256,7 +256,7 @@ case $regtest in global_lanczos_T62) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:30:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:30:00" ; popts[2]="12/5/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -289,7 +289,7 @@ case $regtest in global_nemsio_T62) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="12/9/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -322,7 +322,7 @@ case $regtest in arw_binary | arw_netcdf) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="4/4/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="6/6/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -355,7 +355,7 @@ case $regtest in netcdf_fv3_regional) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="4/4/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="6/6/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -382,7 +382,7 @@ case $regtest in nmm_binary ) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:30:00" ; popts[1]="6/6/" ; ropts[1]="/1" topts[2]="0:30:00" ; popts[2]="8/8/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -415,7 +415,7 @@ case $regtest in nmm_netcdf) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="4/2/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="4/4/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -448,7 +448,7 @@ case $regtest in nmmb_nems_4denvar) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:30:00" ; popts[1]="7/10/" ; ropts[1]="/1" topts[2]="0:30:00" ; popts[2]="9/10/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -478,7 +478,7 @@ case $regtest in rtma) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:30:00" ; popts[1]="6/12/" ; ropts[1]="/1" topts[2]="0:30:00" ; popts[2]="8/12/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -511,7 +511,7 @@ case $regtest in hwrf_nmm_d2 | hwrf_nmm_d3) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:20:00" ; popts[1]="6/6/" ; ropts[1]="/1" topts[2]="0:20:00" ; popts[2]="8/8/" ; ropts[2]="/1" elif [[ "$machine" = "WCOSS" ]]; then @@ -541,7 +541,7 @@ case $regtest in global_enkf_T62) - if [[ "$machine" = "Theia" ]]; then + if [[ "$machine" = "Hera" ]]; then topts[1]="0:15:00" ; popts[1]="12/3/" ; ropts[1]="/1" topts[2]="0:15:00" ; popts[2]="12/5/" ; ropts[2]="/2" elif [[ "$machine" = "WCOSS" ]]; then @@ -598,7 +598,7 @@ export tmpregdir export result export scaling -if [[ "$machine" = "Theia" ]]; then +if [[ "$machine" = "Hera" ]]; then export OMP_STACKSIZE=1024M export MPI_BUFS_PER_PROC=256 export MPI_BUFS_PER_HOST=256 diff --git a/regression/regression_var.sh b/regression/regression_var.sh index 9fe99e3557..02b0656aec 100755 --- a/regression/regression_var.sh +++ b/regression/regression_var.sh @@ -36,8 +36,8 @@ if [ -z ${machine+x} ]; then export machine="WCOSS" elif [ -d /glade/scratch ]; then # Cheyenne export machine="Cheyenne" - elif [ -d /scratch4/NCEPDEV/da ]; then # Theia - export machine="Theia" + elif [ -d /scratch4/NCEPDEV/da ]; then # Hera + export machine="Hera" elif [ -d /gpfs/hps/ptmp ]; then # LUNA or SURGE export machine="WCOSS_C" elif [ -d /gpfs/dell1/ptmp ]; then # venus or mars @@ -108,7 +108,7 @@ case $machine in export check_resource="no" export accnt="p48503002" ;; - Theia) + Hera) if [ -d /scratch4/NCEPDEV/da/noscrub/$LOGNAME ]; then export noscrub="/scratch4/NCEPDEV/da/noscrub/$LOGNAME" elif [ -d /scratch4/NCEPDEV/global/noscrub/$LOGNAME ]; then @@ -132,9 +132,9 @@ case $machine in export accnt="da-cpu" - # On Theia, there are no scrubbers to remove old contents from stmp* directories. + # On Hera, there are no scrubbers to remove old contents from stmp* directories. # After completion of regression tests, will remove the regression test subdirecories - export clean=".true." +# export clean=".true." ;; WCOSS_C) if [ -d /gpfs/hps3/emc/global/noscrub/$LOGNAME ]; then diff --git a/ush/build_all_cmake.sh b/ush/build_all_cmake.sh index 9b6c0508f0..cdb4525752 100755 --- a/ush/build_all_cmake.sh +++ b/ush/build_all_cmake.sh @@ -18,9 +18,9 @@ elif [[ -d /cm ]] ; then elif [[ -d /ioddev_dell ]]; then . $MODULESHOME/init/sh target=wcoss_d -elif [[ -d /scratch3 ]] ; then +elif [[ -d /scratch1 || -d /scratch2 ]] ; then . /apps/lmod/lmod/init/sh - target=theia + target=hera elif [[ -d /carddata ]] ; then . /opt/apps/lmod/3.1.9/init/sh target=s4 @@ -63,7 +63,7 @@ if [ $target = wcoss_d ]; then elif [ $target = wcoss -o $target = gaea ]; then module purge module load $dir_modules/modulefile.ProdGSI.$target -elif [ $target = theia -o $target = cheyenne ]; then +elif [ $target = hera -o $target = cheyenne ]; then module purge source $dir_modules/modulefile.ProdGSI.$target elif [ $target = wcoss_c ]; then diff --git a/ush/sub_hera b/ush/sub_hera new file mode 100755 index 0000000000..b154233a58 --- /dev/null +++ b/ush/sub_hera @@ -0,0 +1,213 @@ +#!/bin/sh --login +set -x +usage="\ +Usage: $0 [options] executable [args] + where the options are: + -a account account (default: none) + -b binding run smt binding or not (default:NO) + -d dirin initial directory (default: cwd) + -e envars copy comma-separated environment variables + -g group group name + -i append standard input to command file + -j jobname specify jobname (default: executable basename) + -m machine machine on which to run (default: current) + -n write command file to stdout rather than submitting it + -o output specify output file (default: jobname.out) + -p procs[/nodes[/ppreq] + number of MPI tasks and optional nodes or Bblocking and + ppreq option (N or S) (defaults: serial, Bunlimited, S) + -q queue[/qpreq] queue name and optional requirement, e.g. dev/P + (defaults: 1 if serial or dev if parallel and none) + (queue 3 or 4 is dev or prod with twice tasks over ip) + (options: P=parallel, B=bigmem, b=batch) + -r rmem[/rcpu] resources memory and cpus/task (default: '1024 mb', 1) + -t timew wall time limit in [[hh:]mm:]ss format (default: 900) + -u userid userid to run under (default: self) + -v verbose mode + -w when when to run, in yyyymmddhh[mm], +hh[mm], thh[mm], or + Thh[mm] (full, incremental, today or tomorrow) format + (default: now) +Function: This command submits a job to the batch queue." +subcmd="$*" +stdin=NO +nosub=NO +account="" +binding="NO" +dirin="" +envars="" +group="" +jobname="" +machine="" +output="" +procs=0 +nodes="" +ppreq="" +queue="" +qpreq="" +rmem="1024" +rcpu="1" +timew="900" +userid="" +verbose=NO +when="" +while getopts a:b:d:e:g:ij:m:no:p:q:r:t:u:vw: opt;do + case $opt in + a) account="$OPTARG";; + b) binding="$OPTARG";; + d) dirin="$OPTARG";; + e) envars="$OPTARG";; + g) group="$OPTARG";; + i) stdin=YES;; + j) jobname=$OPTARG;; + m) machine="$OPTARG";; + n) nosub=YES;; + o) output=$OPTARG;; + p) procs=$(echo $OPTARG/|cut -d/ -f1);nodes=$(echo $OPTARG/|cut -d/ -f2);ppreq=$(echo $OPTARG/|cut -d/ -f3);; + q) queue=$(echo $OPTARG/|cut -d/ -f1);qpreq=$(echo $OPTARG/|cut -d/ -f2);; + r) rmem=$(echo $OPTARG/|cut -d/ -f1);rcpu=$(echo $OPTARG/|cut -d/ -f2);; + t) timew=$OPTARG;; + u) userid=$OPTARG;; + v) verbose=YES;; + w) when=$OPTARG;; + \?) echo $0: invalid option >&2;echo "$usage" >&2;exit 1;; + esac +done +shift $(($OPTIND-1)) +if [[ $# -eq 0 ]];then + echo $0: missing executable name >&2;echo "$usage" >&2;exit 1 +fi +exec=$1 +if [[ ! -s $exec ]]&&which $exec >/dev/null 2>&1;then + exec=$(which $exec) +fi +shift +args="$*" +bn=$(basename $exec) +export jobname=${jobname:-$bn} +output=${output:-$jobname.out} +myuser=$LOGNAME +myhost=$(hostname) + +if [ -d /scratch4/NCEPDEV/stmp4/$LOGNAME ]; then + DATA=/scratch4/NCEPDEV/stmp4/$LOGNAME/tmp +elif [ -d /scratch3/BMC/gsienkf/$LOGNAME ]; then + DATA=/scratch3/BMC/gsienkf/$LOGNAME/tmp/tmp +fi + +#DATA=/scratch4/NCEPDEV/stmp4/$LOGNAME/tmp +#DATA=/scratch3/BMC/gsienkf/$LOGNAME/tmp/tmp +mkdir -p $DATA + +#partition=${partition:-c1ms} +queue=${queue:-batch} +timew=${timew:-01:20:00} +task_node=${task_node:-$procs} +size=$((nodes*task_node)) +envars=$envars +threads=${rcpu:-1} +#envars=$envars,mpi_tasks=$procs +#Options +###PBS -l partition=c1ms,size=0528,walltime=01:20:00 +##PBS -l partition=$queue,size=$size,walltime=$timew +##PBS -S /bin/sh + +export TZ=GMT +cfile=$DATA/sub$$ +> $cfile +#echo "#PBS -S /bin/sh" >> $cfile +echo "#!/bin/sh --login" >> $cfile +echo "" >> $cfile +echo "#SBATCH --output=$output" >> $cfile +echo "#SBATCH --job-name=$jobname" >> $cfile +echo "#SBATCH --qos=$queue" >> $cfile +echo "#SBATCH --time=$timew" >> $cfile +echo "#SBATCH --nodes=$nodes --ntasks-per-node=$procs --cpus-per-task=$threads" >> $cfile +#echo "#SBATCH -j oe" >> $cfile +echo "#SBATCH --account=$accnt" >> $cfile +#echo "#SBATCH -V" >> $cfile +#echo "#PBS -d" >> $cfile +#. $exec >> $cfile +#echo "/bin/sh -x $exec" >> $cfile + +echo "" >>$cfile +echo "export OMP_NUM_THREADS=$threads" >> $cfile +echo "" >>$cfile +echo ". "$(awk '{ print $1, $2, $3, $4, $5, $6, $7, $8, $9 }' $regdir/regression_var.out) >>$cfile +echo "" >>$cfile + +echo ". /apps/lmod/lmod/init/sh" >> $cfile +echo "module purge" >> $cfile +echo "source $gsisrc/modulefiles/modulefile.ProdGSI.hera " >> $cfile +echo "module list" >> $cfile +echo "" >>$cfile + +cat $exec >> $cfile + +if [[ $nosub = YES ]];then + cat $cfile + exit +elif [[ $verbose = YES ]];then + set -x + cat $cfile +fi +#msub -I partition=$partition,size=$procs,walltime=$walltime $cfile + +#if [[ -n $when ]];then +# whena=$when +# if [[ $when = +* ]];then +# hr=$(echo $when|cut -c2-3) +# mn=$(echo $when|cut -c4-5) +# [[ -n $mn ]] || mn=00 +# now=$(date -u +"%Y%m%d%H%M") +# ((mn+=$(echo $now|cut -c11-12))) +# [[ $mn -ge 60 ]] && ((hr+=1)) && ((mn-=60)) +# [[ $mn -lt 10 ]] && mn=0$mn +# whena=$(/nwprod/util/exec/ndate +$hr $(echo $now|cut -c1-10))$mn +# elif [[ $when = t* ]];then +# hr=$(echo $when|cut -c2-3) +# mn=$(echo $when|cut -c4-5) +# [[ -n $mn ]] || mn=00 +# now=$(date -u +"%Y%m%d") +# whena=$now$hr$mn +# elif [[ $when = T* ]];then +# hr=$(echo $when|cut -c2-3) +# mn=$(echo $when|cut -c4-5) +# [[ -n $mn ]] || mn=00 +# now=$(date -u +"%Y%m%d%H") +# whena=$(/nwprod/util/exec/ndate +24 $now|cut -c1-8)$hr$mn +# fi +# yr=$(echo $whena|cut -c1-4) +# mo=$(echo $whena|cut -c5-6) +# dy=$(echo $whena|cut -c7-8) +# hr=$(echo $whena|cut -c9-10) +# mn=$(echo $whena|cut -c11-12) +# [[ -n $mn ]] || mn=00 +# echo "#@ startdate = $mo/$dy/$yr $hr:$mn" +#fi >>$cfile + + +if [[ $stdin = YES ]];then + cat +fi >>$cfile +if [[ $nosub = YES ]];then + cat $cfile + exit +elif [[ $verbose = YES ]];then + set -x + cat $cfile +fi +sbatch=${sbatch:-sbatch} + +ofile=$DATA/subout$$ +>$ofile +chmod 777 $ofile +$sbatch $cfile >$ofile +rc=$? +cat $ofile +if [[ -w $SUBLOG ]];then + jobn=$(grep -i submitted $ofile|head -n1|cut -d\" -f2) + date -u +"%Y%m%d%H%M%S : $subcmd : $jobn" >>$SUBLOG +fi +rm $cfile $ofile +[[ $MKDATA = YES ]] && rmdir $DATA +exit $rc From e40629e41114e4d2ff183d701461ef4515775bf7 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Thu, 19 Dec 2019 03:06:52 +0000 Subject: [PATCH 034/155] a couple of fixes --- src/gsi/gsi_rfv3io_mod.f90 | 1 - src/gsi/gsimod.F90 | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index b1162514dd..f142cf626a 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -230,7 +230,6 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) regional_time(6)=msecond regional_fhr=zero ! forecast hour set zero for now regional_fmin=zero ! forecast min set zero for now - write(6,*)'thinkdeb regional_time is ',regional_time !!!!!!!!!! grid_spec !!!!!!!!!!!!!!! ierr=0 diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index a7374f97f8..116864aac7 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -1290,8 +1290,13 @@ subroutine gsimain_initialize c_varqc=c_varqc_new end if end if - if(.not. l_both_fv3sar_gfs_ens) then - n_ens_gfs=n_ens + if(.not. l_both_fv3sar_gfs_ens) then + if (regional_ensemble_option==5) then + n_ens_gfs=0 + n_ens_fv3sar=n_ens + else + write(6,*)'n_ens_gfs and n_ens_fv3sar won"t be used if not regional_ensemble_option==5' + endif endif if(ltlint) then if(vqc .or. njqc)then From b56264071a2a5b18fc8755bf3928896aa633fc0b Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 27 Jan 2020 17:24:22 +0000 Subject: [PATCH 035/155] some new codes --- src/enkf/d1 | 1 - src/enkf/gridinfo_fv3reg.f90 | 6 +++--- src/enkf/loadbal.f90 | 2 +- src/enkf/readconvobs.f90 | 5 +++-- 4 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 src/enkf/d1 diff --git a/src/enkf/d1 b/src/enkf/d1 deleted file mode 100644 index 6db25c180b..0000000000 --- a/src/enkf/d1 +++ /dev/null @@ -1 +0,0 @@ -use netcdf, only: nf90_nowrite,nf90_write,nf90_inquire,nf90_inquire_dimension diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 7abd18455b..8a882115ec 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -46,7 +46,7 @@ module gridinfo fv3fixpath, nx_res,ny_res, ntiles use kinds, only: r_kind, i_kind, r_double, r_single use constants, only: one,zero,pi,cp,rd,grav,rearth,max_varname_length -use constants, only: half +use constants, only: half,deg2rad use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_inq_dimid,nf90_inq_varid use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension @@ -202,8 +202,8 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo enddo enddo !loop for ntilet - latsgrd = pi*latsgrd/180._r_single - lonsgrd = pi*lonsgrd/180._r_single + latsgrd = latsgrd*deg2rad + lonsgrd = lonsgrd*deg2rad !cltthink the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) allocate(g_prsi(nx_res,ny_res,nlevsp1)) diff --git a/src/enkf/loadbal.f90 b/src/enkf/loadbal.f90 index 12a1cc3a4d..b0942953a6 100644 --- a/src/enkf/loadbal.f90 +++ b/src/enkf/loadbal.f90 @@ -523,7 +523,7 @@ subroutine scatter_chunks do nanal=2,nanals anal_chunk_prior(nanal,i,nn,nb)=0.0_r_kind enddo - anal_chunk(1,i,nn,nb) = 0.0_r_kind + anal_chunk(1,i,nn,nb) = ensmean_chunk(i,nn,nb)-anal_chunk(1,i,nn,nb) anal_chunk_prior(1,i,nn,nb)=0.0_r_kind end do end do diff --git a/src/enkf/readconvobs.f90 b/src/enkf/readconvobs.f90 index 376be6a7b6..0b4b79f3c0 100644 --- a/src/enkf/readconvobs.f90 +++ b/src/enkf/readconvobs.f90 @@ -115,6 +115,7 @@ subroutine get_num_convobs_bin(obspath,datestring,num_obs_tot,num_obs_totdiag,id obsfile =& trim(adjustl(obspath))//'gsitmp_'//trim(adjustl(id))//'/pe'//pe_name//'.conv_01' endif + write(6,*)'thinkdeb obsfile is ',trim(obsfile) inquire(file=obsfile,exist=fexist) if (.not. fexist) cycle peloop open(iunit,form="unformatted",file=obsfile,iostat=ios) @@ -1540,7 +1541,7 @@ subroutine write_convobs_data_bin(obspath, datestring, nobs_max, nobs_maxdiag, & close(iunit2) if (nob .ne. nobs_max) then - print *,'number of obs not what expected in write_convobs_data',nob,nobs_max + print *,'number of obs not what expected in write_convobs_data2',nob,nobs_max call stop2(94) end if if (nobdiag /= nobs_maxdiag) then @@ -1687,7 +1688,7 @@ subroutine write_convobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & enddo obtypeloop if (nob .ne. nobs_max) then - print *,'number of obs not what expected in write_convobs_data',nob,nobs_max + print *,'number of obs not what expected in write_convobs_data1',nob,nobs_max call stop2(94) end if if (nobdiag /= nobs_maxdiag) then From 1aaf87c1802066dcacf7f01e921a7cd8a5207814 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 27 Jan 2020 19:27:45 +0000 Subject: [PATCH 036/155] test --- src/enkf/gridinfo_fv3reg.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 8a882115ec..53737610f0 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -204,7 +204,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo !loop for ntilet latsgrd = latsgrd*deg2rad lonsgrd = lonsgrd*deg2rad -!cltthink the unit of the lat/lon +!cltthink0 the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) allocate(g_prsi(nx_res,ny_res,nlevsp1)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) From f4ffc6852031661f540efc03f74a3d2c29831cbe Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 27 Jan 2020 19:28:31 +0000 Subject: [PATCH 037/155] test2 --- src/enkf/gridinfo_fv3reg.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 53737610f0..fb1b319f40 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -204,7 +204,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo !loop for ntilet latsgrd = latsgrd*deg2rad lonsgrd = lonsgrd*deg2rad -!cltthink0 the unit of the lat/lon +!cltthink01 the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) allocate(g_prsi(nx_res,ny_res,nlevsp1)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) From 8c550cacc36d2d7041c27b101cd6e8ca77c3c3f1 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 27 Jan 2020 19:42:11 +0000 Subject: [PATCH 038/155] test --- src/enkf/gridinfo_fv3reg.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index fb1b319f40..962915c17f 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -204,7 +204,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo !loop for ntilet latsgrd = latsgrd*deg2rad lonsgrd = lonsgrd*deg2rad -!cltthink01 the unit of the lat/lon +!cltthink02 the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) allocate(g_prsi(nx_res,ny_res,nlevsp1)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) From c441e9bc5f17117b07f614081f2c6201f7f85913 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Tue, 28 Jan 2020 19:54:06 +0000 Subject: [PATCH 039/155] test3 --- src/enkf/gridinfo_fv3reg.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 962915c17f..f8ef2efdd5 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -204,7 +204,7 @@ subroutine getgridinfo(fileprefix, reducedgrid) enddo !loop for ntilet latsgrd = latsgrd*deg2rad lonsgrd = lonsgrd*deg2rad -!cltthink02 the unit of the lat/lon +!cltthink03 the unit of the lat/lon allocate(delp(nx_res,ny_res,nlevs),ps(nx_res,ny_res)) allocate(g_prsi(nx_res,ny_res,nlevsp1)) allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) From f9609f7726a5d1d0e6fb0df3771df2ea7c4be02c Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Fri, 6 Mar 2020 22:14:26 +0000 Subject: [PATCH 040/155] fix for fv3sar coldstart option and conslitation of the logic about n_ens_?? --- src/gsi/gsi_rfv3io_mod.f90 | 187 +++++++++++++++++++++++++++++++------ src/gsi/gsimod.F90 | 5 +- 2 files changed, 161 insertions(+), 31 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index f142cf626a..beeb8f533e 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -811,7 +811,8 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) if( fv3sar_bg_opt.eq.0) then call gsi_fv3ncdf_read(dynvars,'T','t',ges_tsen(1,1,1,it),mype_t) else - call gsi_fv3ncdf_read_v1(dynvars,'','T',ges_tsen(1,1,1,it),mype_t) + write(6,*)'thindkeb250 read t' + call gsi_fv3ncdf_read_v1(dynvars,'t','T',ges_tsen(1,1,1,it),mype_t) endif if( fv3sar_bg_opt.eq.0) then @@ -823,6 +824,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) ges_ps(:,:)=ges_prsi(:,:,1,it) else call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',ges_ps,mype_p) + ges_ps=ges_ps*0.001_r_kind ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) do k=1,nsig ges_prsi(:,:,k,it)=eta1_ll(k)+eta2_ll(k)*ges_ps @@ -856,7 +858,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) end subroutine read_fv3_netcdf_guess subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) -!$$$ subprogram documentation block +!$$$ subprogra_fv3ncdf2d_readm documentation block ! . . . . ! subprogram: gsi_fv3ncdf2d_read ! prgmmr: wu w org: np22 date: 2017-10-17 @@ -1218,7 +1220,8 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) enddo - do k=ndimensions+1,nvariables +!cltorg do k=ndimensions+1,nvariables + do k=1,nvariables iret=nf90_inquire_variable(gfile_loc,k,name,len) if(trim(name)==varname .or. trim(name)==varname2) then iret=nf90_inquire_variable(gfile_loc,k,ndims=ndim) @@ -1729,8 +1732,9 @@ subroutine wrfv3_netcdf(fv3filenamegin) call gsi_fv3ncdf_writeuv(dynvars,ges_u,ges_v,mype_v,add_saved) call gsi_fv3ncdf_writeps(dynvars,'delp',ges_ps,mype_p,add_saved) else - call gsi_fv3ncdf_write(dynvars,'t',ges_tsen(1,1,1,it),mype_t,add_saved) - call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) + write(6,*)'thinkdeb250 before gsi_fv3ncdf_write_v1' + call gsi_fv3ncdf_write_v1(dynvars,'t',ges_tsen(1,1,1,it),mype_t,add_saved) + call gsi_fv3ncdf_write_v1(tracers,'sphum',ges_q ,mype_q,add_saved) call gsi_fv3ncdf_writeuv_v1(dynvars,ges_u,ges_v,mype_v,add_saved) call gsi_fv3ncdf_writeps_v1(dynvars,'ps',ges_ps,mype_p,add_saved) @@ -1959,9 +1963,9 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) allocate( work_b(nlon_regional,nlat_regional,nsig)) call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + allocate( workb2(nlon_regional,nlat_regional)) if(add_saved)then - allocate( workb2(nlon_regional,nlat_regional)) allocate( worka2(nlat,nlon)) !!!!!!!! read in guess delp !!!!!!!!!!!!!! call check( nf90_get_var(gfile_loc,VarId,work_b) ) @@ -1998,7 +2002,8 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) - deallocate(worka2,workb2) + if (allocated(worka2)) deallocate(worka2) + if (allocated(workb2)) deallocate(workb2) deallocate(work_b,work_a,work_bi) end if !mype_io @@ -2055,6 +2060,7 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) integer(i_kind) :: u_wgrd_VarId,v_wgrd_VarId integer(i_kind) :: u_sgrd_VarId,v_sgrd_VarId integer(i_kind) i,j,mm1,n,k,ns,kr,m + integer(i_kind) ilev0 real(r_kind),allocatable,dimension(:):: work real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_au,work_av real(r_kind),allocatable,dimension(:,:,:):: work_bu_s,work_bv_s @@ -2064,6 +2070,7 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) real(r_kind),allocatable,dimension(:,:):: workbu_w2,workbv_w2 mm1=mype+1 + ilev0=1 allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) !!!!!! gather analysis u !! revers k !!!!!!!!!!! @@ -2122,10 +2129,10 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) allocate( u(nlon_regional,nlat_regional)) allocate( v(nlon_regional,nlat_regional)) - allocate( work_bu_s(nlon_regional,nlat_regional+1,nsig)) - allocate( work_bv_s(nlon_regional,nlat_regional+1,nsig)) - allocate( work_bu_w(nlon_regional+1,nlat_regional,nsig)) - allocate( work_bv_w(nlon_regional+1,nlat_regional,nsig)) + allocate( work_bu_s(nlon_regional,nlat_regional+1,nsig+1)) + allocate( work_bv_s(nlon_regional,nlat_regional+1,nsig+1)) + allocate( work_bu_w(nlon_regional+1,nlat_regional,nsig+1)) + allocate( work_bv_w(nlon_regional+1,nlat_regional,nsig+1)) @@ -2134,8 +2141,6 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call check( nf90_inq_varid(gfile_loc,'v_s',v_sgrd_VarId) ) call check( nf90_inq_varid(gfile_loc,'v_w',v_wgrd_VarId) ) - if(add_saved)then - allocate( workau2(nlat,nlon),workav2(nlat,nlon)) allocate( workbu_w2(nlon_regional+1,nlat_regional)) allocate( workbv_w2(nlon_regional+1,nlat_regional)) allocate( workbu_s2(nlon_regional,nlat_regional+1)) @@ -2145,12 +2150,15 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call check( nf90_get_var(gfile_loc,u_wgrd_VarId,work_bu_w) ) call check( nf90_get_var(gfile_loc,v_sgrd_VarId,work_bv_s) ) call check( nf90_get_var(gfile_loc,v_wgrd_VarId,work_bv_w) ) + + if(add_saved)then + allocate( workau2(nlat,nlon),workav2(nlat,nlon)) do k=1,nsig do j=1,nlat_regional - u(:,j)=half * (work_bu_s(:,j,k)+ work_bu_s(:,j+1,k)) + u(:,j)=half * (work_bu_s(:,j,ilev0+k)+ work_bu_s(:,j+1,ilev0+k)) enddo do i=1,nlon_regional - v(i,:)=half*(work_bv_w(i,:,k)+work_bv_w(i+1,:,k)) + v(i,:)=half*(work_bv_w(i,:,ilev0+k)+work_bv_w(i+1,:,ilev0+k)) enddo call fv3_h_to_ll_regular_grids(u,workau2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) call fv3_h_to_ll_regular_grids(v,workav2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) @@ -2180,10 +2188,10 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) - work_bu_w(:,:,k)=work_bu_w(:,:,k)+workbu_w2(:,:) - work_bu_s(:,:,k)=work_bu_s(:,:,k)+workbu_s2(:,:) - work_bv_w(:,:,k)=work_bv_w(:,:,k)+workbv_w2(:,:) - work_bv_s(:,:,k)=work_bv_s(:,:,k)+workbv_s2(:,:) + work_bu_w(:,:,ilev0+k)=work_bu_w(:,:,ilev0+k)+workbu_w2(:,:) + work_bu_s(:,:,ilev0+k)=work_bu_s(:,:,ilev0+k)+workbu_s2(:,:) + work_bv_w(:,:,ilev0+k)=work_bv_w(:,:,ilev0+k)+workbv_w2(:,:) + work_bv_s(:,:,ilev0+k)=work_bv_s(:,:,ilev0+k)+workbv_s2(:,:) enddo deallocate(workau2,workav2) deallocate(workbu_w2,workbv_w2) @@ -2197,19 +2205,19 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) work_bu_w(i,:,k)=half*(u(i,:)+u(i+1,:)) work_bv_w(i,:,k)=half*(v(i,:)+v(i+1,:)) enddo - work_bu_w(1,:,k)=u(1,:) - work_bv_w(1,:,k)=v(1,:) - work_bu_w(nlon_regional+1,:,k)=u(nlon_regional,:) - work_bv_w(nlon_regional+1,:,k)=v(nlon_regional,:) + work_bu_w(1,:,ilev0+k)=u(1,:) + work_bv_w(1,:,ilev0+k)=v(1,:) + work_bu_w(nlon_regional+1,:,ilev0+k)=u(nlon_regional,:) + work_bv_w(nlon_regional+1,:,ilev0+k)=v(nlon_regional,:) do j=2,nlat_regional-1 - work_bu_s(:,j,k)=half*(u(:,j)+u(:,j+1)) - work_bv_s(:,j,k)=half*(v(:,j)+v(:,j+1)) + work_bu_s(:,j,ilev0+k)=half*(u(:,j)+u(:,j+1)) + work_bv_s(:,j,ilev0+k)=half*(v(:,j)+v(:,j+1)) enddo - work_bu_s(:,1,k)=u(:,1) - work_bv_s(:,1,k)=v(:,1) - work_bu_s(:,nlat_regional+1,k)=u(:,nlat_regional) - work_bv_s(:,nlat_regional+1,k)=v(:,nlat_regional) + work_bu_s(:,1,ilev0+k)=u(:,1) + work_bv_s(:,1,ilev0+k)=v(:,1) + work_bu_s(:,nlat_regional+1,ilev0+k)=u(:,nlat_regional) + work_bv_s(:,nlat_regional+1,ilev0+k)=v(:,nlat_regional) enddo @@ -2320,7 +2328,8 @@ subroutine gsi_fv3ncdf_writeps_v1(filename,varname,var,mype_io,add_saved) call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) - deallocate(worka2,workb2) + if (allocated(worka2)) deallocate(worka2) + if ( allocated(workb2)) deallocate(workb2) deallocate(work_b,work_a,work_bi) end if !mype_io @@ -2437,6 +2446,124 @@ subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) deallocate(work,work_sub) end subroutine gsi_fv3ncdf_write +subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_nemsio_write +! pgrmmr: wu +! +! abstract: +! +! program history log: +! 2020-03-05 lei modified from gsi_fv3ncdf_write to gsi_fv3ncdf_write_v1 +! input argument list: +! varu,varv +! add_saved +! mype - mpi task id +! mype_io +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype + use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig + use gridmod, only: ijn,displs_g,itotsub,iglobal + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids + use general_commvars_mod, only: ltosi,ltosj + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_write,nf90_inq_varid + use netcdf, only: nf90_put_var,nf90_get_var + implicit none + + real(r_kind) ,intent(in ) :: var(lat2,lon2,nsig) + integer(i_kind),intent(in ) :: mype_io + logical ,intent(in ) :: add_saved + character(*) ,intent(in ) :: varname,filename + + integer(i_kind) :: VarId,gfile_loc + integer(i_kind) :: ilev0 + integer(i_kind) i,j,mm1,k,kr,ns,n,m + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_a + real(r_kind),allocatable,dimension(:,:,:):: work_b + real(r_kind),allocatable,dimension(:,:):: workb2,worka2 + integer ii + + + mm1=mype+1 + + allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) +!!!!!!!! reverse z !!!!!!!!!!!!!! + do k=1,nsig + kr=nsig+1-k + do i=1,lon1 + do j=1,lat1 + work_sub(j,i,kr)=var(j+1,i+1,k) + end do + end do + enddo + call mpi_gatherv(work_sub,ijnz(mm1),mpi_rtype, & + work,ijnz,displsz_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + allocate( work_a(nlat,nlon,nsig)) + ns=0 + do m=1,npe + do k=1,nsig + do n=displs_g(m)+1,displs_g(m)+ijn(m) + ns=ns+1 + work_a(ltosi(n),ltosj(n),k)=work(ns) + end do + enddo + enddo + if(trim(varname).eq.'t') then + do ii=1,nsig + write(6,*)'thinkdeb work_a for t ',work_a(2:3,2:3,ii) + enddo + endif + + allocate( work_b(nlon_regional,nlat_regional,nsig+1)) + + call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) + call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + call check( nf90_get_var(gfile_loc,VarId,work_b) ) + ilev0=1 + write(6,*)'thinkdeb251 add_saved is ',add_saved + + if(add_saved)then + allocate( workb2(nlon_regional,nlat_regional)) + allocate( worka2(nlat,nlon)) +!clt for being now only lev between (including ) 2 and nsig+1 of work_b (:,:,lev) +!clt are updated + do k=1,nsig + call fv3_h_to_ll_regular_grids(work_b(:,:,ilev0+k),worka2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) +!!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! + work_a(:,:,k)=work_a(:,:,k)-worka2(:,:) + call fv3_ll_to_h_regular_grids(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + work_b(:,:,ilev0+k)=work_b(:,:,ilev0+k)+workb2(:,:) + enddo + deallocate(worka2,workb2) + else + do k=1,nsig + call fv3_ll_to_h_regular_grids(work_a(1,1,k),work_b(1,1,ilev0+k),nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) + enddo + endif + + print *,'write out ',trim(varname),' to ',trim(filename) + call check( nf90_put_var(gfile_loc,VarId,work_b) ) + call check( nf90_close(gfile_loc) ) + deallocate(work_b,work_a) + end if !mype_io + + deallocate(work,work_sub) + +end subroutine gsi_fv3ncdf_write_v1 subroutine check(status) use kinds, only: i_kind use netcdf, only: nf90_noerr,nf90_strerror diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 116864aac7..d3ad63acfe 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -1294,9 +1294,12 @@ subroutine gsimain_initialize if (regional_ensemble_option==5) then n_ens_gfs=0 n_ens_fv3sar=n_ens - else + elseif (regional_ensemble_option==1) then + n_ens_gfs=n_ens + else write(6,*)'n_ens_gfs and n_ens_fv3sar won"t be used if not regional_ensemble_option==5' endif + endif if(ltlint) then if(vqc .or. njqc)then From 6a8a0f79fec2575fe39d4020c707f08c3e87c5dd Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 9 Mar 2020 18:38:55 +0000 Subject: [PATCH 041/155] manually incorporate Wanshu's fix dealing with the problem near lon=0 for fv3sar --- src/gsi/mod_fv3_lola.f90 | 21 ++++++++++++++++++--- src/gsi/mod_fv3_lolgrid.f90 | 23 ++++++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 index 13a394c9bd..28ac2c98f6 100644 --- a/src/gsi/mod_fv3_lola.f90 +++ b/src/gsi/mod_fv3_lola.f90 @@ -16,6 +16,8 @@ module mod_fv3_lola ! 2017-10-10 wu w - setup interpolation and trnsform coeff in generate_anl_grid ! add routines earthuv2fv3, fv3uv2earth, fv3_h_to_ll ! fv3_ll_to_h +! 2019-11-01 wu - add checks in generate_anl_grid to present the mean +! longitude correctly to fix problem near lon=0 ! ! subroutines included: ! sub generate_anl_grid @@ -90,6 +92,8 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) ! 2. compute/setup FV3 to A grid interpolation parameters ! 3. compute/setup A to FV3 grid interpolation parameters ! 4. setup weightings for wind conversion from FV3 to earth +! 2019-11-01 wu - add checks to present the mean longitude correctly to fix +! problem near lon=0 ! ! input argument list: ! nx, ny - number of cells = nx*ny @@ -140,6 +144,7 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) real(r_kind) xv,yv,zv,vval real(r_kind) cx,cy real(r_kind) uval,ewval,nsval + real(r_kind) diff,sq180 real(r_kind) d(4),ds integer(i_kind) kk,k @@ -509,12 +514,17 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) enddo ! 2 find angles to E-W and N-S for U edges - + sq180=180._r_kind**2 do j=1,ny+1 do i=1,nx ! center lat/lon of the edge rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) - rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) + diff=(grid_lon(i,j)-grid_lon(i+1,j))**2 + if(diff < sq180)then + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) + else + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)-360._r_kind) + endif ! vector to center of the edge xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) @@ -536,7 +546,12 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) do j=1,ny do i=1,nx+1 rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) - rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + diff=(grid_lon(i,j)-grid_lon(i,j+1))**2 + if(diff < sq180)then + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + else + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)-360._r_kind) + endif xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) zr=sin(rlat*deg2rad) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index a474194417..9a2bf12d71 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -16,6 +16,9 @@ module mod_fv3_lolgrid ! 2017-10-10 wu w - setup interpolation and trnsform coeff in generate_anl_grid ! add routines earthuv2fv3, fv3uv2earth, fv3_h_to_ll ! fv3_ll_to_h +! 2019-11-01 wu - add checks in generate_anl_grid to present the mean + ! longitude correctly to fix problem near lon=0 +! ! ! subroutines included: ! sub generate_anl_grid @@ -104,10 +107,13 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ ! 3. compute/setup A to FV3 grid interpolation parameters ! 4. setup weightings for wind conversion from FV3 to earth ! +! 2019-11-01 wu - add checks to present the mean longitude correctly to fix ! input argument list: ! nx, ny - number of cells = nx*ny ! grid_lon ,grid_lat - longitudes and latitudes of fv3 grid cell corners ! grid_lont,grid_latt - longitudes and latitudes of fv3 grid cell centers + ! problem near lon=0 + ! ! output argument list: ! @@ -166,6 +172,7 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ real(r_kind) xv,yv,zv,vval real(r_kind) cx,cy real(r_kind) uval,ewval,nsval + real(r_kind) diff,sq180 real(r_kind) d(4),ds integer(i_kind) kk,k @@ -570,12 +577,17 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ enddo ! 2 find angles to E-W and N-S for U edges - + sq180=180._r_kind**2 do j=1,ny+1 do i=1,nx ! center lat/lon of the edge rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) - rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) + diff=(grid_lon(i,j)-grid_lon(i+1,j))**2 + if(diff < sq180)then + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) + else + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)-360._r_kind) + endif ! vector to center of the edge xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) @@ -597,7 +609,12 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ do j=1,ny do i=1,nx+1 rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) - rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + diff=(grid_lon(i,j)-grid_lon(i,j+1))**2 + if(diff < sq180)then + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + else + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)-360._r_kind) + endif xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) zr=sin(rlat*deg2rad) From fd5410984db555ba2673de0524d218b0f74f36d8 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 16 Mar 2020 13:39:43 +0000 Subject: [PATCH 042/155] with a fix for calculation of coeffx and coeffy incorporated with the current dual resolution option --- src/class_get_fv3_regional_ensperts.f90 | 32 -- src/cplr_get_fv3_regional_ensperts.f90 | 667 ------------------------ src/gsi/gsi_rfv3io_mod.f90 | 7 +- src/gsi/mod_fv3_lolgrid.f90 | 8 +- 4 files changed, 7 insertions(+), 707 deletions(-) delete mode 100644 src/class_get_fv3_regional_ensperts.f90 delete mode 100644 src/cplr_get_fv3_regional_ensperts.f90 diff --git a/src/class_get_fv3_regional_ensperts.f90 b/src/class_get_fv3_regional_ensperts.f90 deleted file mode 100644 index e3e4b5ed46..0000000000 --- a/src/class_get_fv3_regional_ensperts.f90 +++ /dev/null @@ -1,32 +0,0 @@ -module abstract_get_fv3_regional_ensperts_mod -!clt first copied from class_get_wrf_nmm_ensperts.f90 - type, abstract :: abstract_get_fv3_regional_ensperts_class - contains - procedure(get_fv3_regional_ensperts), deferred, pass(this) :: get_fv3_regional_ensperts -!cltthink procedure(convert_binary_nmm_ens), deferred, pass(this) :: convert_binary_nmm_ens - end type abstract_get_fv3_regional_ensperts_class - - abstract interface - subroutine get_fv3_regional_ensperts(this,en_perts,nelen,ps_bar) - use gsi_bundlemod, only: gsi_bundle - use kinds, only: r_kind,i_kind,r_single - - import abstract_get_fv3_regional_ensperts_class - implicit none - class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this - type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - real(r_single),dimension(:,:,:),allocatable, intent(inout):: ps_bar - - end subroutine get_fv3_regional_ensperts - end interface - abstract interface - - subroutine convert_binary_fv3_regional_ens(this) - import abstract_get_fv3_regional_ensperts_class - implicit none - class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this - end subroutine convert_binary_fv3_regional_ens - end interface - -end module abstract_get_fv3_regional_ensperts_mod diff --git a/src/cplr_get_fv3_regional_ensperts.f90 b/src/cplr_get_fv3_regional_ensperts.f90 deleted file mode 100644 index 112ea9457f..0000000000 --- a/src/cplr_get_fv3_regional_ensperts.f90 +++ /dev/null @@ -1,667 +0,0 @@ -module get_fv3_regional_ensperts_mod -!clt started from cplr_get_fv3_regional_ensperts.f90 -use abstract_get_fv3_regional_ensperts_mod - use kinds, only : i_kind - type, extends(abstract_get_fv3_regional_ensperts_class) :: get_fv3_regional_ensperts_class - contains - procedure, pass(this) :: get_fv3_regional_ensperts => get_fv3_regional_ensperts_run - procedure, pass(this) :: ens_spread_dualres_regional => ens_spread_dualres_regional_fv3_regional - procedure, pass(this) :: general_read_fv3_regional - end type get_fv3_regional_ensperts_class -contains - subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) - !$$$ subprogram documentation block - ! . . . . - ! subprogram: get_fv3_regional_ensperts read arw model ensemble members - ! prgmmr: Ting org: ncar/mmm date: 2018-12-13 - ! - ! abstract: read ensemble members from the fv3 regional (fv3_SAR) - ! model,following Wanshu's programs to read those background files - ! - ! - ! program history log: - ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle - ! - ! input argument list: - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - - use kinds, only: r_kind,i_kind,r_single - use constants, only: zero,one,half,zero_single,rd_over_cp,one_tenth - use mpimod, only: mpi_comm_world,ierror,mype - use hybrid_ensemble_parameters, only: n_ens,grd_ens - use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path - use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d - use gsi_bundlemod, only: gsi_bundlecreate - use gsi_bundlemod, only: gsi_grid - use gsi_bundlemod, only: gsi_bundle - use gsi_bundlemod, only: gsi_bundlegetpointer - use gsi_bundlemod, only: gsi_bundledestroy - use gsi_bundlemod, only: gsi_gridcreate - use guess_grids, only: ntguessig,ifilesig - use gsi_4dvar, only: nhr_assimilation - use gsi_4dvar, only: ens_fhrlevs - use gsi_rfv3io_mod, only: type_fv3regfilenameg - - implicit none - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - real(r_single),dimension(:,:,:),allocatable,intent(inout):: ps_bar - - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig):: u,v,tv,cwmr,oz,rh - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2):: ps - - real(r_single),pointer,dimension(:,:,:):: w3 - real(r_single),pointer,dimension(:,:):: w2 - real(r_kind),pointer,dimension(:,:,:):: x3 - real(r_kind),pointer,dimension(:,:):: x2 - type(gsi_bundle),allocatable,dimension(:):: en_bar - type(gsi_grid):: grid_ens - real(r_kind):: bar_norm,sig_norm,kapr,kap1 - - integer(i_kind):: i,j,k,n,mm1,istatus - integer(i_kind):: ic2,ic3 - integer(i_kind):: m - - character(255) filelists(ntlevs_ens) - character(255) ensfilenam_str - type(type_fv3regfilenameg)::fv3_filename - - call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) - ! Allocate bundle to hold mean of ensemble members - allocate(en_bar(ntlevs_ens)) - do m=1,ntlevs_ens - call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' - call stop2(999) - endif - enddo ! for m - - - do m=1,ntlevs_ens - - - - ! - ! INITIALIZE ENSEMBLE MEAN ACCUMULATORS - en_bar(m)%values=zero - - do n=1,n_ens - en_perts(n,m)%valuesr4 = zero - enddo - - mm1=mype+1 - kap1=rd_over_cp+one - kapr=one/rd_over_cp - ! - ! LOOP OVER ENSEMBLE MEMBERS - do n=1,n_ens - write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n -22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) - ! DEFINE INPUT FILE NAME - fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe - fv3_filename%ak_bk=trim(ensfilenam_str)//'fv3_akbk' - fv3_filename%dynvars=trim(ensfilenam_str)//'-fv3_dynavars' - fv3_filename%tracers=trim(ensfilenam_str)//"-fv3_tracer" - fv3_filename%sfcdata=trim(ensfilenam_str)//"-fv3_sfcdata" - fv3_filename%couplerres=trim(ensfilenam_str)//"-coupler.res" - ! - ! READ ENEMBLE MEMBERS DATA - if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) - call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) - - ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR - do ic3=1,nc3d - - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars3d(ic3)),w3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for ensemble member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars3d(ic3)),x3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for en_bar' - call stop2(999) - end if - - select case (trim(cvars3d(ic3))) - - case('sf','SF') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = u(j,i,k) - x3(j,i,k)=x3(j,i,k)+u(j,i,k) - end do - end do - end do - - case('vp','VP') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = v(j,i,k) - x3(j,i,k)=x3(j,i,k)+v(j,i,k) - end do - end do - end do - - case('t','T') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = tv(j,i,k) - x3(j,i,k)=x3(j,i,k)+tv(j,i,k) - end do - end do - end do - - case('q','Q') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = rh(j,i,k) - x3(j,i,k)=x3(j,i,k)+rh(j,i,k) - end do - end do - end do - - case('oz','OZ') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = oz(j,i,k) - x3(j,i,k)=x3(j,i,k)+oz(j,i,k) - end do - end do - end do - - - end select - end do - - do ic2=1,nc2d - - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars2d(ic2)),w2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for ensemble member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar' - call stop2(999) - end if - - select case (trim(cvars2d(ic2))) - - case('ps','PS') - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w2(j,i) = ps(j,i) - x2(j,i)=x2(j,i)+ps(j,i) - end do - end do - - case('sst','SST') - ! IGNORE SST IN HYBRID for now - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w2(j,i) = zero - x2(j,i)=zero - end do - end do - - end select - end do - enddo - ! - ! CALCULATE ENSEMBLE MEAN - bar_norm = one/float(n_ens) - en_bar(m)%values=en_bar(m)%values*bar_norm - - ! Copy pbar to module array. ps_bar may be needed for vertical localization - ! in terms of scale heights/normalized p/p - do ic2=1,nc2d - - if(trim(cvars2d(ic2)) == 'ps'.or.trim(cvars2d(ic2)) == 'PS') then - - call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar to get ps_bar' - call stop2(999) - end if - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - ps_bar(j,i,1)=x2(j,i) - end do - end do - exit - end if - end do - - call mpi_barrier(mpi_comm_world,ierror) - ! - ! CALCULATE ENSEMBLE SPREAD - call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) - call mpi_barrier(mpi_comm_world,ierror) - ! - ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS - sig_norm=sqrt(one/max(one,n_ens-one)) - - do n=1,n_ens - do i=1,nelen - en_perts(n,m)%valuesr4(i)=(en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i))*sig_norm - end do - end do - - enddo ! it 4d loop - do m=1,ntlevs_ens - call gsi_bundledestroy(en_bar(m),istatus) - if(istatus/=0) then - write(6,*)' in get_fv3_regional_ensperts_netcdf: trouble destroying en_bar bundle' - call stop2(999) - endif - end do - - deallocate(en_bar) - ! - - return - -30 write(6,*) 'get_fv3_regional_ensperts_netcdf: open filelist failed ' - call stop2(555) -20 write(6,*) 'get_fv3_regional_ensperts_netcdf: read WRF-ARW ens failed ',n - call stop2(555) - - end subroutine get_fv3_regional_ensperts_run - - subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) -!clt modified from rad_fv3_netcdf_guess - !$$$ subprogram documentation block - ! . . . . - ! subprogram: general_read_fv3_regional read arw model ensemble members - ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 - ! - ! abstract: read ensemble members from the arw model in "wrfout" netcdf format - ! for use with hybrid ensemble option. - ! - ! program history log: - ! 2010-08-11 parrish, initial documentation - ! 2010-09-10 parrish, modify so ensemble variables are read in the same way as in - ! subroutines convert_netcdf_mass and read_fv3_regional_binary_guess. - ! There were substantial differences due to different opinion about what - ! to use for surface pressure. This issue should be resolved by coordinating - ! with Ming Hu (ming.hu@noaa.gov). At the moment, these changes result in - ! agreement to single precision between this input method and the guess input - ! procedure when the same file is read by both methods. - ! 2012-03-12 whitaker: read data on root, distribute with scatterv. - ! remove call to general_reload. - ! simplify, fix memory leaks, reduce memory footprint. - ! use genqsat, remove genqsat2_regional. - ! replace bare 'stop' statements with call stop2(999). - ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS core - ! - ! input argument list: - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - - use netcdf, only: nf90_nowrite - use netcdf, only: nf90_open,nf90_close - use netcdf, only: nf90_inq_dimid,nf90_inquire_dimension - use netcdf, only: nf90_inq_varid,nf90_inquire_variable,nf90_get_var - use kinds, only: r_kind,r_single,i_kind - use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll - use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 - use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens - use mpimod, only: mpi_comm_world,ierror,mpi_rtype - use mpimod, only: npe - use netcdf_mod, only: nc_check - use gsi_rfv3io_mod,only: type_fv3regfilenameg - use gsi_rfv3io_mod,only:n2d - use gsi_rfv3io_mod,only:mype_t,mype_p ,mype_q,mype_oz - use constants, only: half,zero - use gsi_rfv3io_mod, only: gsi_fv3ncdf_read - use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv - - implicit none - ! - ! Declare passed variables - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type (type_fv3regfilenameg) , intent (in) :: fv3_filenameginput - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig),intent(out)::g_u,g_v,g_tv,g_rh,g_oz - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2),intent(out):: g_ps - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ::g_tsen, g_q,g_prsl - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig+1) ::g_prsi - ! - ! Declare local parameters - real(r_kind),parameter:: r0_01 = 0.01_r_kind - real(r_kind),parameter:: r10 = 10.0_r_kind - real(r_kind),parameter:: r100 = 100.0_r_kind - ! - ! Declare local variables - real(r_single),allocatable,dimension(:):: temp_1d - real(r_single),allocatable,dimension(:,:):: temp_2d,temp_2d2 - real(r_single),allocatable,dimension(:,:,:):: temp_3d - real(r_kind),allocatable,dimension(:):: p_top - real(r_kind),allocatable,dimension(:,:):: q_integral,gg_ps,q_integralc4h - real(r_kind),allocatable,dimension(:,:,:):: tsn,qst,prsl,& - gg_u,gg_v,gg_tv,gg_rh - real(r_kind),allocatable,dimension(:):: wrk_fill_2d - integer(i_kind),allocatable,dimension(:):: dim,dim_id - - integer(i_kind):: nx,ny,nz,i,j,k,d_max,file_id,var_id,ndim,mype,kp - integer(i_kind):: Time_id,s_n_id,w_e_id,b_t_id,s_n_stag_id,w_e_stag_id,b_t_stag_id - integer(i_kind):: Time_len,s_n_len,w_e_len,b_t_len,s_n_stag_len,w_e_stag_len,b_t_stag_len - integer(i_kind) iderivative - - real(r_kind):: deltasigma - real(r_kind) psfc_this_dry,psfc_this - real(r_kind) work_prslk,work_prsl - - logical ice - - character(len=24),parameter :: myname_ = 'general_read_fv3_regional' - - character(len=:),allocatable :: grid_spec !='fv3_grid_spec' - character(len=:),allocatable :: ak_bk !='fv3_akbk' - character(len=:),allocatable :: dynvars !='fv3_dynvars' - character(len=:),allocatable :: tracers !='fv3_tracer' - character(len=:),allocatable :: sfcdata !='fv3_sfcdata' - character(len=:),allocatable :: couplerres!='coupler.res' - integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) - integer(i_kind),allocatable:: ijnz(:),displsz_g(:) - - grid_spec=fv3_filenameginput%grid_spec - ak_bk=fv3_filenameginput%ak_bk - dynvars=fv3_filenameginput%dynvars - tracers=fv3_filenameginput%tracers - sfcdata=fv3_filenameginput%sfcdata - couplerres=fv3_filenameginput%couplerres - - - - allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) - allocate(displss(npe),displss2d(npe),displsz_g(npe) ) - -!cltthinktobe should be contained in variable like grd_ens - do i=1,npe - ijns(i)=grd_ens%ijn_s(i)*grd_ens%nsig - ijnz(i)=grd_ens%ijn(i)*grd_ens%nsig - ijns2d(i)=grd_ens%ijn_s(i)*n2d - enddo - displss(1)=0 - displsz_g(1)=0 - displss2d(1)=0 - do i=2,npe - displss(i)=displss(i-1)+ ijns(i-1) - displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) - displss2d(i)=displss2d(i-1)+ ijns2d(i-1) - enddo - -! do it=1,nfldsig - - - - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) - g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid - do i=grd_ens%nsig,1,-1 - g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) - enddo - g_ps(:,:)=g_prsi(:,:,1) - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) -! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) - -!! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_tv(i,j,k)=g_tsen(i,j,k)*(one+fv*g_q(i,j,k)) - enddo - enddo - enddo - if (.not.q_hyb_ens) then - ice=.true. - iderivative=0 - do k=1,grd_ens%nsig - kp=k+1 - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_prsl(i,j,k)=(g_prsi(i,j,k)+g_prsi(i,j,kp))*half - - end do - end do - end do - - call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k)/g_rh(i,j,k) - end do - end do - end do - else - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k) - end do - end do - end do - end if - - - -!clt not needed call gsi_fv3ncdf2d_read(it,ges_z) - - return - end subroutine general_read_fv3_regional - subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_bar) - !$$$ subprogram documentation block - ! . . . . - ! subprogram: ens_spread_dualres_regional - ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 - ! - ! abstract: - ! - ! - ! program history log: - ! 2010-08-11 parrish, initial documentation - ! 2011-04-05 parrish - add pseudo-bundle capability - ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle - ! - ! input argument list: - ! en_bar - ensemble mean - ! mype - current processor number - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - ! - use kinds, only: r_single,r_kind,i_kind - use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_anl,p_e2a,uv_hyb_ens, & - regional_ensemble_option - use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_create_info,general_sube2suba - use constants, only: zero,two,half,one - use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d - use gsi_bundlemod, only: gsi_bundlecreate - use gsi_bundlemod, only: gsi_grid - use gsi_bundlemod, only: gsi_bundle - use gsi_bundlemod, only: gsi_bundlegetpointer - use gsi_bundlemod, only: gsi_bundledestroy - use gsi_bundlemod, only: gsi_gridcreate - implicit none - - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type(gsi_bundle),OPTIONAL,intent(in):: en_bar - integer(i_kind),intent(in):: mype - type(gsi_bundle),allocatable, intent(in ) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - - type(gsi_bundle):: sube,suba - type(gsi_grid):: grid_ens,grid_anl - real(r_kind) sp_norm,sig_norm_sq_inv - type(sub2grid_info)::se,sa - integer(i_kind) k - - integer(i_kind) i,n,ic3 - logical regional - integer(i_kind) num_fields,inner_vars,istat,istatus - logical,allocatable::vector(:) - real(r_kind),pointer,dimension(:,:,:):: st,vp,tv,rh,oz,cw - real(r_kind),pointer,dimension(:,:):: ps - real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2,grd_anl%nsig),target::dum3 - real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2),target::dum2 - - associate( this => this ) ! eliminates warning for unused dummy argument needed for binding - end associate - - ! create simple regular grid - call gsi_gridcreate(grid_anl,grd_anl%lat2,grd_anl%lon2,grd_anl%nsig) - call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) - - ! create two internal bundles, one on analysis grid and one on ensemble grid - - call gsi_bundlecreate (suba,grid_anl,'ensemble work',istatus, & - names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' in ens_spread_dualres_regional: trouble creating bundle_anl bundle' - call stop2(999) - endif - call gsi_bundlecreate (sube,grid_ens,'ensemble work ens',istatus, & - names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' ens_spread_dualres_regional: trouble creating bundle_ens bundle' - call stop2(999) - endif - - sp_norm=(one/float(n_ens)) - - sube%values=zero - ! - - if(regional_ensemble_option == 1)then - print *,'global ensemble' - sig_norm_sq_inv=n_ens-one - - do n=1,n_ens - do i=1,nelen - sube%values(i)=sube%values(i) & - +en_perts(n,1)%valuesr4(i)*en_perts(n,1)%valuesr4(i) - end do - end do - - do i=1,nelen - sube%values(i) = sqrt(sp_norm*sig_norm_sq_inv*sube%values(i)) - end do - else - do n=1,n_ens - do i=1,nelen - sube%values(i)=sube%values(i) & - +(en_perts(n,1)%valuesr4(i)-en_bar%values(i))*(en_perts(n,1)%valuesr4(i)-en_bar%values(i)) - end do - end do - - do i=1,nelen - sube%values(i) = sqrt(sp_norm*sube%values(i)) - end do - end if - - if(grd_ens%latlon1n == grd_anl%latlon1n) then - do i=1,nelen - suba%values(i)=sube%values(i) - end do - else - inner_vars=1 - num_fields=max(0,nc3d)*grd_ens%nsig+max(0,nc2d) - allocate(vector(num_fields)) - vector=.false. - do ic3=1,nc3d - if(trim(cvars3d(ic3))=='sf'.or.trim(cvars3d(ic3))=='vp') then - do k=1,grd_ens%nsig - vector((ic3-1)*grd_ens%nsig+k)=uv_hyb_ens - end do - end if - end do - call general_sub2grid_create_info(se,inner_vars,grd_ens%nlat,grd_ens%nlon,grd_ens%nsig,num_fields, & - regional,vector) - call general_sub2grid_create_info(sa,inner_vars,grd_anl%nlat,grd_anl%nlon,grd_anl%nsig,num_fields, & - regional,vector) - deallocate(vector) - call general_sube2suba(se,sa,p_e2a,sube%values,suba%values,regional) - end if - - dum2=zero - dum3=zero - call gsi_bundlegetpointer(suba,'sf',st,istat) - if(istat/=0) then - write(6,*)' no sf pointer in ens_spread_dualres, point st at dum3 array' - st => dum3 - end if - call gsi_bundlegetpointer(suba,'vp',vp,istat) - if(istat/=0) then - write(6,*)' no vp pointer in ens_spread_dualres, point vp at dum3 array' - vp => dum3 - end if - call gsi_bundlegetpointer(suba,'t',tv,istat) - if(istat/=0) then - write(6,*)' no t pointer in ens_spread_dualres, point tv at dum3 array' - tv => dum3 - end if - call gsi_bundlegetpointer(suba,'q',rh,istat) - if(istat/=0) then - write(6,*)' no q pointer in ens_spread_dualres, point rh at dum3 array' - rh => dum3 - end if - call gsi_bundlegetpointer(suba,'oz',oz,istat) - if(istat/=0) then - write(6,*)' no oz pointer in ens_spread_dualres, point oz at dum3 array' - oz => dum3 - end if - call gsi_bundlegetpointer(suba,'cw',cw,istat) - if(istat/=0) then - write(6,*)' no cw pointer in ens_spread_dualres, point cw at dum3 array' - cw => dum3 - end if - call gsi_bundlegetpointer(suba,'ps',ps,istat) - if(istat/=0) then - write(6,*)' no ps pointer in ens_spread_dualres, point ps at dum2 array' - ps => dum2 - end if - - call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) - - return - end subroutine ens_spread_dualres_regional_fv3_regional - -end module get_fv3_regional_ensperts_mod diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index f408af183c..879b4afbe3 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -330,6 +330,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) region_dxi,region_dyi, & coeffx,coeffy) + deallocate (grid_lon,grid_lat,grid_lont,grid_latt) deallocate (ak,bk,abk_fv3) @@ -2487,11 +2488,6 @@ subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) end do enddo enddo - if(trim(varname).eq.'t') then - do ii=1,nsig - write(6,*)'thinkdeb work_a for t ',work_a(2:3,2:3,ii) - enddo - endif allocate( work_b(nlon_regional,nlat_regional,nsig+1)) @@ -2499,7 +2495,6 @@ subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) call check( nf90_get_var(gfile_loc,VarId,work_b) ) ilev0=1 - write(6,*)'thinkdeb251 add_saved is ',add_saved if(add_saved)then allocate( workb2(nlon_regional,nlat_regional)) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 9a2bf12d71..fc14628c6f 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -176,6 +176,7 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ real(r_kind) d(4),ds integer(i_kind) kk,k + real(r_kind),allocatable:: rtem1(:,:) nord_e2a=4 @@ -284,6 +285,7 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ allocate(region_dxi_out(nlatout,nlonout),region_dyi_out(nlatout,nlonout)) if (present(coeffx_out)) allocate(coeffx_out(nlatout,nlonout)) if (present(coeffy_out)) allocate(coeffy_out(nlatout,nlonout)) + allocate(rtem1(nlatout,nlonout)) dyy=rearth*adlat*deg2rad dyyi=one/dyy dyyh=half/dyy @@ -291,9 +293,10 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ do i=1,nlatout region_dy_out(i,j)=dyy region_dyi_out(i,j)=dyyi + rtem1(i,j)=dyyh enddo enddo - if (present(coeffy_out)) coeffy_out=dyyh + if (present(coeffy_out)) coeffy_out=rtem1 do i=1,nlatout dxx=rearth*cos(rlat_in(i,1)*deg2rad)*adlon*deg2rad @@ -302,9 +305,10 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ do j=1,nlonout region_dx_out(i,j)=dxx region_dxi_out(i,j)=dxxi + rtem1(i,j)=dxxh enddo enddo - if (present(coeffx_out)) coeffx_out=dxxh + if (present(coeffx_out)) coeffx_out=rtem1 ! From 6f00e80da28dbdcbafdbc2035b57c707c87c5429 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Fri, 24 Apr 2020 14:36:03 +0000 Subject: [PATCH 043/155] another fix for fv3sar_bg_opt!=0 --- src/gsi/gsi_rfv3io_mod.f90 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 879b4afbe3..5d018f8929 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -2134,18 +2134,18 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) !!!!!!!! add analysis_inc to readin work_b !!!!!!!!!!!!!!!! - do i=2,nlon_regional-1 - workbu_w2(i,:)=half*(u(i,:)+u(i+1,:)) - workbv_w2(i,:)=half*(v(i,:)+v(i+1,:)) + do i=2,nlon_regional + workbu_w2(i,:)=half*(u(i-1,:)+u(i,:)) + workbv_w2(i,:)=half*(v(i-1,:)+v(i,:)) enddo workbu_w2(1,:)=u(1,:) workbv_w2(1,:)=v(1,:) workbu_w2(nlon_regional+1,:)=u(nlon_regional,:) workbv_w2(nlon_regional+1,:)=v(nlon_regional,:) - do j=2,nlat_regional-1 - workbu_s2(:,j)=half*(u(:,j)+u(:,j+1)) - workbv_s2(:,j)=half*(v(:,j)+v(:,j+1)) + do j=2,nlat_regional + workbu_s2(:,j)=half*(u(:,j-1)+u(:,j)) + workbv_s2(:,j)=half*(v(:,j-1)+v(:,j)) enddo workbu_s2(:,1)=u(:,1) workbv_s2(:,1)=v(:,1) @@ -2167,18 +2167,18 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call fv3_ll_to_h_regular_grids(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) call fv3_ll_to_h_regular_grids(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) - do i=2,nlon_regional-1 - work_bu_w(i,:,k)=half*(u(i,:)+u(i+1,:)) - work_bv_w(i,:,k)=half*(v(i,:)+v(i+1,:)) + do i=2,nlon_regional + work_bu_w(i,:,k)=half*(u(i-1,:)+u(i,:)) + work_bv_w(i,:,k)=half*(v(i-1,:)+v(i,:)) enddo work_bu_w(1,:,ilev0+k)=u(1,:) work_bv_w(1,:,ilev0+k)=v(1,:) work_bu_w(nlon_regional+1,:,ilev0+k)=u(nlon_regional,:) work_bv_w(nlon_regional+1,:,ilev0+k)=v(nlon_regional,:) - do j=2,nlat_regional-1 - work_bu_s(:,j,ilev0+k)=half*(u(:,j)+u(:,j+1)) - work_bv_s(:,j,ilev0+k)=half*(v(:,j)+v(:,j+1)) + do j=2,nlat_regional + work_bu_s(:,j,ilev0+k)=half*(u(:,j-1)+u(:,j)) + work_bv_s(:,j,ilev0+k)=half*(v(:,j-1)+v(:,j)) enddo work_bu_s(:,1,ilev0+k)=u(:,1) work_bv_s(:,1,ilev0+k)=v(:,1) From 5aacceefd7492157a6a3b3695aab64d445a62884 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 18 May 2020 01:37:07 +0000 Subject: [PATCH 044/155] with fix for fv3sar wind-rotation --- src/gsi/aniso_ens_util.f90 | 29 ++++---- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 5 +- src/gsi/get_gefs_for_regional.f90 | 82 ++++++++++++++-------- src/gsi/gfs_stratosphere.f90 | 24 ++++--- src/gsi/gridmod.F90 | 3 + src/gsi/guess_grids.F90 | 2 +- src/gsi/hybrid_ensemble_isotropic.F90 | 1 + src/gsi/read_abi.f90 | 1 + src/gsi/read_fl_hdob.f90 | 5 +- src/gsi/read_prepbufr.f90 | 5 +- src/gsi/read_radar.f90 | 17 +++-- src/gsi/read_radar_wind_ascii.f90 | 6 +- src/gsi/read_rapidscat.f90 | 5 +- src/gsi/read_satwnd.f90 | 5 +- src/gsi/read_sfcwnd.f90 | 5 +- src/gsi/setupuwnd10m.f90 | 8 ++- src/gsi/setupvwnd10m.f90 | 8 ++- src/gsi/setupw.f90 | 8 +-- 18 files changed, 134 insertions(+), 85 deletions(-) diff --git a/src/gsi/aniso_ens_util.f90 b/src/gsi/aniso_ens_util.f90 index 249b011308..f118bee40f 100644 --- a/src/gsi/aniso_ens_util.f90 +++ b/src/gsi/aniso_ens_util.f90 @@ -65,6 +65,7 @@ subroutine ens_uv_to_psichi(u,v,truewind) ! ! program history log: ! 2008-08-21 pondeca +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! u(nlat,nlon) - earth relative u-field on analysis grid @@ -82,7 +83,7 @@ subroutine ens_uv_to_psichi(u,v,truewind) use kinds, only: i_kind,r_kind,r_single use constants, only: one,two use gridmod, only: nlon,nlat,region_lon,region_lat,region_dx,region_dy, & - rotate_wind_ll2xy + rotate_wind_ll2xy,fv3_regional use wind_fft, only: divvort_to_psichi implicit none @@ -116,19 +117,21 @@ subroutine ens_uv_to_psichi(u,v,truewind) ! minval(region_lon),maxval(region_lon) ! print*,'in ens_uv_to_psichi: region_lat,min,max=', & ! minval(region_lat),maxval(region_lat) - do i=1,nlat - do j=1,nlon - rlon=region_lon(i,j) - rlat=region_lat(i,j) - dlon=float(j)*one - dlat=float(i)*one - ue=u(i,j) - ve=v(i,j) - call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat) - u(i,j)=ug - v(i,j)=vg + if(.not.fv3_regional)then + do i=1,nlat + do j=1,nlon + rlon=region_lon(i,j) + rlat=region_lat(i,j) + dlon=float(j)*one + dlat=float(i)*one + ue=u(i,j) + ve=v(i,j) + call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat) + u(i,j)=ug + v(i,j)=vg + enddo enddo - enddo + endif if (truewind) return !========================================================================== !==>divergence and vorticity computation diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 9cc75ea7e7..bca6713d3e 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -272,7 +272,6 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! ! CALCULATE ENSEMBLE SPREAD call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) - call mpi_barrier(mpi_comm_world,ierror) ! ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS sig_norm=sqrt(one/max(one,n_ens_fv3sar-one)) @@ -518,7 +517,7 @@ subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_ ! use kinds, only: r_single,r_kind,i_kind use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_anl,p_e2a,uv_hyb_ens, & - regional_ensemble_option + regional_ensemble_option,write_ens_sprd use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_create_info,general_sube2suba use constants, only: zero,two,half,one use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d @@ -667,7 +666,7 @@ subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_ ps => dum2 end if - call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) + if(write_ens_sprd) call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) return end subroutine ens_spread_dualres_regional_fv3_regional diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 7be7fe982a..6a6b109753 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -22,6 +22,7 @@ subroutine get_gefs_for_regional ! 2016-05-19 Carley/s.liu - prevent the GSI from printing out erroneous error ! when using ensembles from different time ! 2016-12-12 tong - add code to get nemsio meta data, if use_gfs_nemsio=True +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! @@ -34,7 +35,8 @@ subroutine get_gefs_for_regional !$$$ end documentation block use gridmod, only: idsl5,regional,use_gfs_nemsio - use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy + use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,& + fv3_regional use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_a1,grd_e1,p_e2a,uv_hyb_ens,dual_res @@ -750,37 +752,55 @@ subroutine get_gefs_for_regional jjmin=grd_mix%nlon ratio_x=(nlon-one)/(grd_mix%nlon-one) ratio_y=(nlat-one)/(grd_mix%nlat-one) - do k=1,grd_mix%nsig - ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig - kcw=koz+grd_mix%nsig - do j=1,grd_mix%lon2 - do i=1,grd_mix%lat2 + if(.not. fv3_regional)then + do k=1,grd_mix%nsig + ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig + kcw=koz+grd_mix%nsig + do j=1,grd_mix%lon2 + do i=1,grd_mix%lat2 + + ii=i+grd_mix%istart(mm1)-2 + jj=j+grd_mix%jstart(mm1)-2 + ii=min(grd_mix%nlat,max(1,ii)) + jj=min(grd_mix%nlon,max(1,jj)) + iimax=max(ii,iimax) + iimin=min(ii,iimin) + jjmax=max(jj,jjmax) + jjmin=min(jj,jjmin) + dlon_ens=float(jj) + dlat_ens=float(ii) + dlon=one+(dlon_ens-one)*ratio_x + dlat=one+(dlat_ens-one)*ratio_y + + call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), & + uob,vob,region_lon_ens(ii,jj),dlon,dlat) + st_eg(i,j,k,n)=uob + vp_eg(i,j,k,n)=vob + + t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp + rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh + oz_eg(i,j,k,n)=work_sub(1,i,j,koz) + cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) + end do + end do + end do + else + do k=1,grd_mix%nsig + ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig + kcw=koz+grd_mix%nsig + do j=1,grd_mix%lon2 + do i=1,grd_mix%lat2 + st_eg(i,j,k,n)=work_sub(1,i,j,ku) + vp_eg(i,j,k,n)=work_sub(1,i,j,kv) + t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp + rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh + oz_eg(i,j,k,n)=work_sub(1,i,j,koz) + cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) + end do + end do + end do - ii=i+grd_mix%istart(mm1)-2 - jj=j+grd_mix%jstart(mm1)-2 - ii=min(grd_mix%nlat,max(1,ii)) - jj=min(grd_mix%nlon,max(1,jj)) - iimax=max(ii,iimax) - iimin=min(ii,iimin) - jjmax=max(jj,jjmax) - jjmin=min(jj,jjmin) - dlon_ens=float(jj) - dlat_ens=float(ii) - dlon=one+(dlon_ens-one)*ratio_x - dlat=one+(dlat_ens-one)*ratio_y - - call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), & - uob,vob,region_lon_ens(ii,jj),dlon,dlat) - st_eg(i,j,k,n)=uob - vp_eg(i,j,k,n)=vob - - t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp - rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh - oz_eg(i,j,k,n)=work_sub(1,i,j,koz) - cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) - end do - end do - end do + endif kz=num_fields ; kps=kz-1 do j=1,grd_mix%lon2 do i=1,grd_mix%lat2 diff --git a/src/gsi/gfs_stratosphere.f90 b/src/gsi/gfs_stratosphere.f90 index b2278104d6..f441ba131f 100644 --- a/src/gsi/gfs_stratosphere.f90 +++ b/src/gsi/gfs_stratosphere.f90 @@ -807,6 +807,7 @@ subroutine add_gfs_stratosphere ! 2014-12-03 derber - modify call to general_read_gfsatm to reduce reading ! of unused variables ! 2016-12-10 tong - add code to gfs nemsio meta data, if use_gfs_nemsio=True +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! @@ -820,7 +821,7 @@ subroutine add_gfs_stratosphere use gridmod, only: regional,wrf_nmm_regional,use_gfs_nemsio use gridmod, only: region_lat,region_lon,aeta1_ll,aeta2_ll,pdtop_ll,pt_ll - use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy + use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,fv3_regional use gridmod, only: use_gfs_ozone,jcap_gfs,nlat_gfs,nlon_gfs use constants,only: zero,one_tenth,half,one,ten,fv,t0c,r0_05,r60,r3600 use mpimod, only: mype @@ -1506,13 +1507,20 @@ subroutine add_gfs_stratosphere if (xsplo(k) > xspli_g(1)) ysplov_g(k)=yspliv_g(1) enddo ! blend contributions from regional and global: - do k=1,nsig - ! rotate gfs wind to nmmb coordinate: - call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), & - uob,vob,region_lon(ii,jj),dlon,dlat) - ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob - vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob - enddo + if(fv3_regional)then + do k=1,nsig + ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*ysplou_g(k) + vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*ysplov_g(k) + enddo + else + do k=1,nsig + ! rotate gfs wind to nmmb coordinate: + call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), & + uob,vob,region_lon(ii,jj),dlon,dlat) + ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob + vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob + enddo + endif ! t -- regional contribution do k=1,nsig_save diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index 919e95d9a5..cacbf2a605 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -618,6 +618,7 @@ subroutine init_grid_vars(jcap,npe,cvars3d,cvars2d,cvars,mype) ! Initialize structures for grid(s) inner_vars=1 num_fields=n3d*nsig+n2d + write(6,*)'thinkdeb250 num_fiels ',n3d,nsig,n2d ,num_fields allocate(vector(num_fields)) vector=.false. @@ -651,6 +652,8 @@ subroutine init_grid_vars(jcap,npe,cvars3d,cvars2d,cvars,mype) endif endif + write(6,*)'thinkdeb250 ',inner_vars,nlat,nlon,nsig,num_fields + call flush(6) call general_sub2grid_create_info(grd_a,inner_vars,nlat,nlon,nsig,num_fields, & regional,vector) deallocate(vector) diff --git a/src/gsi/guess_grids.F90 b/src/gsi/guess_grids.F90 index 1dc42b176e..55fe129543 100644 --- a/src/gsi/guess_grids.F90 +++ b/src/gsi/guess_grids.F90 @@ -724,7 +724,7 @@ subroutine create_chemges_grids(mype,istatus) ! the following will not be needed here ! ------------------------------------------ !clt to think -!tothink wrong +!tothink call gsi_chemguess_get('dim',ntgases,istatus) if(istatus/=0) then if(mype==0) write(6,*) myname_, ': trouble getting number of chem/gases' diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index a96bd70b50..f562f90516 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3975,6 +3975,7 @@ subroutine hybens_grid_setup nord_e2a,p_e2a,.true.,eqspace=use_sp_eqspace) else if(dual_res) then +!cltthinktodo call get_region_dx_dy_ens(region_dx_ens,region_dy_ens) if(regional_ensemble_option) then fv3_spec_grid_filename="fv3_ens_grid_spec" diff --git a/src/gsi/read_abi.f90 b/src/gsi/read_abi.f90 index 465d7f22a0..a0dee8db76 100644 --- a/src/gsi/read_abi.f90 +++ b/src/gsi/read_abi.f90 @@ -225,6 +225,7 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& open(lnbufr,file=infile,form='unformatted') call openbf(lnbufr,'IN',lnbufr) if(jsatid == 'gr' .or. jsatid == 'g16') kidsat = 270 + if(jsatid == 'g17') kidsat = 271 nrec=999999 diff --git a/src/gsi/read_fl_hdob.f90 b/src/gsi/read_fl_hdob.f90 index 83c7a82c25..2e475ba74e 100644 --- a/src/gsi/read_fl_hdob.f90 +++ b/src/gsi/read_fl_hdob.f90 @@ -23,6 +23,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si ! linear qc error table and b table ! 2015-10-01 guo - calc ob location once in deg +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! infile - unit from which to read BUFR data @@ -50,7 +51,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si r60inv,r10,r100,r2000,hvap,eps,omeps,rv,grav use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional + rlats,rlons,twodvar_regional,fv3_regional use convinfo, only: nconvtype, & icuse,ictype,icsubtype,ioctype, & ithin_conv,rmesh_conv,pmesh_conv @@ -999,7 +1000,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si if (pob_mb < r50) woe = woe*r1_2 if (inflate_error) woe = woe*r1_2 if (qcm > lim_qm ) woe = woe*1.0e6_r_kind - if(regional)then + if(regional .and. .not. fv3_regional)then u0 = uob v0 = vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) diff --git a/src/gsi/read_prepbufr.f90 b/src/gsi/read_prepbufr.f90 index 79280f2f86..4ee840e48d 100644 --- a/src/gsi/read_prepbufr.f90 +++ b/src/gsi/read_prepbufr.f90 @@ -140,6 +140,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ! 2017-06-17 levine - add GLERL program code lookup ! 2017-03-21 Su - add option to thin conventional data in 4 dimension ! 2018-08-16 akella - explicit KX definition for ships (formerly ID'd by subtype 522/523) +! 2020-05-04 wu - no rotate_wind for fv3_regional ! input argument list: ! infile - unit from which to read BUFR data @@ -167,7 +168,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& r60inv,r10,r100,r2000 use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional + rlats,rlons,twodvar_regional,fv3_regional use convinfo, only: nconvtype,ctwind, & ncmiter,ncgroup,ncnumgrp,icuse,ictype,icsubtype,ioctype, & ithin_conv,rmesh_conv,pmesh_conv,pmot_conv,ptime_conv, & @@ -2150,7 +2151,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& if(sqrt(uob**2+vob**2)>60.0_r_kind)cycle LOOP_readsb end if - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) diff --git a/src/gsi/read_radar.f90 b/src/gsi/read_radar.f90 index 11521f5bf0..9b62951d29 100644 --- a/src/gsi/read_radar.f90 +++ b/src/gsi/read_radar.f90 @@ -60,6 +60,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu ! to help fix a multiple data read bug (when l2rwbufr and radarbufr were both ! listed in the OBS_INPUT table) and for added flexibility for experimental setups. ! 2018-02-15 wu - add code for fv3_regional option +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! ! input argument list: @@ -89,7 +90,8 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu use qcmod, only: erradar_inflate,vadfile,newvad use obsmod, only: iadate,ianldate,l_foreaft_thin use gsi_4dvar, only: l4dvar,l4densvar,iwinbgn,winlen,time_4dvar,thin4d - use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,nsig + use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,nsig,& + fv3_regional use gridmod, only: wrf_nmm_regional,nems_nmmb_regional,cmaq_regional,wrf_mass_regional use gridmod, only: fv3_regional use convinfo, only: nconvtype,ctwind, & @@ -680,7 +682,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= thishgt rwnd = thisvr azm_earth = corrected_azimuth - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -1088,7 +1090,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= radar_obs(4,k) rwnd = radar_obs(5,k) azm_earth = r90-radar_obs(6,k) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -1522,7 +1524,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= z(ii) rwnd = thisvr azm_earth = glob_azimuth8(ii) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -2041,7 +2043,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= z(i) rwnd = dopbin(i) azm_earth = glob_azimuth8(i) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -2401,7 +2403,8 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) use qcmod, only: erradar_inflate use oneobmod, only: oneobtest,learthrel_rw use gsi_4dvar, only: l4dvar,l4densvar,winlen,time_4dvar - use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy + use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,& + fv3_regional use convinfo, only: nconvtype,ncmiter,ncgroup,ncnumgrp,icuse,ioctype use deter_sfc_mod, only: deter_sfc2 use mpimod, only: npe @@ -2630,7 +2633,7 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) rwnd = thisvr azm_earth = corrected_azimuth - if(regional) then + if(regional .and. .not. fv3_regional) then if(oneobtest .and. learthrel_rw) then ! for non rotated winds!!! cosazm=cos(azm_earth*deg2rad) sinazm=sin(azm_earth*deg2rad) diff --git a/src/gsi/read_radar_wind_ascii.f90 b/src/gsi/read_radar_wind_ascii.f90 index 02200a9d76..2e1b06a50c 100644 --- a/src/gsi/read_radar_wind_ascii.f90 +++ b/src/gsi/read_radar_wind_ascii.f90 @@ -13,6 +13,7 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg ! 2011-08-12 carley - fix ob error to 2 m/s ! 2011-08-23 carley - use deter_sfc_mod ! 2011-12-08 carley - add wind rotation (earth to grid) +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! infile - file from which to read data @@ -116,7 +117,8 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg use constants, only: zero,half,one,two,deg2rad,rearth,rad2deg, & one_tenth,r1000,r60,r60inv,r100,r400,grav_equator, & eccentricity,somigliana,grav_ratio,grav,semi_major_axis,flattening - use gridmod, only: regional,tll2xy,rotate_wind_ll2xy,nsig,nlat,nlon + use gridmod, only: regional,tll2xy,rotate_wind_ll2xy,nsig,nlat,nlon,& + fv3_regional use obsmod, only: iadate, & mintiltvr,maxtiltvr,minobrangevr,maxobrangevr, rmesh_vr,zmesh_vr,& doradaroneob,oneoblat,oneoblon,oneobheight,oneobradid @@ -464,7 +466,7 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg ! Domain could be rectangular, so ob may be out of ! range at one end, but not the other. - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(thisazimuthr) sinazm_earth=sin(thisazimuthr) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,thislon,dlon,dlat) diff --git a/src/gsi/read_rapidscat.f90 b/src/gsi/read_rapidscat.f90 index fa909d9ca9..dc48991940 100644 --- a/src/gsi/read_rapidscat.f90 +++ b/src/gsi/read_rapidscat.f90 @@ -16,6 +16,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, ! 2015-04-03 Ling Liu ! 2015-09-17 Thomas - add l4densvar and thin4d to data selection procedure ! 2016-03-11 j. guo - Fixed {dlat,dlon}_earth_deg in the obs data stream +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! ithin - flag to thin data @@ -41,7 +42,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons + rlats,rlons,fv3_regional use qcmod, only: errormod,noiqc use convthin, only: make3grids,map3grids,del3grids,use_all use constants, only: deg2rad,zero,rad2deg,one_tenth,& @@ -620,7 +621,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, woe=obserr oelev=r10 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) diff --git a/src/gsi/read_satwnd.f90 b/src/gsi/read_satwnd.f90 index 7eb0a7bb9d..a9a109aead 100644 --- a/src/gsi/read_satwnd.f90 +++ b/src/gsi/read_satwnd.f90 @@ -69,6 +69,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! - Read WMO pre-approved new BUFR Goes-16 AMVs (Goes-R) ! 2018-06-13 Genkova - Goes-16 AMVs use ECMWF QC till new HAM late 2018 ! and OE/2 +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! ! @@ -96,7 +97,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional,wrf_nmm_regional + rlats,rlons,twodvar_regional,wrf_nmm_regional,fv3_regional use qcmod, only: errormod,njqc use convthin, only: make3grids,map3grids,map3grids_m,del3grids,use_all use convthin_time, only: make3grids_tm,map3grids_tm,map3grids_m_tm,del3grids_tm,use_all_tm @@ -1300,7 +1301,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis if (qm==3 .or. qm==7) inflate_error=.true. woe=obserr if (inflate_error) woe=woe*r1_2 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) diff --git a/src/gsi/read_sfcwnd.f90 b/src/gsi/read_sfcwnd.f90 index 06fa9f0207..cabe69b84f 100644 --- a/src/gsi/read_sfcwnd.f90 +++ b/src/gsi/read_sfcwnd.f90 @@ -21,6 +21,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! 2015-10-01 guo - consolidate use of ob location (in deg) ! 2016-03-15 Su - modified the code so that the program won't stop when ! no subtype is found in non linear qc error table and b table +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! ithin - flag to thin data @@ -46,7 +47,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons + rlats,rlons,fv3_regional use qcmod, only: errormod,noiqc,njqc use convthin, only: make3grids,map3grids,del3grids,use_all @@ -678,7 +679,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis woe=obserr oelev=r10 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) diff --git a/src/gsi/setupuwnd10m.f90 b/src/gsi/setupuwnd10m.f90 index 15a3f386ca..4552a7e81a 100644 --- a/src/gsi/setupuwnd10m.f90 +++ b/src/gsi/setupuwnd10m.f90 @@ -31,6 +31,7 @@ subroutine setupuwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d ! 2017-09-28 todling - add netcdf_diag capability; hidden as contained code ! 2018-01-08 pondeca - addd option l_closeobs to use closest obs to analysis ! time in analysis +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! lunin - unit from which to read observations @@ -74,7 +75,8 @@ subroutine setupuwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d use oneobmod, only: magoberr,maginnov,oneobtest use gridmod, only: nsig - use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll + use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll,& + fv3_regional use constants, only: zero,tiny_r_kind,one,one_tenth,half,wgtlim,rd,grav,& two,cg_term,three,four,five,ten,huge_single,r1000,r3600,& grav_ratio,flattening,grav,deg2rad,grav_equator,somigliana, & @@ -900,7 +902,7 @@ subroutine contents_binary_diag_(odiag) rdiagbuf(21,ii) = dvdiff ! vob-ges (ms**-1) rdiagbuf(22,ii) = data(ivob,i)-vgesin! vob-ges w/o bias correction (ms**-1) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information @@ -995,7 +997,7 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("v_Obs_Minus_Forecast_adjusted", dvdiff ) call nc_diag_metadata("v_Obs_Minus_Forecast_unadjusted", data(ivob,i)-vgesin) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information diff --git a/src/gsi/setupvwnd10m.f90 b/src/gsi/setupvwnd10m.f90 index 7ebcb1c042..0c601e716b 100644 --- a/src/gsi/setupvwnd10m.f90 +++ b/src/gsi/setupvwnd10m.f90 @@ -31,6 +31,7 @@ subroutine setupvwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d ! 2017-09-28 todling - add netcdf_diag capability; hidden as contained code ! 2018-01-08 pondeca - addd option l_closeobs to use closest obs to analysis ! time in analysis +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! lunin - unit from which to read observations @@ -74,7 +75,8 @@ subroutine setupvwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d use oneobmod, only: magoberr,maginnov,oneobtest use gridmod, only: nsig - use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll + use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll,& + fv3_regional use constants, only: zero,tiny_r_kind,one,one_tenth,half,wgtlim,rd,grav,& two,cg_term,three,four,five,ten,huge_single,r1000,r3600,& grav_ratio,flattening,grav,deg2rad,grav_equator,somigliana, & @@ -900,7 +902,7 @@ subroutine contents_binary_diag_(odiag) rdiagbuf(21,ii) = dudiff ! uob-ges (ms**-1) rdiagbuf(22,ii) = data(iuob,i)-ugesin! uob-ges w/o bias correction (ms**-1) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information @@ -995,7 +997,7 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("v_Obs_Minus_Forecast_adjusted", dudiff ) call nc_diag_metadata("v_Obs_Minus_Forecast_unadjusted", data(iuob,i)-ugesin) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information diff --git a/src/gsi/setupw.f90 b/src/gsi/setupw.f90 index 4afd3f79dd..11741f2e6a 100644 --- a/src/gsi/setupw.f90 +++ b/src/gsi/setupw.f90 @@ -48,7 +48,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav use qcmod, only: npres_print,ptop,pbot,dfact,dfact1,qc_satwnds,njqc,vqc use oneobmod, only: oneobtest,oneob_type,magoberr,maginnov use gridmod, only: get_ijk,nsig,twodvar_regional,regional,wrf_nmm_regional,& - rotate_wind_xy2ll,pt_ll + rotate_wind_xy2ll,pt_ll,fv3_regional use guess_grids, only: nfldsig,hrdifsig,geop_hgtl,sfcmod_gfs use guess_grids, only: tropprs,sfcmod_mm5 use guess_grids, only: ges_lnprsl,comp_fact10,pbl_height @@ -203,6 +203,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav ! error (DOE) calculation to the namelist ! level; they are now loaded by ! aircraftinfo. +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! REMARKS: ! language: f90 @@ -1623,10 +1624,9 @@ subroutine contents_binary_diag_(udiag,vdiag) rdiagbuf(21,ii) = dvdiff ! v obs-ges used in analysis (m/s) rdiagbuf(22,ii) = vob-vgesin ! v obs-ges w/o bias correction (m/s) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information - uob_reg=data(iuob,i) vob_reg=data(ivob,i) dlon_e=data(ilone,i)*deg2rad @@ -1733,7 +1733,7 @@ subroutine contents_netcdf_diag_(udiag,vdiag) call nc_diag_metadata("Wind_Reduction_Factor_at_10m", sngl(factw) ) - if (.not. regional) then + if (.not. regional .or. fv3_regional) then call nc_diag_metadata("u_Observation", sngl(data(iuob,i)) ) call nc_diag_metadata("u_Obs_Minus_Forecast_adjusted", sngl(dudiff) ) call nc_diag_metadata("u_Obs_Minus_Forecast_unadjusted", sngl(uob-ugesin) ) From c2f611bc652b32c5c1b736cc7279af8bb6d14624 Mon Sep 17 00:00:00 2001 From: "Ting.Lei@noaa.gov" Date: Mon, 18 May 2020 21:10:27 +0000 Subject: [PATCH 045/155] add Xiaoyan 's coding of Hongli's example to reject obs near LBC --- src/gsi/gridmod.F90 | 17 +++++++++++++++++ src/gsi/gsimod.F90 | 3 ++- src/gsi/mod_fv3_lola.f90 | 12 ++++++++++++ src/gsi/mod_fv3_lolgrid.f90 | 11 +++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index cacbf2a605..92341050b1 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -144,6 +144,7 @@ module gridmod public :: diagnostic_reg,nmmb_reference_grid,filled_grid public :: grid_ratio_nmmb,isd_g,isc_g,dx_gfs,lpl_gfs,nsig5,nmmb_verttype public :: grid_ratio_fv3_regional,fv3_regional + public :: grid_ratio_fv3_regional,fv3_regional public :: nsig3,nsig4,grid_ratio_wrfmass public :: use_gfs_ozone,check_gfs_ozone_date,regional_ozone,nvege_type public :: jcap,jcap_b,hires_b,sp_a,grd_a @@ -202,6 +203,8 @@ module gridmod ! old def: p = eta1*pdtop+eta2*(psfc-pdtop-ptop)+ptop ! 'NEW' for new vertical coordinate definition ! new def: p = eta1*pdtop+eta2*(psfc-ptop)+ptop + logical fv3_regional_dd_reduce ! used to reject obs near the lateral bounddary + integer(i_kind) nlon_fv3_regional_reduce,nlat_fv3_regional_reduce integer(i_kind) vlevs ! no. of levels distributed on all processors integer(i_kind) nsig1o ! max no. of levels distributed on each processor @@ -1095,6 +1098,20 @@ subroutine init_reg_glob_ll(mype,lendian_in) rlat_max_dd=rlat_max_ll-r1_5/grid_ratio_fv3_regional rlon_min_dd=rlon_min_ll+r1_5/grid_ratio_fv3_regional rlon_max_dd=rlon_max_ll-r1_5/grid_ratio_fv3_regional +!clt follow Hongli Wang's codes + !print*,'original rlat_min_dd,rlat_max_dd,rlon_min_dd,rlon_max_dd=',& + ! rlat_min_dd,rlat_max_dd,rlon_min_dd,rlon_max_dd + + if(fv3_regional_dd_reduce) then + rlat_min_dd=rlat_min_dd+nlat_fv3_regional_reduce + rlat_max_dd=rlat_max_dd-nlat_fv3_regional_reduce + rlon_min_dd=rlon_min_dd+nlon_fv3_regional_reduce + rlon_max_dd=rlon_max_ll-nlon_fv3_regional_reduce + !print*,'nlat_fv3_regional_reduce,nlon_fv3_regional_reduce=',nlat_fv3_regional_reduce,nlon_fv3_regional_reduce + !print*,'reduced rlat_min_dd,rlat_max_dd,rlon_min_dd,rlon_max_dd=',& + ! rlat_min_dd,rlat_max_dd,rlon_min_dd,rlon_max_dd + + endif endif ! fv3_regional if(wrf_nmm_regional) then ! begin wrf_nmm section diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 0ace9ce246..9c094db2c7 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -121,6 +121,7 @@ module gsimod use_gfs_nemsio,sfcnst_comb,use_readin_anl_sfcmask,use_sp_eqspace,final_grid_vars,& jcap_gfs,nlat_gfs,nlon_gfs,jcap_cut,wrf_mass_hybridcord,& use_fv3_aero + use gridmod,only: fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce use guess_grids, only: ifact10,sfcmod_gfs,sfcmod_mm5,use_compress,nsig_ext,gpstop use gsi_io, only: init_io,lendian_in,verbose,print_obs_para use regional_io_mod, only: regional_io_class @@ -704,7 +705,7 @@ module gsimod diagnostic_reg,update_regsfc,netcdf,regional,wrf_nmm_regional,nems_nmmb_regional,fv3_regional,& wrf_mass_regional,twodvar_regional,filled_grid,half_grid,nvege_type,nlayers,cmaq_regional,& nmmb_reference_grid,grid_ratio_nmmb,grid_ratio_fv3_regional,grid_ratio_wrfmass,jcap_gfs,jcap_cut,& - wrf_mass_hybridcord + wrf_mass_hybridcord,fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce ! BKGERR (background error related variables): ! vs - scale factor for vertical correlation lengths for background error diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 index 347274a4c8..497f91c192 100644 --- a/src/gsi/mod_fv3_lola.f90 +++ b/src/gsi/mod_fv3_lola.f90 @@ -113,6 +113,7 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) use gridmod, only:grid_ratio_fv3_regional, region_lat,region_lon,nlat,nlon use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx use gridmod, only:init_general_transform,region_dy,region_dx + use gridmod, only: fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce use mpimod, only: mype implicit none @@ -564,6 +565,17 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) sangv(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval enddo enddo +!clt following Hongli Wang's treatment + if(fv3_regional_dd_reduce) then + !write(*,*)'testing Hongli code' + if(nlon_fv3_regional_reduce.le.0.and.nlat_fv3_regional_reduce.le.0) then + nlon_fv3_regional_reduce=nint((maxval(gcrlon)-maxval(gcrlon(:,ny/2)))/adlon) + j=nlon_fv3_regional_reduce + nlat_fv3_regional_reduce=nint((gcrlat(j,ny)-minval(gcrlat))/adlat) + if(nlon_fv3_regional_reduce.lt.0) nlon_fv3_regional_reduce=0 + if(nlat_fv3_regional_reduce.lt.0) nlat_fv3_regional_reduce=0 + endif + endif deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) end subroutine generate_anl_grid diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index fc14628c6f..40bd5ffea7 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -632,6 +632,17 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ sangv(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval enddo enddo +!clt following Hongli Wang's treatment + if(fv3_regional_dd_reduce) then + !write(*,*)'testing Hongli code' + if(nlon_fv3_regional_reduce.le.0.and.nlat_fv3_regional_reduce.le.0) then + nlon_fv3_regional_reduce=nint((maxval(gcrlon)-maxval(gcrlon(:,ny/2)))/adlon) + j=nlon_fv3_regional_reduce + nlat_fv3_regional_reduce=nint((gcrlat(j,ny)-minval(gcrlat))/adlat) + if(nlon_fv3_regional_reduce.lt.0) nlon_fv3_regional_reduce=0 + if(nlat_fv3_regional_reduce.lt.0) nlat_fv3_regional_reduce=0 + endif + endif deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) deallocate(rlat_in,rlon_in) end subroutine generate_regular_grids From cb6b27fd4c328248ea5b84fd5c20178cdc7cff2b Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Wed, 27 May 2020 14:38:57 +0000 Subject: [PATCH 046/155] fix a couple of compilation errors --- src/gsi/gridmod.F90 | 2 +- src/gsi/mod_fv3_lolgrid.f90 | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index 92341050b1..efd6e35648 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -144,7 +144,7 @@ module gridmod public :: diagnostic_reg,nmmb_reference_grid,filled_grid public :: grid_ratio_nmmb,isd_g,isc_g,dx_gfs,lpl_gfs,nsig5,nmmb_verttype public :: grid_ratio_fv3_regional,fv3_regional - public :: grid_ratio_fv3_regional,fv3_regional + public :: fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce public :: nsig3,nsig4,grid_ratio_wrfmass public :: use_gfs_ozone,check_gfs_ozone_date,regional_ozone,nvege_type public :: jcap,jcap_b,hires_b,sp_a,grd_a diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 40bd5ffea7..4fd5218da2 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -128,6 +128,8 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ use gridmod, only:grid_ratio_fv3_regional use mpimod, only: mype use gridmod, only:init_general_transform + use gridmod, only: fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce + implicit none type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid real(r_kind),allocatable,intent(out):: region_lat_out(:,:),region_lon_out(:,:) From 0ffb38bf3620d902fab294a24ade9ab8ca6eab2a Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Sat, 13 Jun 2020 22:04:04 +0000 Subject: [PATCH 047/155] Update modulefile.ProdGSI.jet to restore building on Jet. --- modulefiles/modulefile.ProdGSI.jet | 53 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/modulefiles/modulefile.ProdGSI.jet b/modulefiles/modulefile.ProdGSI.jet index f49a8e9004..d278d77e33 100644 --- a/modulefiles/modulefile.ProdGSI.jet +++ b/modulefiles/modulefile.ProdGSI.jet @@ -11,34 +11,35 @@ #module-whatis " GDAS_ENKF whatis description" # # -. /apps/lmod/lmod/init/sh +set COMP ifort +set COMP_MP mpfort +set COMP_MPI mpiifort -module load intel/15.0.3.187 -module load impi -# -module load szip -module load hdf5 -module load netcdf4/4.2.1.1 +set C_COMP icc +set C_COMP_MP mpcc + +# Known conflicts -export COREPATH=/mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib -export NCEPLIBS=$COREPATH -module use $NCEPLIBS/modulefiles +module load intel/18.0.5.274 +module load impi/2018.4.274 +module load cmake/3.16.1 -export FFLAGS="-openmp" -export LDFLAGS="-openmp" -module load bacio-intel-sandybridge/2.0.2 -module load crtm-intel-sandybridge/2.2.5 -module load bufr-intel-sandybridge/11.1.0 -module load nemsio-intel-sandybridge/2.2.2 -module load sp-intel-sandybridge/2.0.2 -module load w3emc-intel-sandybridge/2.2.0 -module load w3nco-intel-sandybridge/2.0.6 -module load sigio-intel-sandybridge/2.0.1 -module load sfcio-intel-sandybridge/1.0.0 +module use -a /mnt/lfs4/HFIP/hfv3gfs/nwprod/NCEPLIBS/modulefiles -module use /home/George.Vandenberghe/t1/l1025/lib/modulefiles -#module load hdf5 -#module load netcdf +module load bacio/2.0.3 +module load bufr/11.3.0 +module load crtm/2.3.0 +module load ip/3.0.2 +module load nemsio/2.2.4 +module load prod_util/v1.0.18 +module load sfcio/1.1.1 +module load sigio/v2.1.0 +module load sp/2.0.3 +module load w3emc/2.4.0 +module load w3nco/2.0.7 +module load hdf5_parallel/1.10.6 +module load netcdf_parallel/4.7.4 -export NETCDF=${NETCDF4} -export NETCDF_DIR=${NETCDF4} +# Set environmental variables to allow correlated error to reproduce on Hera +export MKL_NUM_THREADS=4 +export MKL_CBWR=AUTO From ff09ec798f5dc81c84b906410a3b6c67eb7c7e44 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Mon, 15 Jun 2020 02:40:16 +0000 Subject: [PATCH 048/155] Switch to use George V.'s NCEPLIBS so that GSI can successfully run on Jet. --- modulefiles/modulefile.ProdGSI.jet | 50 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/modulefiles/modulefile.ProdGSI.jet b/modulefiles/modulefile.ProdGSI.jet index d278d77e33..a4d0d29fc6 100644 --- a/modulefiles/modulefile.ProdGSI.jet +++ b/modulefiles/modulefile.ProdGSI.jet @@ -11,35 +11,31 @@ #module-whatis " GDAS_ENKF whatis description" # # -set COMP ifort -set COMP_MP mpfort -set COMP_MPI mpiifort -set C_COMP icc -set C_COMP_MP mpcc +module use -a /contrib/sutils/modulefiles +module load sutils -# Known conflicts - -module load intel/18.0.5.274 +module load intel/18.0.5.274 module load impi/2018.4.274 -module load cmake/3.16.1 - -module use -a /mnt/lfs4/HFIP/hfv3gfs/nwprod/NCEPLIBS/modulefiles +module load hdf5/1.10.4 +module load netcdf/4.6.1 + +export COREPATH=/mnt/lfs4/HFIP/hfv3gfs/gwv/l0530/lib +export NCEPLIBS=$COREPATH +module use $NCEPLIBS/modulefiles -module load bacio/2.0.3 -module load bufr/11.3.0 -module load crtm/2.3.0 -module load ip/3.0.2 -module load nemsio/2.2.4 -module load prod_util/v1.0.18 -module load sfcio/1.1.1 -module load sigio/v2.1.0 -module load sp/2.0.3 -module load w3emc/2.4.0 -module load w3nco/2.0.7 -module load hdf5_parallel/1.10.6 -module load netcdf_parallel/4.7.4 +export FFLAGS="-qopenmp" +export LDFLAGS="-qopenmp" +module load bacio-intel-sandybridge/2.0.2 +module load crtm-intel-sandybridge/2.2.5 +module load bufr-intel-sandybridge/11.1.0 +module load nemsio-intel-sandybridge/2.2.2 +module load sp-intel-sandybridge/2.0.2 +module load ip-intel-sandybridge/3.0.0 +module load w3emc-intel-sandybridge/2.2.0 +module load w3nco-intel-sandybridge/2.0.6 +module load sigio-intel-sandybridge/2.0.1 +module load sfcio-intel-sandybridge/1.0.0 -# Set environmental variables to allow correlated error to reproduce on Hera -export MKL_NUM_THREADS=4 -export MKL_CBWR=AUTO +export NETCDF=${NETCDF} +export NETCDF_DIR=${NETCDF} From a72fa93d44bcf014440529bc080c08b2722fa5b4 Mon Sep 17 00:00:00 2001 From: "Ting.Lei" Date: Tue, 27 Oct 2020 16:58:51 +0000 Subject: [PATCH 049/155] adding a fix for dual resolution runs --- src/gsi/get_gefs_for_regional.f90 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 6a6b109753..fde622c27a 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -173,6 +173,7 @@ subroutine get_gefs_for_regional real(r_kind), pointer :: ges_tv(:,:,:)=>NULL() real(r_kind), pointer :: ges_q (:,:,:)=>NULL() logical :: print_verbose + real(r_kind), allocatable :: ges_z_ens(:,:) print_verbose=.false. if(verbose)print_verbose=.true. @@ -492,6 +493,23 @@ subroutine get_gefs_for_regional st_eg=zero ; vp_eg=zero ; t_eg=zero ; rh_eg=zero ; oz_eg=zero ; cw_eg=zero p_eg_nmmb=zero +! prepare terrain height +! + allocate(ges_z_ens(grd_mix%lat2,grd_mix%lon2)) + if (dual_res) then + allocate ( tmp_ens(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,1) ) + allocate ( tmp_anl(lat2,lon2,nsig,1) ) + tmp_anl=0.0_r_kind + tmp_anl(:,:,1,1)=ges_z(:,:) + call general_suba2sube(grd_a1,grd_e1,p_e2a,tmp_anl,tmp_ens,regional) + ges_z_ens(:,:)=tmp_ens(:,:,1,1) + deallocate(tmp_ens) + deallocate(tmp_anl) + else + ges_z_ens(:,:)=ges_z(:,:) + endif + + ! begin loop over ensemble members rewind(10) @@ -672,7 +690,7 @@ subroutine get_gefs_for_regional ilook=-1 ; jlook=-1 allocate(prsl1000(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig)) prsl1000=1000._r_kind*prsl - call compute_nmm_surfacep ( ges_z(:,:), zbarl,prsl1000, & + call compute_nmm_surfacep ( ges_z_ens(:,:), zbarl,prsl1000, & psfc_out,grd_mix%nsig,grd_mix%lat2,grd_mix%lon2, & ilook,jlook) deallocate(tt,zbarl,prsl1000) @@ -828,6 +846,7 @@ subroutine get_gefs_for_regional ! if(mype==0) write(6,*)' with halo, n,min,max ges_ps - matt ps =',n,pdiffmin0,pdiffmax0 end do ! end loop over ensemble members. + deallocate(ges_z_ens) ! next, compute mean of ensembles. From ac3bb7d8a0dc8f351e5212d2abb2fd0552a35a35 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Tue, 17 Nov 2020 02:01:04 +0000 Subject: [PATCH 050/155] update with EMC gsi master --- src/enkf/gridio_fv3reg.f90 | 250 +++++---------------- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 153 ------------- src/gsi/gsi_rfv3io_mod.f90 | 1 - 3 files changed, 58 insertions(+), 346 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 6ce1b4a00a..5f5ad91793 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -42,14 +42,15 @@ module gridio !------------------------------------------------------------------------- ! Define all public subroutines within this module private - public :: readgriddata - public :: writegriddata + public :: readgriddata,readgriddata_pnc + public :: writegriddata,writegriddata_pnc + public :: writeincrement, writeincrement_pnc !------------------------------------------------------------------------- contains ! Generic WRF read routine, calls ARW-WRF or NMM-WRF - subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,reducedgrid,vargrid,qsat) + subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,filesfcprefixes,reducedgrid,vargrid,qsat) use constants, only:zero,one,half,fv, max_varname_length use gridinfo,only: eta1_ll use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr @@ -61,6 +62,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d integer, dimension(0:n3d), intent(in) :: levels character(len=120), dimension(7), intent(in) :: fileprefixes + character(len=120), dimension(7), intent(in) :: filesfcprefixes logical, intent(in) :: reducedgrid real(r_single), dimension(npts,ndim,ntimes,nanal2-nanal1+1), intent(out) :: vargrid @@ -82,6 +84,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f ! Define variables required for netcdf variable I/O character(len=12) :: varstrname + character(len=1) char_tile character(len=24),parameter :: myname_ = 'fv3: getgriddata' @@ -94,11 +97,8 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f logical :: ice !====================================================================== -<<<<<<< HEAD -======= write (6,*)"The input fileprefix, reducedgrid are not used in the current implementation", & fileprefixes, reducedgrid ->>>>>>> master nlevsp1=nlevs+1 u_ind = getindex(vars3d, 'u') !< indices in the state var arrays v_ind = getindex(vars3d, 'v') ! U and V (3D) @@ -138,36 +138,22 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f nn_tile0=(ntile-1)*nx_res*ny_res write(char_tile, '(i1)') ntile -<<<<<<< HEAD -!cltorg filename = trim(adjustl(datapath))//trim(adjustl(fileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) -======= ->>>>>>> master filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) fv3filename=trim(adjustl(filename))//"_dynvartracer" !---------------------------------------------------------------------- ! read u-component call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& -<<<<<<< HEAD - myname_,'open: '//trim(adjustl(fv3filename)) ) -======= myname_,'open: '//trim(adjustl(fv3filename)) ) ->>>>>>> master !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) if (u_ind > 0) then allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) -<<<<<<< HEAD - varstrname = 'u' - - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) -======= varstrname = 'u' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) ->>>>>>> master do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -177,99 +163,37 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f enddo enddo enddo -<<<<<<< HEAD - do k = levels(u_ind-1)+1, levels(u_ind) - if (nproc .eq. 0) & - write(6,*) 'READFVregional : u ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo -======= do k = levels(u_ind-1)+1, levels(u_ind) if (nproc .eq. 0) & write(6,*) 'READFVregional : u ', & & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) enddo ->>>>>>> master deallocate(uworkvar3d) endif if (v_ind > 0) then allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) varstrname = 'v' -<<<<<<< HEAD - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res -======= call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res ->>>>>>> master do i=1,nx_res nn=nn+1 vargrid(nn,levels(v_ind-1)+k,nb,ne)=vworkvar3d(i,j,k) enddo enddo -<<<<<<< HEAD - enddo - do k = levels(v_ind-1)+1, levels(v_ind) - if (nproc .eq. 0) & - write(6,*) 'READFVregional : v ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo -======= enddo do k = levels(v_ind-1)+1, levels(v_ind) if (nproc .eq. 0) & write(6,*) 'READFVregional : v ', & & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) enddo ->>>>>>> master deallocate(vworkvar3d) endif if (tv_ind > 0.or.tsen_ind) then -<<<<<<< HEAD - allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) - varstrname = 'T' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) - - - if (q_ind > 0) then - varstrname = 'sphum' - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(q_ind-1)+k,nb,ne)=qworkvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(q_ind-1)+1, levels(q_ind) - if (nproc .eq. 0) & - write(6,*) 'READFVregional : q ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo - - endif - if(tv_ind > 0) then - do k=1,nlevs - do j=1,ny_res - do i=1,nx_res - workvar3d(i,j,k)=tsenworkvar3d(i,j,k)*(one+fv*qworkvar3d(i,j,k)) - enddo - enddo - enddo - tvworkvar3d=workvar3d - else! tsen_id >0 - workvar3d=tsenworkvar3d -======= allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) varstrname = 'T' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) @@ -306,30 +230,15 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f tvworkvar3d=workvar3d else! tsen_id >0 workvar3d=tsenworkvar3d ->>>>>>> master endif tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 do k=1,nlevs nn = nn_tile0 -<<<<<<< HEAD - do j=1,ny_res -======= do j=1,ny_res ->>>>>>> master do i=1,nx_res nn=nn+1 vargrid(nn,levels(tmp_ind-1)+k,nb,ne)=workvar3d(i,j,k) enddo -<<<<<<< HEAD - enddo - enddo - do k = levels(tmp_ind-1)+1, levels(tmp_ind) - if (nproc .eq. 0) then - write(6,*) 'READFVregional : t ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - endif - enddo -======= enddo enddo do k = levels(tmp_ind-1)+1, levels(tmp_ind) @@ -338,41 +247,25 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) endif enddo ->>>>>>> master endif if(allocated(tsenworkvar3d)) deallocate(tsenworkvar3d) -<<<<<<< HEAD - if (oz_ind > 0) then - varstrname = 'o3mr' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res -======= if (oz_ind > 0) then varstrname = 'o3mr' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res ->>>>>>> master do i=1,nx_res nn=nn+1 vargrid(nn,levels(oz_ind-1)+k,nb,ne)=workvar3d(i,j,k) enddo -<<<<<<< HEAD - enddo - enddo - do k = levels(oz_ind-1)+1, levels(oz_ind) -======= enddo enddo do k = levels(oz_ind-1)+1, levels(oz_ind) ->>>>>>> master if (nproc .eq. 0) & write(6,*) 'READFVregional : oz ', & & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) @@ -380,13 +273,8 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f endif -<<<<<<< HEAD - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(fv3filename) ) -======= call nc_check( nf90_close(file_id),& myname_,'close '//trim(fv3filename) ) ->>>>>>> master ! set SST to zero for now if (sst_ind > 0) then vargrid(:,levels(n3d)+sst_ind,nb,ne) = zero @@ -397,15 +285,6 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f ! Allocate memory for variables computed within routine if (ps_ind > 0) then -<<<<<<< HEAD - allocate(workprsi(nx_res,ny_res,nlevsp1)) - allocate(pswork(nx_res,ny_res)) - fv3filename=trim(adjustl(filename))//"_dynvartracer" - call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(fv3filename)) ) - call read_fv3_restart_data3d('delp',fv3filename,file_id,workvar3d) !cltto think different files be used - !print *,'min/max delp',ntile,minval(delp),maxval(delp) -======= allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) fv3filename=trim(adjustl(filename))//"_dynvartracer" @@ -413,27 +292,18 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f myname_,'open: '//trim(adjustl(fv3filename)) ) call read_fv3_restart_data3d('delp',fv3filename,file_id,workvar3d) !print *,'min/max delp',ntile,minval(delp),maxval(delp) ->>>>>>> master call nc_check( nf90_close(file_id),& myname_,'close '//trim(fv3filename) ) workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed do i=nlevs,1,-1 workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) -<<<<<<< HEAD - enddo -======= enddo ->>>>>>> master pswork(:,:)=workprsi(:,:,1) -<<<<<<< HEAD - nn = nn_tile0 -======= nn = nn_tile0 ->>>>>>> master do j=1,ny_res do i=1,nx_res nn=nn+1 @@ -452,15 +322,6 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f enddo enddo enddo -<<<<<<< HEAD - ice=.true. !tothink - if (pseudo_rh) then - call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & - nx_res*ny_res,nlevs) - else - qsatworkvar3d(:,:,:) = 1._r_double - endif -======= ice=.true. !tothink if (pseudo_rh) then call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & @@ -468,7 +329,6 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f else qsatworkvar3d(:,:,:) = 1._r_double endif ->>>>>>> master do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -483,22 +343,12 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f -<<<<<<< HEAD - if(allocated(workprsi)) deallocate(workprsi) - if(allocated(pswork)) deallocate(pswork) - if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) - if(allocated(qworkvar3d)) deallocate(qworkvar3d) - if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) - - endif -======= if(allocated(workprsi)) deallocate(workprsi) if(allocated(pswork)) deallocate(pswork) if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) if(allocated(qworkvar3d)) deallocate(qworkvar3d) if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) endif ->>>>>>> master !====================================================================== ! Deallocate memory if(allocated(workvar3d)) deallocate(workvar3d) @@ -509,11 +359,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f return -<<<<<<< HEAD - end subroutine readgriddata -======= end subroutine readgriddata ->>>>>>> master !======================================================================== ! readgriddata_nmm.f90: read WRF-NMM state or control vector @@ -524,15 +370,9 @@ end subroutine readgriddata ! writegriddata.f90: write WRF-ARW or WRF-NMM analysis !------------------------------------------------------------------------- -<<<<<<< HEAD - subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) - use constants, only: zero, one,fv,half - use gridinfo,only: ak,bk,eta1_ll,eta2_ll,ptop -======= subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) use constants, only: zero, one,fv,half use gridinfo,only: eta1_ll,eta2_ll ->>>>>>> master use params, only: nbackgrounds, anlfileprefixes, fgfileprefixes use params, only: nx_res,ny_res,nlevs,ntiles,l_pres_add_saved use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr @@ -561,17 +401,10 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid integer(i_kind) :: u_ind, v_ind, tv_ind, tsen_ind,q_ind, ps_ind,oz_ind integer(i_kind) :: w_ind, cw_ind, ph_ind -<<<<<<< HEAD - integer(i_kind) file_id,var_id,dim_id - real(r_single), dimension(:,:), allocatable ::pswork - real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,workinc3d2,uworkvar3d,& - vworkvar3d,qvarworkvar3d,tvworkvar3d,tsenworkvar3d,& -======= integer(i_kind) file_id real(r_single), dimension(:,:), allocatable ::pswork real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,workinc3d2,uworkvar3d,& vworkvar3d,tvworkvar3d,tsenworkvar3d,& ->>>>>>> master workprsi,qworkvar3d !---------------------------------------------------------------------- @@ -606,11 +439,6 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid ps_ind = getindex(vars2d, 'ps') ! Ps (2D) -<<<<<<< HEAD - ! Initialize constants required by routine -!cltorg call init_constants(.true.) -======= ->>>>>>> master !---------------------------------------------------------------------- if (nbackgrounds > 1) then @@ -633,24 +461,14 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid ! First guess file should be copied to analysis file at scripting ! level; only variables updated by EnKF are changed write(charnanal,'(a3, i3.3)') 'mem', nanal -<<<<<<< HEAD -!cltorg filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal -======= ->>>>>>> master !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) do ntile=1,ntiles nn_tile0=(ntile-1)*nx_res*ny_res write(char_tile, '(i1)') ntile -<<<<<<< HEAD -!cltorg filename = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"_tile"//char_tile//trim(charnanal) - filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) - fv3filename=trim(adjustl(filename))//"_dynvartracer" -======= filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) fv3filename=trim(adjustl(filename))//"_dynvartracer" ->>>>>>> master !---------------------------------------------------------------------- @@ -797,11 +615,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) varstrname = 'delp' -<<<<<<< HEAD - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) !cltto -======= call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) ->>>>>>> master !print *,'min/max delp',ntile,minval(delp),maxval(delp) workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed do i=nlevs,1,-1 @@ -868,6 +682,58 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid !====================================================================== end subroutine writegriddata + subroutine writeincrement(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + integer, intent(in) :: nanal1,nanal2 + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writeincrement + + subroutine writeincrement_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writeincrement_pnc + + subroutine readgriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, & + fileprefixes,filesfcprefixes,reducedgrid,grdin,qsat) + use constants, only: max_varname_length + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d, n3d + integer, dimension(0:n3d), intent(in) :: levels + integer, intent(in) :: ndim, ntimes + character(len=120), dimension(7), intent(in) :: fileprefixes + character(len=120), dimension(7), intent(in) :: filesfcprefixes + logical, intent(in) :: reducedgrid + real(r_single), dimension(npts,ndim,ntimes,1), intent(out) :: grdin + real(r_double), dimension(npts,nlevs,ntimes,1), intent(out) :: qsat + end subroutine readgriddata_pnc + + subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writegriddata_pnc end module gridio diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index d1653bb89d..c7edc2437d 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -67,11 +67,6 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) integer(i_kind):: ic2,ic3 integer(i_kind):: m -<<<<<<< HEAD - character(255) filelists(ntlevs_ens) -======= - ->>>>>>> master character(255) ensfilenam_str type(type_fv3regfilenameg)::fv3_filename @@ -79,19 +74,11 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! Allocate bundle to hold mean of ensemble members allocate(en_bar(ntlevs_ens)) do m=1,ntlevs_ens -<<<<<<< HEAD - call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' - call stop2(9991) - endif -======= call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) if(istatus/=0) then write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' call stop2(9991) endif ->>>>>>> master enddo ! for m @@ -125,11 +112,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! ! READ ENEMBLE MEMBERS DATA if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) -<<<<<<< HEAD - call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) -======= call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz) ->>>>>>> master ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR do ic3=1,nc3d @@ -305,33 +288,6 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) end subroutine get_fv3_regional_ensperts_run -<<<<<<< HEAD - subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) -!clt modified from rad_fv3_netcdf_guess - !$$$ subprogram documentation block - ! . . . . - ! subprogram: general_read_fv3_regional read arw model ensemble members - ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 - ! - ! abstract: read ensemble members from the arw model in "wrfout" netcdf format - ! for use with hybrid ensemble option. - ! - ! program history log: - ! 2010-08-11 parrish, initial documentation - ! 2010-09-10 parrish, modify so ensemble variables are read in the same way as in - ! subroutines convert_netcdf_mass and read_fv3_regional_binary_guess. - ! There were substantial differences due to different opinion about what - ! to use for surface pressure. This issue should be resolved by coordinating - ! with Ming Hu (ming.hu@noaa.gov). At the moment, these changes result in - ! agreement to single precision between this input method and the guess input - ! procedure when the same file is read by both methods. - ! 2012-03-12 whitaker: read data on root, distribute with scatterv. - ! remove call to general_reload. - ! simplify, fix memory leaks, reduce memory footprint. - ! use genqsat, remove genqsat2_regional. - ! replace bare 'stop' statements with call stop2(999). - ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS core -======= subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz) !$$$ subprogram documentation block ! first compied from general_read_arw_regional . . . . @@ -343,7 +299,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g ! ! program history log: ! 2018- Ting - intial versions ->>>>>>> master ! ! input argument list: ! @@ -360,22 +315,12 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g use netcdf, only: nf90_inq_dimid,nf90_inquire_dimension use netcdf, only: nf90_inq_varid,nf90_inquire_variable,nf90_get_var use kinds, only: r_kind,r_single,i_kind -<<<<<<< HEAD - use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll - use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 - use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens - use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt - - use mpimod, only: mpi_comm_world,ierror,mpi_rtype - use mpimod, only: npe -======= use gridmod, only: eta1_ll,eta2_ll use constants, only: zero,one,fv,zero_single,one_tenth,h300 use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt use mpimod, only: mpi_comm_world,mpi_rtype ->>>>>>> master use netcdf_mod, only: nc_check use gsi_rfv3io_mod,only: type_fv3regfilenameg use gsi_rfv3io_mod,only:n2d @@ -403,33 +348,11 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g real(r_kind),parameter:: r100 = 100.0_r_kind ! ! Declare local variables -<<<<<<< HEAD - real(r_single),allocatable,dimension(:):: temp_1d - real(r_single),allocatable,dimension(:,:):: temp_2d,temp_2d2 - real(r_single),allocatable,dimension(:,:,:):: temp_3d - real(r_kind),allocatable,dimension(:):: p_top - real(r_kind),allocatable,dimension(:,:):: q_integral,gg_ps,q_integralc4h - real(r_kind),allocatable,dimension(:,:,:):: tsn,qst,prsl,& - gg_u,gg_v,gg_tv,gg_rh - real(r_kind),allocatable,dimension(:):: wrk_fill_2d - integer(i_kind),allocatable,dimension(:):: dim,dim_id - - integer(i_kind):: nx,ny,nz,i,j,k,d_max,file_id,var_id,ndim,mype,kp - integer(i_kind):: Time_id,s_n_id,w_e_id,b_t_id,s_n_stag_id,w_e_stag_id,b_t_stag_id - integer(i_kind):: Time_len,s_n_len,w_e_len,b_t_len,s_n_stag_len,w_e_stag_len,b_t_stag_len - integer(i_kind) iderivative - - real(r_kind):: deltasigma - real(r_kind) psfc_this_dry,psfc_this - real(r_kind) work_prslk,work_prsl - -======= integer(i_kind):: i,j,k,kp integer(i_kind) iderivative ->>>>>>> master logical ice character(len=24),parameter :: myname_ = 'general_read_fv3_regional' @@ -441,14 +364,11 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g character(len=:),allocatable :: sfcdata !='fv3_sfcdata' character(len=:),allocatable :: couplerres!='coupler.res' -<<<<<<< HEAD -======= associate( this => this ) ! eliminates warning for unused dummy argument needed for binding end associate ->>>>>>> master grid_spec=fv3_filenameginput%grid_spec ak_bk=fv3_filenameginput%ak_bk dynvars=fv3_filenameginput%dynvars @@ -460,32 +380,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens -<<<<<<< HEAD -! do it=1,nfldsig - if(fv3sar_ensemble_opt.eq.0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) - else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v) - endif - if(fv3sar_ensemble_opt.eq.0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) - else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t) - endif - if (fv3sar_ensemble_opt.eq.0) then - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) - g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid - do i=grd_ens%nsig,1,-1 - g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) - enddo - g_ps(:,:)=g_prsi(:,:,1) - else ! for the ensemble processed frm CHGRES - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p) - g_ps=g_ps*0.001_r_kind - do k=1,grd_ens%nsig+1 - g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps - enddo -======= if(fv3sar_ensemble_opt == 0 ) then call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) @@ -510,27 +404,16 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps enddo ->>>>>>> master endif -<<<<<<< HEAD - if(fv3sar_ensemble_opt.eq.0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) -! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) - else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz) -======= if(fv3sar_ensemble_opt == 0) then call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) else call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q) call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz) ->>>>>>> master endif !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -542,41 +425,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g enddo enddo if (.not.q_hyb_ens) then -<<<<<<< HEAD - ice=.true. - iderivative=0 - do k=1,grd_ens%nsig - kp=k+1 - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_prsl(i,j,k)=(g_prsi(i,j,k)+g_prsi(i,j,kp))*half - - end do - end do - end do - - call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k)/g_rh(i,j,k) - end do - end do - end do - else - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k) - end do - end do - end do - end if - - - -!clt not needed call gsi_fv3ncdf2d_read(it,ges_z) -======= ice=.true. iderivative=0 do k=1,grd_ens%nsig @@ -608,7 +456,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g ->>>>>>> master return end subroutine general_read_fv3_regional diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 915fa72d1d..c6cb70d3a8 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -1560,7 +1560,6 @@ subroutine wrfv3_netcdf(fv3filenamegin) end subroutine wrfv3_netcdf ->>>>>>> master subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) !$$$ subprogram documentation block ! . . . . From a43dcbc4c3a8230d8f37dbe51385f10bb1fad00e Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Tue, 17 Nov 2020 15:00:19 +0000 Subject: [PATCH 051/155] merge with EMC gsi master --- fix | 2 +- src/enkf/observer_fv3reg.f90 | 49 ++++++---- src/enkf/params.f90 | 182 +++++++++++++++++++++++++++++++++-- 3 files changed, 202 insertions(+), 31 deletions(-) diff --git a/fix b/fix index 82c9a46fab..e47bcf18cc 160000 --- a/fix +++ b/fix @@ -1 +1 @@ -Subproject commit 82c9a46fabd8d04686589241c36381ab17810cfd +Subproject commit e47bcf18cc9cab37a1f3ccc198b8e6bab578c9b9 diff --git a/src/enkf/observer_fv3reg.f90 b/src/enkf/observer_fv3reg.f90 index 428196c44f..8f77bca417 100644 --- a/src/enkf/observer_fv3reg.f90 +++ b/src/enkf/observer_fv3reg.f90 @@ -62,7 +62,8 @@ subroutine setup_linhx(rlat, rlon, time, ix, delx, ixp, delxp, iy, dely, & end subroutine setup_linhx -subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & + +subroutine calc_linhx(hx, dens, dhx_dx, hxpert, hx_ens, & ix, delx, ixp, delxp, iy, dely, iyp, delyp, & it, delt, itp, deltp) !$$$ subprogram documentation block @@ -76,19 +77,27 @@ subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & ! 2016-11-29 shlyaeva ! ! input argument list: +! hx: observation prior ensemble mean +! dens: state space ensemble perturbations +! dhx_dx: Jacobian +! ix,delx,ixp,delxp,iy,dely,iyp,delyp,it,delt,itp,deltp: horizontal +! and temporal linear interpolation indices and weights. ! ! output argument list: +! hx_ens: observation prior ensemble perturbation +! hxpert: ens pert profile that multiplies dhx_dx to yield hx_ens (in +! compressed format - temporally and horizontally interpolated) ! ! attributes: ! language: f95 ! !$$$ use kinds, only: r_kind,i_kind,r_single - use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim - use gridinfo, only: npts, latsgrd, lonsgrd + use params, only: nstatefields, nlons + use gridinfo, only: npts use statevec, only: nsdim - use constants, only: zero,one,pi - use sparsearr, only: sparr + use constants, only: zero,one + use sparsearr, only: sparr, raggedarr use mpisetup implicit none @@ -98,18 +107,16 @@ subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + type(raggedarr) ,intent(inout) :: hxpert ! interpolated background real(r_single) ,intent( out) :: hx_ens ! H (x_ens) - integer(i_kind) i,j,k - + integer(i_kind) i,j write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' call stop2(555) return end subroutine calc_linhx -subroutine calc_linhx_modens(hx, dens, dhx_dx, hx_ens, & - ix, delx, ixp, delxp, iy, dely, iyp, delyp, & - it, delt, itp, deltp, vscale) +subroutine calc_linhx_modens(hx, dhx_dx, hxpert, hx_ens, vscale) !$$$ subprogram documentation block ! . . . . ! subprogram: calc_linhx @@ -118,34 +125,36 @@ subroutine calc_linhx_modens(hx, dens, dhx_dx, hx_ens, & ! abstract: ! ! program history log: -! 2016-11-29 shlyaeva +! 2016-11-29 shlyaeva, initial version +! 2019-12-09 whitaker, optimizations ! ! input argument list: +! hx: observation prior ensemble mean +! dhx_dx: Jacobian +! hxpert: 'unmodulated' ens pert profile that multiplies dhx_dx +! vscale: vertical scaling from vertical localization eigenvectors used +! to generate modulated ensemble. ! ! output argument list: +! hx_ens: observation prior ensemble perturbation for each verticali +! localization eigenvector ! ! attributes: ! language: f95 ! !$$$ use kinds, only: r_kind,i_kind,r_single - use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim - use gridinfo, only: npts, latsgrd, lonsgrd - use statevec, only: nsdim - use constants, only: zero,one,pi - use sparsearr, only: sparr + use sparsearr, only: sparr, raggedarr use mpisetup implicit none ! Declare passed variables real(r_single) ,intent(in ) :: hx ! H(x_mean) - real(r_single),dimension(npts,nsdim,nstatefields),intent(in ) :: dens ! x_ens - x_mean, state vector space - integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp - real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + type(raggedarr) ,intent(in ) :: hxpert ! interpolated background real(r_single) ,intent( out) :: hx_ens(neigv)! H (x_ens) real(r_double),dimension(neigv,nlevs+1) ,intent(in ) :: vscale ! vertical scaling (for modulated ens) - integer(i_kind) i,j,k + integer(i_kind) i write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' call stop2(555) diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index 100e2c9080..210643db0b 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -176,6 +176,9 @@ module params ! next two are no longer used, instead they are inferred from anavinfo logical,public :: massbal_adjust = .false. +integer (i_kind), public :: ldo_enscalc_option = 0 +! true, the program will be used to calculate ensemble mean (=1) or recenter(=2) + integer(i_kind),public :: nvars = -1 ! sort obs in LETKF in order of decreasing DFS @@ -198,16 +201,15 @@ module params ! if true, use jacobian from GSI stored in diag file to compute ! ensemble perturbations in observation space. logical,public :: lobsdiag_forenkf = .false. -integer (i_kind), public :: ldo_enscalc_option = 0 -! true, the program will be used to calculate ensemble mean (=1) or recenter(=2) - ! if true, use netcdf diag files, otherwise use binary diags logical,public :: netcdf_diag = .false. ! use fv3 cubed-sphere tiled restart files +logical,public :: fv3_native = .true. +character(len=500),public :: fv3fixpath = ' ' integer(i_kind),public :: ntiles=6 integer(i_kind),public :: nx_res=0,ny_res=0 -logical,public ::l_pres_add_saved +logical,public ::l_pres_add_saved=.true. ! for parallel netCDF logical, public :: paranc = .false. @@ -236,7 +238,7 @@ module params paoverpb_thresh,latbound,delat,pseudo_rh,numiter,biasvar,& lupd_satbiasc,cliptracers,simple_partition,adp_anglebc,angord,& newpc4pred,nmmb,nhr_anal,nhr_state, fhr_assim,nbackgrounds,nstatefields, & - save_inflation,nobsl_max,lobsdiag_forenkf, ldo_enscalc_option,netcdf_diag,& + save_inflation,nobsl_max,lobsdiag_forenkf,ldo_enscalc_option,netcdf_diag,& letkf_flag,massbal_adjust,use_edges,emiss_bc,iseed_perturbed_obs,npefiles,& getkf,getkf_inflation,denkf,modelspace_vloc,dfs_sort,write_spread_diag,& covinflatenh,covinflatesh,covinflatetr,lnsigcovinfcutoff,letkf_bruteforce_search,& @@ -244,7 +246,166 @@ module params fv3_native, paranc, nccompress, write_fv3_incr,incvars_to_zero namelist /nam_wrf/arw,nmm,nmm_restart namelist /nam_fv3/fv3fixpath,nx_res,ny_res,ntiles,l_pres_add_saved -namelist / +namelist /satobs_enkf/sattypes_rad,dsis +namelist /ozobs_enkf/sattypes_oz + +contains + +subroutine read_namelist() +integer i,j,nb,np +logical fexist +real(r_single) modelspace_vloc_cutoff, modelspace_vloc_thresh +! have all processes read namelist from file enkf.nml + +! defaults +! time (analysis time YYYYMMDDHH) +datestring = "0000000000" ! if 0000000000 will not be used. +! corrlength (length for horizontal localization in km) +! this corresponding GSI parameter is s_ens_h. +! corrlength is the distance at which the Gaspari-Cohn +! polynomial goes to zero. s_ens_h is the scale of a +! Gaussian exp(-0.5*(r/L)**2) so +! corrlength ~ sqrt(2/0.15)*s_ens_h +corrlengthnh = 2800_r_single +corrlengthtr = 2800_r_single +corrlengthsh = 2800_r_single +! read in localization length scales from an external file. +readin_localization = .false. +! min and max inflation. +covinflatemin = 1.0_r_single +covinflatemax = 1.e30_r_single +! lnsigcutoff (length for vertical localization in ln(p)) +! **these are ignored if modelspace_vloc=.true.** +! this corresponding GSI parameter is -s_ens_v (if s_ens_v<0) +! lnsigcutoff is the distance at which the Gaspari-Cohn +! polynomial goes to zero. s_ens_v is the scale of a +! Gaussian exp(-(r/L)**2) so +! lnsigcutoff ~ s_ens_v/sqrt(0.15) +lnsigcutoffnh = 2._r_single +lnsigcutofftr = 2._r_single +lnsigcutoffsh = 2._r_single +lnsigcutoffsatnh = -999._r_single ! value for satellite radiances +lnsigcutoffsattr = -999._r_single ! value for satellite radiances +lnsigcutoffsatsh = -999._r_single ! value for satellite radiances +lnsigcutoffpsnh = -999._r_single ! value for surface pressure +lnsigcutoffpstr = -999._r_single ! value for surface pressure +lnsigcutoffpssh = -999._r_single ! value for surface pressure +! ob time localization +obtimelnh = 1.e10_r_single +obtimeltr = 1.e10_r_single +obtimelsh = 1.e10_r_single +! min localization reduction factor for adaptive localization +! based on HPaHt/HPbHT. Default (1.0) means no adaptive localization. +! 0.25 means minimum localization is 0.25*corrlength(nh,tr,sh). +covl_minfact = 1.0_r_single +! efolding distance for adapative localization. +! Localization reduction factor is 1. - exp( -((1.-paoverpb)/covl_efold) ) +! When 1-pavoerpb=1-HPaHt/HPbHt=cov_efold localization scales reduced by +! factor of 1-1/e ~ 0.632. When paoverpb==>1, localization scales go to zero. +! When paoverpb==>1, localization scales not reduced. +covl_efold = 1.e-10_r_single +! path to data directory +datapath = " " ! mandatory +! tolerance for background check. +! obs are not used if they are more than sqrt(S+R) from mean, +! where S is ensemble variance and R is observation error variance. +sprd_tol = 9.9e31_r_single +! definition of tropics and mid-latitudes (for inflation). +latbound = 25._r_single ! this is where the tropics start +delat = 10._r_single ! width of transition zone. +! RTPS inflation coefficients. +analpertwtnh = 0.0_r_single ! no inflation (1 means inflate all the way back to prior spread) +analpertwtsh = 0.0_r_single +analpertwttr = 0.0_r_single +! RTPP inflation coefficients. +analpertwtnh_rtpp = 0.0_r_single ! no inflation (1 means inflate all the way back to prior perturbation) +analpertwtsh_rtpp = 0.0_r_single +analpertwttr_rtpp = 0.0_r_single +! lnsigcovinfcutoff (length for vertical taper in inflation in ln(sigma)) +lnsigcovinfcutoff = 1.0e30_r_single +! if ob space posterior variance divided by prior variance +! less than this value, ob is skipped during serial processing. +paoverpb_thresh = 1.0_r_single! don't skip any obs +! set to to 0 for the order they are read in, 1 for random order, or 2 for +! order of predicted posterior variance reduction (based on prior) +iassim_order = 0 +! use 'pseudo-rh' analysis variable, as in GSI. +pseudo_rh = .false. +! if deterministic is true, use LETKF/EnSRF w/o perturbed obs. +! if false, use perturbed obs EnKF/LETKF. +deterministic = .true. +! if deterministic is false, re-order obs to minimize regression erros +! as described in Anderson (2003) (only used for serial filter). +sortinc = .true. +! type of GFS microphyics. +! 99: Zhao-Carr, 11: GFDL +imp_physics = 99 +! lupp, if true output extra variables (deprecated, does not do anything) +lupp = .false. +! these are all mandatory. +! nlons and nlats are # of lons and lats +nlons = 0 +nlats = 0 +! total number of levels +nlevs = 0 +! number of ensemble members +nanals = 0 +! background error variance for rad bias coeffs (used in radbias.f90) +! default is (old) GSI value. +! if negative, bias coeff error variace is set to -biasvar/N, where +! N is number of obs per instrument/channel. +! if newpc4pred is .true., biasvar is not used - the estimated +! analysis error variance from the previous cycle is used instead +! (same as in the GSI). +biasvar = 0.1_r_single + +! factor to multiply sat radiance errors. +saterrfact = 1._r_single +! number of times to iterate state/bias correction update. +! (numiter = 1 means no iteration, but update done in both observation and model +! space) +! (for LETKF, numiter = 0 shuts off update in observation space) +numiter = 1 + +! varqc parameters +varqc = .false. +huber = .false. ! use huber norm instead of "flat-tail" +zhuberleft=1.e30_r_single +zhuberright=1.e30_r_single +! smoothing paramater for inflation (-1 for no smoothing) +smoothparm = -1 +! if true, tracers are clipped to zero when read in, and just +! before they are written out. +cliptracers = .true. + +! Initialize satellite files to ' ' +sattypes_rad=' ' +sattypes_oz=' ' +dsis=' ' + +! Initialize first-guess and analysis file name prefixes. +! (blank means use default names) +fgfileprefixes = ''; anlfileprefixes=''; statefileprefixes='' +fgsfcfileprefixes = ''; statesfcfileprefixes='' +incfileprefixes = '' + +! option for including convective clouds in the all-sky +cnvw_option=.false. + +l_pres_add_saved=.true. + +! read from namelist file, doesn't seem to work from stdin with mpich +open(912,file='enkf.nml',form="formatted") +read(912,nam_enkf) +read(912,satobs_enkf) +read(912,ozobs_enkf) +if (regional) then + read(912,nam_wrf) +endif +if (fv3_native) then + read(912,nam_fv3) + nlons = nx_res; nlats = ny_res ! (total number of pts = ntiles*res*res) +endif close(912) ! find number of satellite files @@ -408,13 +569,14 @@ module params print *, 'must select either arw, nmm or nmmb regional dynamical core' call stop2(19) endif - if (fv3_native .and. (trim(fv3fixpath) == '' .or.nx_res == 0.or.ny_res == 0)) then - print *, 'must specify nx_res,ny_res when fv3_native is true' + if (fv3_native .and. (trim(fv3fixpath) == '' .or. nx_res == 0 .or. ny_res == 0 )) then + print *, 'must specify nx_res,ny_res and fv3fixpath when fv3_native is true' call stop2(19) endif - if(ldo_enscalc_option .ne.0 ) then - l_pres_add_saved=.false. + if(ldo_enscalc_option .ne.0 ) then + l_pres_add_saved=.false. endif + if (letkf_flag .and. univaroz) then print *,'univaroz is not supported in LETKF!' call stop2(19) From cb276eb4079b6419617b0d8803e119d0fed9b84b Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Thu, 19 Nov 2020 11:34:36 -0600 Subject: [PATCH 052/155] Remove the unneeded input parameter mype for general_read_fv3_regional in src/gsi/cplr_get_fv3_regional_ensperts.f90. --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index 1ee22fa8da..0b988124dc 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -126,7 +126,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! ! READ ENEMBLE MEMBERS DATA if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) - call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) + call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz) ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR do ic3=1,nc3d @@ -301,7 +301,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) end subroutine get_fv3_regional_ensperts_run - subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) + subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz) !clt modified from rad_fv3_netcdf_guess !$$$ subprogram documentation block ! . . . . @@ -368,7 +368,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2),intent(out):: g_ps real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ::g_tsen, g_q,g_prsl real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig+1) ::g_prsi - integer(i_kind),intent(in)::mype ! ! Declare local parameters real(r_kind),parameter:: r0_01 = 0.01_r_kind From 7e6c341125c05bbfbee50f354b810a5aca99bf14 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Thu, 19 Nov 2020 18:44:56 +0000 Subject: [PATCH 053/155] some cleaning after merging with master --- cmake/Modules/FindBACIO.cmake | 55 - cmake/Modules/FindBUFR.cmake | 60 - cmake/Modules/FindBaselibs.cmake | 68 - cmake/Modules/FindCORELIBS.cmake | 287 ---- cmake/Modules/FindCRTM.cmake | 81 - cmake/Modules/FindGSICONTROL.cmake | 52 - cmake/Modules/FindHDF5.cmake | 24 - cmake/Modules/FindIP.cmake | 83 - cmake/Modules/FindMPI.cmake | 18 - cmake/Modules/FindNDATE.cmake | 13 - cmake/Modules/FindNEMSIO.cmake | 72 - cmake/Modules/FindNetCDF.cmake | 147 -- cmake/Modules/FindSFCIO.cmake | 71 - cmake/Modules/FindSIGIO.cmake | 72 - cmake/Modules/FindSP.cmake | 83 - cmake/Modules/FindW3EMC.cmake | 124 -- cmake/Modules/FindW3NCO.cmake | 81 - cmake/Modules/FindWRF.cmake | 36 - .../NewCMake/CMakeParseArguments.cmake | 11 - cmake/Modules/NewCMake/FindHDF5.cmake | 934 ---------- cmake/Modules/NewCMake/FindMPI.cmake | 1514 ----------------- .../NewCMake/FindMPI/fortranparam_mpi.f90.in | 4 - cmake/Modules/NewCMake/FindMPI/libver_mpi.c | 19 - .../NewCMake/FindMPI/libver_mpi.f90.in | 7 - cmake/Modules/NewCMake/FindMPI/mpiver.f90.in | 10 - cmake/Modules/NewCMake/FindMPI/test_mpi.c | 37 - .../Modules/NewCMake/FindMPI/test_mpi.f90.in | 6 - .../FindPackageHandleStandardArgs.cmake | 386 ----- .../Modules/NewCMake/FindPackageMessage.cmake | 47 - .../SelectLibraryConfigurations.cmake | 70 - cmake/Modules/findHelpers.cmake | 173 -- cmake/Modules/platforms/Cheyenne.cmake | 24 - cmake/Modules/platforms/Discover.cmake | 55 - cmake/Modules/platforms/Gaea.cmake | 14 - cmake/Modules/platforms/Generic.cmake | 24 - cmake/Modules/platforms/Hera.cmake | 42 - cmake/Modules/platforms/Jet.cmake | 10 - cmake/Modules/platforms/Orion.cmake | 42 - cmake/Modules/platforms/S4.cmake | 10 - cmake/Modules/platforms/WCOSS-C.cmake | 60 - cmake/Modules/platforms/WCOSS-D.cmake | 51 - cmake/Modules/platforms/WCOSS.cmake | 61 - cmake/Modules/setGNUFlags.cmake | 66 - cmake/Modules/setHOST.cmake | 97 -- cmake/Modules/setIntelFlags.cmake | 94 - cmake/Modules/setPGIFlags.cmake | 78 - cmake/Modules/setPlatformVariables.cmake | 11 - src/class_get_fv3_regional_ensperts.f90 | 32 - src/cplr_get_fv3_regional_ensperts.f90 | 667 -------- src/enkf/fv3_netcdf_mod.F90 | 62 - src/enkf/gridinfo_fv3.f90 | 226 --- src/enkf/read_fv3_restart_data.f90 | 4 - src/enkf/read_fv3_restarts.f90 | 165 -- src/enkf/read_fv3regional_restart_data.f90 | 8 - src/enkf/read_fv3regional_restarts.f90 | 66 - src/enkf/write_fv3_restart_data.f90 | 4 - 56 files changed, 6618 deletions(-) delete mode 100644 cmake/Modules/FindBACIO.cmake delete mode 100644 cmake/Modules/FindBUFR.cmake delete mode 100644 cmake/Modules/FindBaselibs.cmake delete mode 100644 cmake/Modules/FindCORELIBS.cmake delete mode 100644 cmake/Modules/FindCRTM.cmake delete mode 100644 cmake/Modules/FindGSICONTROL.cmake delete mode 100644 cmake/Modules/FindHDF5.cmake delete mode 100644 cmake/Modules/FindIP.cmake delete mode 100644 cmake/Modules/FindMPI.cmake delete mode 100644 cmake/Modules/FindNDATE.cmake delete mode 100644 cmake/Modules/FindNEMSIO.cmake delete mode 100644 cmake/Modules/FindNetCDF.cmake delete mode 100644 cmake/Modules/FindSFCIO.cmake delete mode 100644 cmake/Modules/FindSIGIO.cmake delete mode 100644 cmake/Modules/FindSP.cmake delete mode 100644 cmake/Modules/FindW3EMC.cmake delete mode 100644 cmake/Modules/FindW3NCO.cmake delete mode 100644 cmake/Modules/FindWRF.cmake delete mode 100644 cmake/Modules/NewCMake/CMakeParseArguments.cmake delete mode 100644 cmake/Modules/NewCMake/FindHDF5.cmake delete mode 100644 cmake/Modules/NewCMake/FindMPI.cmake delete mode 100644 cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.c delete mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/mpiver.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.c delete mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake delete mode 100644 cmake/Modules/NewCMake/FindPackageMessage.cmake delete mode 100644 cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake delete mode 100644 cmake/Modules/findHelpers.cmake delete mode 100644 cmake/Modules/platforms/Cheyenne.cmake delete mode 100644 cmake/Modules/platforms/Discover.cmake delete mode 100644 cmake/Modules/platforms/Gaea.cmake delete mode 100644 cmake/Modules/platforms/Generic.cmake delete mode 100644 cmake/Modules/platforms/Hera.cmake delete mode 100644 cmake/Modules/platforms/Jet.cmake delete mode 100644 cmake/Modules/platforms/Orion.cmake delete mode 100644 cmake/Modules/platforms/S4.cmake delete mode 100644 cmake/Modules/platforms/WCOSS-C.cmake delete mode 100644 cmake/Modules/platforms/WCOSS-D.cmake delete mode 100644 cmake/Modules/platforms/WCOSS.cmake delete mode 100644 cmake/Modules/setGNUFlags.cmake delete mode 100644 cmake/Modules/setHOST.cmake delete mode 100644 cmake/Modules/setIntelFlags.cmake delete mode 100644 cmake/Modules/setPGIFlags.cmake delete mode 100644 cmake/Modules/setPlatformVariables.cmake delete mode 100644 src/class_get_fv3_regional_ensperts.f90 delete mode 100644 src/cplr_get_fv3_regional_ensperts.f90 delete mode 100644 src/enkf/fv3_netcdf_mod.F90 delete mode 100644 src/enkf/gridinfo_fv3.f90 delete mode 100644 src/enkf/read_fv3_restart_data.f90 delete mode 100644 src/enkf/read_fv3_restarts.f90 delete mode 100644 src/enkf/read_fv3regional_restart_data.f90 delete mode 100644 src/enkf/read_fv3regional_restarts.f90 delete mode 100644 src/enkf/write_fv3_restart_data.f90 diff --git a/cmake/Modules/FindBACIO.cmake b/cmake/Modules/FindBACIO.cmake deleted file mode 100644 index 04410f631e..0000000000 --- a/cmake/Modules/FindBACIO.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{BACIO_VER}) - set(BACIO_VER $ENV{BACIO_VER}) - STRING(REGEX REPLACE "v" "" BACIO_VER ${BACIO_VER}) -endif() -if(NOT BUILD_BACIO ) - if(DEFINED ENV{BACIO_LIB4}) - set(BACIO_LIBRARY $ENV{BACIO_LIB4} ) - else() - find_library( BACIO_LIBRARY - NAMES libbacio.a libbacio_4.a libbacio_v${BACIO_VER}_4.a - HINTS $ENV{COREPATH}/lib /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/bacio/v${BACIO_VER} - ${COREPATH}/bacio/v${BACIO_VER}/intel - ${COREPATH}/bacio/v${BACIO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH} - ) - message("Found BACIO library ${BACIO_LIBRARY}") - endif() -endif() -if( NOT BACIO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find BACIO library, so building from libsrc") - if( DEFINED ENV{BACIO_SRC} ) - set( BACIO_DIR $ENV{BACIO_SRC} CACHE STRING "BACIO Source Directory" ) - else() - findSrc( "bacio" BACIO_VER BACIO_DIR ) - set(BACIOINC "${CMAKE_BINARY_DIR}/include") - endif() - set( libsuffix "_v${BACIO_VER}${debug_suffix}" ) - set( bacio "bacio${libsuffix}") - set( BUILD_BACIO "ON" CACHE INTERNAL "Build Bacio library" ) - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/bacio) - set( BACIO_LIBRARY ${bacio} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) - else() - set( CORE_BUILT ${BACIO_LIBRARY} ) - endif() -else( NOT BACIO_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${BACIO_LIBRARY} ) - else() - set( CORE_LIBRARIES ${BACIO_LIBRARY} ) - endif() -endif( NOT BACIO_LIBRARY ) - -set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) - diff --git a/cmake/Modules/FindBUFR.cmake b/cmake/Modules/FindBUFR.cmake deleted file mode 100644 index 58527743bc..0000000000 --- a/cmake/Modules/FindBUFR.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{BUFR_VER}) - set(BUFR_VER $ENV{BUFR_VER}) - STRING(REGEX REPLACE "v" "" BUFR_VER ${BUFR_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_BUFR ) - if(DEFINED ENV{BUFR_LIBd} ) - set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) - message("BUFR library ${BUFR_LIBRARY} set via Environment variable") - else() - find_library( BUFR_LIBRARY - NAMES libbufr.a libbufr_d_64.a libbufr_i4r8.a libbufr_v${BUFR_VER}_d_64.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/bufr/v${BUFR_VER} - ${COREPATH}/bufr/v${BUFR_VER}/intel - ${COREPATH}/bufr/v${BUFR_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( bufr "bufr_v${BUFR_VER}") - message("Found BUFR library ${BUFR_LIBRARY}") - endif() -endif() -if( NOT BUFR_LIBRARY ) # didn't find the library, so build it from source - message("Could not find BUFR library, so building from libsrc") - if( NOT DEFINED ENV{BUFR_SRC} ) - findSrc( "bufr" BUFR_VER BUFR_DIR ) - else() - set( BUFR_DIR "$ENV{BUFR_SRC}/libsrc" CACHE STRING "BUFR Source Location") - endif() - set( libsuffix "_v${BUFR_VER}${debug_suffix}" ) - set( BUFR_LIBRARY "${LIBRARY_OUTPUT_PATH}/libbufr${libsuffix}.a" CACHE STRING "BUFR Library" ) - set( bufr "bufr${libsuffix}") - set( BUILD_BUFR "ON" CACHE INTERNAL "Build the BUFR library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/bufr) - set( BUFR_LIBRARY ${bufr} ) - - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${BUFR_LIBRARY} ) - else() - set( CORE_BUILT ${BUFR_LIBRARY} ) - endif() -else( NOT BUFR_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${BUFR_LIBRARY} ) - else() - set( CORE_LIBRARIES ${BUFR_LIBRARY} ) - endif() -endif() -set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) - diff --git a/cmake/Modules/FindBaselibs.cmake b/cmake/Modules/FindBaselibs.cmake deleted file mode 100644 index 793cb9a5d4..0000000000 --- a/cmake/Modules/FindBaselibs.cmake +++ /dev/null @@ -1,68 +0,0 @@ -if (NOT BASEDIR) - if(${COMPILER_TYPE} STREQUAL "intel" ) - string(REGEX MATCH "mpt" MPT ${MPI_Fortran_INCLUDE_PATH}) - string(REGEX MATCH "impi" IMPI ${MPI_Fortran_INCLUDE_PATH}) - message("REGEX returns ${MPT} ") - if( MPT MATCHES "mpt" ) - message("setting mpt paths ") - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_15.0.2.164-mpt_2.14/Linux") - elseif( IMPI MATCHES "impi" ) - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_16.0.3.210-intelmpi_5.1.3.210/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() - if(${COMPILER_TYPE} STREQUAL "gnu" ) - string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) - message("REGEX returns ${OPENMPI} ") - if( OPENMPI MATCHES "openmpi" ) - message("setting openmpi paths ") - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-4_0_8/x86_64-unknown-linux-gnu/gfortran_7.2.0-openmpi_3.0.0/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() - if(${COMPILER_TYPE} STREQUAL "pgi" ) - string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) - if( OPENMPI MATCHES "openmpi" ) - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_1/x86_64-unknown-linux-gnu/pgfortran_16.5-openmpi_1.10.3/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() -endif () -if (ESMA_SDF) - message (FATAL_ERROR "ERROR: -hdf option was thought to be obsolete when CMake was crafted.") -endif () - -link_directories (${BASEDIR}/lib) - -#------------------------------------------------------------------ -# netcdf -# The following command provides the list of libraries that netcdf -# uses. Unfortunately it also includes the library path and "-l" -# prefixes, which CMake handles in a different manner. So we need so -# strip off that item from the list -execute_process ( - COMMAND ${BASEDIR}/bin/nf-config --flibs - OUTPUT_VARIABLE LIB_NETCDF - ) - -string(REGEX MATCHALL " -l[^ ]*" _full_libs "${LIB_NETCDF}") -set (NETCDF_LIBRARIES) -foreach (lib ${_full_libs}) - string (REPLACE "-l" "" _tmp ${lib}) - string (STRIP ${_tmp} _tmp) - list (APPEND NETCDF_LIBRARIES ${_tmp}) -endforeach() -#------------------------------------------------------------------ - -list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/netcdf) -list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/hdf5) - -message(STATUS "NETCDF_INCLUDES: ${NETCDF_INCLUDES}") -message(STATUS "NETCDF_LIBRARIES: ${NETCDF_LIBRARIES}") - diff --git a/cmake/Modules/FindCORELIBS.cmake b/cmake/Modules/FindCORELIBS.cmake deleted file mode 100644 index 711864ebce..0000000000 --- a/cmake/Modules/FindCORELIBS.cmake +++ /dev/null @@ -1,287 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{BUFR_VER}) - set(BUFR_VER $ENV{BUFR_VER}) - STRING(REGEX REPLACE "v" "" BUFR_VER ${BUFR_VER}) -endif() -if(DEFINED ENV{NEMSIO_VER}) - set(NEMSIO_VER $ENV{NEMSIO_VER}) - STRING(REGEX REPLACE "v" "" NEMSIO_VER ${NEMSIO_VER}) -endif() -if(DEFINED ENV{SFCIO_VER}) - set(SFCIO_VER $ENV{SFCIO_VER}) - STRING(REGEX REPLACE "v" "" SFCIO_VER ${SFCIO_VER}) -endif() -if(DEFINED ENV{SIGIO_VER}) - set(SIGIO_VER $ENV{SIGIO_VER}) - STRING(REGEX REPLACE "v" "" SIGIO_VER ${SIGIO_VER}) -endif() -if(DEFINED ENV{SP_VER}) - set(SP_VER $ENV{SP_VER}) - STRING(REGEX REPLACE "v" "" SP_VER ${SP_VER}) -endif() -if(DEFINED ENV{W3EMC_VER}) - set(W3EMC_VER $ENV{W3EMC_VER}) - STRING(REGEX REPLACE "v" "" W3EMC_VER ${W3EMC_VER}) -endif() -if(DEFINED ENV{W3NCO_VER}) - set(W3NCO_VER $ENV{W3NCO_VER}) - STRING(REGEX REPLACE "v" "" W3NCO_VER ${W3NCO_VER}) -endif() - -set (CORE_DEPS " ") -set( NO_DEFAULT_PATH ) -if(NOT BUILD_EMC ) - if(DEFINED ENV{W3EMC_LIBd} ) - set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} ) - set(W3EMCINC $ENV{W3EMC_INCd} ) - else() - find_path( W3EMCINC - NAMES mersenne_twister.mod - HINTS - $ENV{COREPATH}/lib/incmod/w3emc_4 - $ENV{COREPATH}/include - /usr/local/jcsda/nwprod_gdas_2014/lib/lib/incmod/w3emc_4 - ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_d - ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_d - ) - find_library( W3EMC_LIBRARY - NAMES libw3emc_4.a libw3emc_i4r8.a libw3emc_v${W3EMC_VER}_d.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/w3emc/v${W3EMC_VER} - ${COREPATH}/w3emc/v${W3EMC_VER}/intel - PATH_SUFFIXES - lib - ) - message("Found W3EMC library ${W3EMC_LIBRARY}") - endif() -else() - set( libsuffix "_v${W3EMC_VER}${debug_suffix}" ) - set( W3EMC_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3emc${libsuffix}.a" CACHE STRING "W3EMC Library" ) - set( w3emc "w3emc${libsuffix}") - if( DEFINED ENV{W3EMC_SRC} ) - set( W3EMC_DIR $ENV{W3EMC_SRC} CACHE STRING "W3EMC Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "w3emc" W3EMC_VER W3EMC_DIR ) - endif() - endif() -endif() -if(NOT BUILD_NCO ) - if(DEFINED ENV{W3NCO_LIBd} ) - set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} ) - else() - find_library( W3NCO_LIBRARY - NAMES libw3nco_v${W3NCO_VER}_d.a libw3nco_d.a libw3nco_i4r8.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/w3nco/v${W3NCO_VER} - ${COREPATH}/w3nco/v${W3NCO_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - message("Found W3NCO library ${W3NCO_LIBRARY}") - endif() -else() - if( DEFINED ENV{W3NCO_SRC} ) - set( W3NCO_DIR $ENV{W3NCO_SRC} CACHE STRING "W3NCO Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "w3nco" W3NCO_VER W3NCO_DIR ) - endif() - endif() - set( libsuffix "_v${W3NCO_VER}${debug_suffix}" ) - set( W3NCO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3nco${libsuffix}.a" CACHE STRING "W3NCO Library" ) - set( w3nco "w3nco${libsuffix}") -endif() -if(NOT BUILD_BUFR ) - if(DEFINED ENV{BUFR_LIBd} ) - set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) - else() - find_library( BUFR_LIBRARY - NAMES libbufr.a libbufr_d_64.a libbufr_i4r8.a libbufr_v${BUFR_VER}_d_64.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/bufr/v${BUFR_VER} - ${COREPATH}/bufr/v${BUFR_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( bufr "bufr_v${BUFR_VER}") - message("Found BUFR library ${BUFR_LIBRARY}") - endif() -else() - if( DEFINED ENV{BUFR_SRC} ) - set( BUFR_DIR $ENV{BUFR_SRC} CACHE STRING "BUFR Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "bufr" BUFR_VER BUFR_DIR ) - endif() - endif() - set( libsuffix "_v${BUFR_VER}${debug_suffix}" ) - set( BUFR_LIBRARY "${LIBRARY_OUTPUT_PATH}/libbufr${libsuffix}.a" CACHE STRING "BUFR Library" ) - set( bufr "bufr${libsuffix}") -endif() -if(NOT BUILD_SFCIO ) - if(DEFINED ENV{SFCIO_LIB4} ) - set(SFCIO_LIBRARY $ENV{SFCIO_LIB4} ) - set(SFCIOINC $ENV{SFCIO_INC4} ) - else() - findInc( sfcio SFCIO_VER SFCIOINC ) - find_library( SFCIO_LIBRARY - NAMES libsfcio.a libsfcio_4.a libsfcio_i4r4.a libsfcio_v${SFCIO_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sfcio/v${SFCIO_VER} - ${COREPATH}/sfcio/v${SFCIO_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sfcio "sfcio_v${SFCIO_VER}_4") - message("Found SFCIO library ${SFCIO_LIBRARY}") - endif() -else() - if( DEFINED ENV{SFCIO_SRC} ) - set( SFCIO_DIR $ENV{SFCIO_SRC} CACHE STRING "SFCIO Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "sfcio" SFCIO_VER SFCIO_DIR ) - endif() - endif() - set( libsuffix "_v${SFCIO_VER}${debug_suffix}" ) - set( SFCIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsfcio${libsuffix}.a" CACHE STRING "SFCIO Library" ) - set( sfcio "sfcio${libsuffix}") -endif() -if(NOT BUILD_SIGIO ) - if(DEFINED ENV{SIGIO_LIB4} ) - set(SIGIO_LIBRARY $ENV{SIGIO_LIB4} ) - set(SIGIOINC $ENV{SIGIO_INC4} ) - else() - findInc( sigio SIGIO_VER SIGIOINC ) - message("SIGIOINC is ${SIGIOINC}") - find_library( SIGIO_LIBRARY - NAMES libsigio.a libsigio_4.a libsigio_i4r4.a libsigio_v${SIGIO_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sigio/v${SIGIO_VER} - ${COREPATH}/sigio/v${SIGIO_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sigio "sigio_v${SIGIO_VER}_4") - message("Found SIGIO library ${SIGIO_LIBRARY}") - endif() -else() - if( DEFINED ENV{SIGIO_SRC} ) - set( SIGIO_DIR $ENV{SIGIO_SRC} CACHE STRING "SIGIO Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "sigio" SIGIO_VER SIGIO_DIR ) - endif() - endif() - set( libsuffix "_v${SIGIO_VER}${debug_suffix}" ) - set( SIGIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsigio${libsuffix}.a" CACHE STRING "SIGIO Library" ) - set( sigio "sigio${libsuffix}") - set( CORE_DEPS "${CORE_DEPS} ${baseName}" ) -endif() -if(NOT BUILD_NEMSIO ) - if(DEFINED ENV{NEMSIO_LIB} ) - set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} ) - set(NEMSIOINC $ENV{NEMSIO_INC} ) - else() - findInc( nemsio NEMSIO_VER NEMSIOINC ) - find_library( NEMSIO_LIBRARY - NAMES libnemsio.a libnemsio_v${NEMSIO_VER}.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/nemsio/v${NEMSIO_VER} - ${COREPATH}/nemsio/v${NEMSIO_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( nemsio "nemsio_v${NEMSIO_VER}") - message("Found NEMSIO library ${NEMSIO_LIBRARY}") - endif() -else() - if( DEFINED ENV{NEMSIO_SRC} ) - set( NEMSIO_DIR $ENV{NEMSIO_SRC} CACHE STRING "NEMSIO Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "nemsio" NEMSIO_VER NEMSIO_DIR ) - endif() - endif() - set( libsuffix "_v${NEMSIO_VER}${debug_suffix}" ) - set( NEMSIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libnemsio${libsuffix}.a" CACHE STRING "NEMSIO Library" ) - set( nemsio "nemsio${libsuffix}") -endif() -if(NOT BUILD_SP ) - if(DEFINED ENV{SP_LIBd} ) - set(SP_LIBRARY $ENV{SP_LIBd} ) - else() - find_library( SP_LIBRARY - NAMES libsp_d.a libsp_i4r8.a libsp_v${SP_VER}_d.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sp/v${SP_VER} - ${COREPATH}/sp/v${SP_VER}/intel - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sp "sp_v${SP_VER}_d") - message("Found SP library ${SP_LIBRARY}") - endif() -else() - if( DEFINED ENV{SP_SRC} ) - set( SP_DIR $ENV{SP_SRC} CACHE STRING "SP Source Directory" ) - else() - if( FIND_SRC ) - findSrc( "sp" SP_VER SP_DIR ) - endif() - endif() - set( libsuffix "_v${SP_VER}${debug_suffix}" ) - set( SP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp${libsuffix}.a" CACHE STRING "SP Library" ) - set( sp "sp${libsuffix}") -endif() - -if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${SFCIO_LIBRARY} ${SIGIO_LIBRARY} - ${NEMSIO_LIBRARY} ${SP_LIBRARY} ${W3NCO_LIBRARY} ${BUFR_LIBRARY} - ${W3EMC_LIBRARY} CACHE INTERNAL "List of Core libs" ) - list( APPEND CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ${SIGIOINC} ${NEMSIOINC} ${W3EMCINC} ) -else() - set( CORE_LIBRARIES ${SFCIO_LIBRARY} ${SIGIO_LIBRARY} - ${NEMSIO_LIBRARY} ${SP_LIBRARY} ${W3NCO_LIBRARY} ${BUFR_LIBRARY} - ${W3EMC_LIBRARY} CACHE INTERNAL "List of Core libs" ) - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ${SIGIOINC} ${NEMSIOINC} ${W3EMCINC} ) -endif() - -set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) - -set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) -set( SFCIO_INCLUDE_PATH ${SFCIOINC} CACHE STRING "SFCIO Include Location" ) - -set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) -set( SIGIO_INCLUDE_PATH ${SIGIOINC} CACHE STRING "SIGIO Include Location" ) - -set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) - -set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) -set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) - -set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) -set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) - -set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) - diff --git a/cmake/Modules/FindCRTM.cmake b/cmake/Modules/FindCRTM.cmake deleted file mode 100644 index ee982c1499..0000000000 --- a/cmake/Modules/FindCRTM.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{CRTM_VER}) - set(CRTM_VER $ENV{CRTM_VER}) - STRING(REGEX REPLACE "v" "" CRTM_VER ${CRTM_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_CRTM ) - if(DEFINED ENV{CRTM_LIB} ) - set(CRTM_LIBRARY $ENV{CRTM_LIB} ) - set(CRTMINC $ENV{CRTM_INC} ) - message("CRTM library ${CRTM_LIBRARY} set via Environment variable") - else() - findInc( crtm CRTM_VER CRTMINC ) - find_library( CRTM_LIBRARY - NAMES libcrtm_v${CRTM_VER}.a libcrtm.a libCRTM.a - HINTS - /usr/local/jcsda/nwprod_gdas_2014/lib - ${CRTM_BASE} - ${CRTM_BASE}/lib - ${CRTM_BASE}/${CRTM_VER} - ${CRTM_BASE}/${CRTM_VER}/lib - ${CRTM_BASE}/v${CRTM_VER}/intel - ${CRTM_BASE}/v${CRTM_VER}/ips/${COMPILER_VERSION} - ${COREPATH}/v${CRTM_VER}/ips/${COMPILER_VERSION} - ${COREPATH} - ${COREPATH}/lib - $ENV{COREPATH} - $ENV{COREPATH}/lib - $ENV{COREPATH}/include - ${CORECRTM}/crtm/${CRTM_VER} - /nwprod2/lib/crtm/v${CRTM_VER} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( crtm "crtm_v${CRTM_VER}") - message("Found CRTM library ${CRTM_LIBRARY}") - endif() -endif() -if( NOT CRTM_LIBRARY ) # didn't find the library, so build it from source - message("Could not find CRTM library, so building from libsrc") - if( NOT DEFINED ENV{CRTM_SRC} ) - findSrc( "crtm" CRTM_VER CRTM_DIR ) - set(CRTMINC "${CMAKE_BINARY_DIR}/include") - else() - set( CRTM_DIR "$ENV{CRTM_SRC}/libsrc" CACHE STRING "CRTM Source Location") - set(CRTMINC "${CORECRTM}/crtm/${CRTM_VER}/incmod/crtm_v${CRTM_VER}") - endif() - set( libsuffix "_v${CRTM_VER}${debug_suffix}" ) - set( CRTM_LIBRARY "${LIBRARY_OUTPUT_PATH}/libcrtm${libsuffix}.a" CACHE STRING "CRTM Library" ) - set( crtm "crtm${libsuffix}") - set( BUILD_CRTM "ON" CACHE INTERNAL "Build the CRTM library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/crtm) - set( CRTM_LIBRARY ${crtm} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${CRTM_LIBRARY} ) - else() - set( CORE_BUILT ${CRTM_LIBRARY} ) - endif() -else( NOT CRTM_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${CRTM_LIBRARY} ) - else() - set( CORE_LIBRARIES ${CRTM_LIBRARY} ) - endif() -endif( NOT CRTM_LIBRARY ) - -if( CORE_INCS ) - list( APPEND CORE_INCS ${CRTMINC} ) -else() - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${CRTMINC} ) -endif() - -set( CRTM_LIBRARY_PATH ${CRTM_LIBRARY} CACHE STRING "CRTM Library Location" ) -set( CRTM_INCLUDE_PATH ${CRTMINC} CACHE STRING "CRTM Include Location" ) - diff --git a/cmake/Modules/FindGSICONTROL.cmake b/cmake/Modules/FindGSICONTROL.cmake deleted file mode 100644 index 5b2e12280a..0000000000 --- a/cmake/Modules/FindGSICONTROL.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# - Find the Control version of GSI to use for regression testing - -set( NO_DEFAULT_PATH ) -message("Control path is ${CONTROLPATH}") -find_file( CONTROL_EXE - NAMES gsi.x global_gsi ${GSIEXEC} - HINTS - ${CONTROLPATH} - ${CONTROLPATH}/bin - ${CONTROLPATH}/exec - $ENV{CONTROLPATH} - $ENV{CONTROLPATH}/bin - $ENV{CONTROLPATH}/exec - $ENV{CONTROLPATH}/src - ${CMAKE_SOURCE_DIR}/../trunk/src - ${CMAKE_SOURCE_DIR}/../../trunk/src - ${PROJECT_BINARY_DIR}/../build-trunk/bin - /da/save/Michael.Lueken/svn1/build/bin - /da/save/Michael.Lueken/svn1/src - /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src - /scratch1/NCEPDEV/da/Michael.Lueken/svn1/build/bin - - ${NO_DEFAULT_PATH}) - -set( GSICONTROL ${CONTROL_EXE} CACHE STRING "GSI control executable for regression testing" FORCE ) - -find_file( ENKF_CONTROL_EXE - NAMES enkf_gfs.x global_enkf ${ENKFEXEC} - HINTS - ${CONTROLPATH} - ${CONTROLPATH}/bin - ${CONTROLPATH}/exec - $ENV{CONTROLPATH} - $ENV{CONTROLPATH}/bin - $ENV{CONTROLPATH}/exec - ${CMAKE_SOURCE_DIR}/../trunk/src/enkf - ${PROJECT_BINARY_DIR}/../build-trunk/bin - $ENV{CONTROLPATH}/enkf - $ENV{CONTROLPATH}/src/enkf - /da/save/Michael.Lueken/svn1/build/bin - /da/save/Michael.Lueken/svn1/src/enkf - /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src/enkf - /scratch1/NCEPDEV/da/Michael.Lueken/svn1/build/bin - - ${NO_DEFAULT_PATH}) - -set( ENKFCONTROL ${ENKF_CONTROL_EXE} CACHE STRING "ENKF control executable for regression testing" FORCE ) - diff --git a/cmake/Modules/FindHDF5.cmake b/cmake/Modules/FindHDF5.cmake deleted file mode 100644 index 78e3db3678..0000000000 --- a/cmake/Modules/FindHDF5.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# This extends CMake's FindHDF5.cmake to add support to include MPI include -# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON -# (BUG #0014363). - -# include the default FindHDF5.cmake. -#if(CMAKE_VERSION VERSION_LESS 3.6.1) -if(CMAKE_VERSION VERSION_GREATER 3.0 ) - include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) -else() - include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) -endif() -#endif() - -if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) - if(MPI_C_INCLUDE_PATH) - list(APPEND HDF5_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) - endif() - if(MPI_C_LIBRARIES) - list(APPEND HDF5_LIBRARIES ${MPI_C_LIBRARIES}) - endif() - if(MPI_CXX_LIBRARIES) - list(APPEND HDF5_LIBRARIES ${MPI_CXX_LIBRARIES}) - endif() -endif() diff --git a/cmake/Modules/FindIP.cmake b/cmake/Modules/FindIP.cmake deleted file mode 100644 index 26ec21704e..0000000000 --- a/cmake/Modules/FindIP.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{IP_VER}) - set(IP_VER $ENV{IP_VER}) - STRING(REGEX REPLACE "v" "" IP_VER ${IP_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_IP ) - if(DEFINED ENV{IP_LIBd} ) - set(IP_LIBRARY $ENV{IP_LIBd} ) - message("IP library ${IP_LIBRARY} set via Environment variable") - else() - find_library( IP_LIBRARY - NAMES libip_d.a libip_i4r8.a libip_v${IP_VER}_d.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/ip/v${IP_VER} - ${COREPATH}/ip/v${IP_VER}/intel - ${COREPATH}/ip/v${IP_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( ip "ip_v${IP_VER}_d") - message("Found IP library ${IP_LIBRARY}") - endif() - if(DEFINED ENV{IP_LIB4} ) - set(IP_4_LIBRARY $ENV{IP_LIB4} ) - message("IP 4 library ${IP_4_LIBRARY} set via Environment variable") - else() - find_library( IP_4_LIBRARY - NAMES libip_4.a libip_i4r4.a libip_v${IP_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/ip/v${IP_VER} - ${COREPATH}/ip/v${IP_VER}/intel - ${COREPATH}/ip/v${IP_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( ip "ip_v${IP_VER}_4") - message("Found IP_4 library ${IP_4_LIBRARY}") - endif() -endif() -if( NOT IP_LIBRARY ) # didn't find the library, so build it from source - message("Could not find IP library, so building from libsrc") - if( NOT DEFINED ENV{IP_SRC} ) - findSrc( "ip" IP_VER IP_DIR ) - else() - set( IP_DIR "$ENV{IP_SRC}/libsrc" CACHE STRING "IP Source Location") - endif() - set( libsuffix "_v${IP_VER}${debug_suffix}" ) - set( IP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libip${libsuffix}.a" CACHE STRING "IP Library" ) - set( IP_4_LIBRARY "${LIBRARY_OUTPUT_PATH}/libip_4${libsuffix}.a" CACHE STRING "IP_4 Library" ) - set( ip "ip${libsuffix}") - set( ip4 "ip_4${libsuffix}") - set( BUILD_IP "ON" CACHE INTERNAL "Build the IP library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/ip) - set( IP_LIBRARY ${ip} ) - set( IP_4_LIBRARY ${ip4} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${IP_LIBRARY} ) - else() - set( CORE_BUILT ${IP_LIBRARY} ) - endif() -else( NOT IP_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${IP_LIBRARY} ) - else() - set( CORE_LIBRARIES ${IP_LIBRARY} ) - endif() -endif( NOT IP_LIBRARY ) - - -set( IP_LIBRARY_PATH ${IP_LIBRARY} CACHE STRING "IP Library Location" ) -set( IP_4_LIBRARY_PATH ${IP_4_LIBRARY} CACHE STRING "IP_4 Library Location" ) - diff --git a/cmake/Modules/FindMPI.cmake b/cmake/Modules/FindMPI.cmake deleted file mode 100644 index 8e0a0c95ba..0000000000 --- a/cmake/Modules/FindMPI.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# This extends CMake's FindHDF5.cmake to add support to include MPI include -# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON -# (BUG #0014363). - -# include the default FindMPI.cmake. -if(CMAKE_VERSION VERSION_LESS 3.1) - include(${CMAKE_ROOT}/Modules/FindMPI.cmake) -elseif(CMAKE_VERSION VERSION_LESS 3.6) - message("Using new FindMPI") - include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindMPI.cmake) -# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") -else() - message("Using installed FindMPI") - include(${CMAKE_ROOT}/Modules/FindMPI.cmake) -# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") - message("include dirs are ${MPI_Fortran_INCLUDE_DIRS}") - message("include PATH ${MPI_Fortran_INCLUDE_PATH}") -endif() diff --git a/cmake/Modules/FindNDATE.cmake b/cmake/Modules/FindNDATE.cmake deleted file mode 100644 index 44bf4f1cd5..0000000000 --- a/cmake/Modules/FindNDATE.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# - Find the NDATE utility or build it - -set( NO_DEFAULT_PATH ) -if(DEFINED ENV{NDATE}) - set(NDATE $ENV{NDATE} ) -else() - find_file( NDATE - NAMES ndate.x ndate - HINTS - /nwprod/util/exec - $ENV{NWPROD}/util/exec - ${NO_DEFAULT_PATH}) -endif() diff --git a/cmake/Modules/FindNEMSIO.cmake b/cmake/Modules/FindNEMSIO.cmake deleted file mode 100644 index 1263fc516a..0000000000 --- a/cmake/Modules/FindNEMSIO.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{NEMSIO_VER}) - set(NEMSIO_VER $ENV{NEMSIO_VER}) - STRING(REGEX REPLACE "v" "" NEMSIO_VER ${NEMSIO_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_NEMSIO ) - if(DEFINED ENV{NEMSIO_LIB} ) - set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} ) - set(NEMSIOINC $ENV{NEMSIO_INC} ) - message("NEMSIO library ${NEMSIO_LIBRARY} set via Environment variable") - else() - findInc( nemsio NEMSIO_VER NEMSIOINC ) - find_library( NEMSIO_LIBRARY - NAMES libnemsio_v${NEMSIO_VER}.a libnemsio.a libNEMSIO.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/nemsio/v${NEMSIO_VER} - ${COREPATH}/nemsio/v${NEMSIO_VER}/intel - ${COREPATH}/nemsio/v${NEMSIO_VER}//ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} - ${COREPATH}/nemsio/v${NEMSIO_VER}//ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( nemsio "nemsio_v${NEMSIO_VER}") - message("Found NEMSIO library ${NEMSIO_LIBRARY}") - endif() -endif() -if( NOT NEMSIO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find NEMSIO library, so building from libsrc") - if( NOT DEFINED ENV{NEMSIO_SRC} ) - findSrc( "nemsio" NEMSIO_VER NEMSIO_DIR ) - set(NEMSIOINC "${CMAKE_BINARY_DIR}/include") - else() - set( NEMSIO_DIR "$ENV{NEMSIO_SRC}/libsrc" CACHE STRING "NEMSIO Source Location") - set(NEMSIOINC "${CORENEMSIO}/nemsio/${NEMSIO_VER}/incmod/nemsio_v${NEMSIO_VER}") - endif() - set( libsuffix "_v${NEMSIO_VER}${debug_suffix}" ) - set( NEMSIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libnemsio${libsuffix}.a" CACHE STRING "NEMSIO Library" ) - set( nemsio "nemsio${libsuffix}") - set( BUILD_NEMSIO "ON" CACHE INTERNAL "Build the NEMSIO library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/nemsio) - set( NEMSIO_LIBRARY ${nemsio} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${NEMSIO_LIBRARY} ) - else() - set( CORE_BUILT ${NEMSIO_LIBRARY} ) - endif() -else( NOT NEMSIO_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${NEMSIO_LIBRARY} ) - else() - set( CORE_LIBRARIES ${NEMSIO_LIBRARY} ) - endif() -endif( NOT NEMSIO_LIBRARY ) - -if( CORE_INCS ) - list( APPEND CORE_INCS ${NEMSIOINC} ) -else() - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${NEMSIOINC} ) -endif() - -set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) -set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) - diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake deleted file mode 100644 index f114c8df86..0000000000 --- a/cmake/Modules/FindNetCDF.cmake +++ /dev/null @@ -1,147 +0,0 @@ -# - Find NetCDF -# Find the native NetCDF includes and library -# -# NETCDF_INCLUDES - where to find netcdf.h, etc -# NETCDF_LIBRARIES - Link these libraries when using NetCDF -# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) -# -# Your package can require certain interfaces to be FOUND by setting these -# -# NETCDF_CXX - require the C++ interface and link the C++ library -# NETCDF_F77 - require the F77 interface and link the fortran library -# NETCDF_F90 - require the F90 interface and link the fortran library -# -# The following are not for general use and are included in -# NETCDF_LIBRARIES if the corresponding option above is set. -# -# NETCDF_LIBRARIES_C - Just the C interface -# NETCDF_LIBRARIES_CXX - C++ interface, if available -# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available -# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available -# -# Normal usage would be: -# set (NETCDF_F90 "YES") -# find_package (NetCDF REQUIRED) -# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES}) -# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C}) - - -set(NETCDF_DIR $ENV{NETCDF}) -message("Enviroment NETCDF is ${NetCDF}") - -if (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - # Already in cache, be silent - set (NETCDF_FIND_QUIETLY TRUE) -endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - -if(DEFINED ENV{NETCDF4}) - message("Enviroment NETCDF4 is ${NetCDF4}") - set(NETCDF_DIR $ENV{NETCDF4}) -elseif(DEFINED ENV{NETCDF_DIR}) - set(NETCDF_DIR $ENV{NETCDF_DIR}) -elseif(DEFINED ENV{NETCDF_HOME}) - set(NETCDF_DIR $ENV{NETCDF_HOME}) -elseif( DEFINED ENV{NETCDF} ) - set(NETCDF_DIR $ENV{NETCDF}) -elseif(DEFINED ENV{SSEC_NETCDF4_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF4_DIR}) -elseif(DEFINED ENV{SSEC_NETCDF_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF_DIR}) -endif() -if(DEFINED ENV{NETCDF_FORTRAN}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN}) -elseif(DEFINED ENV{NETCDF_FORTRAN_DIR}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN_DIR}) -endif() -find_path (NETCDF_INCLUDES netcdf.h - HINTS ${NETCDF_DIR}/include $ENV{SSEC_NETCDF_DIR}/include ) - -find_program (NETCDF_META netcdf_meta.h - HINTS ${NETCDF_INCLUDES} ${CMAKE_INSTALL_PREFIX} - ) -if (NETCDF_META) - file (STRINGS ${NETCDF_META} NETCDF_VERSION REGEX "define NC_VERSION_MAJOR") - string (REGEX REPLACE "#define NC_VERSION_MAJOR " "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE "\\/\\*\\!< netcdf-c major version. \\*\\/" "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE " " "" NETCDF_VERSION ${NETCDF_VERSION} ) - if(${NETCDF_VERSION} GREATER "3") - set(NETCDF_F90 "YES") - endif() -endif (NETCDF_META) - -find_library (NETCDF_flib - names libnetcdff.a netcdff.a libnetcdff.so netcdff.so - HINTS - ${NETCDF_DIR}/lib - ${NETCDF_FORTRAN_DIR}/lib - ${NETCDF_FORTRAN}/lib - ${NETCDF_FORTRAN_ROOT}/lib -) - -if (NETCDF_flib) - set(NETCDF_F90 "YES") - -endif() -find_library (NETCDF_LIBRARIES_C - NAMES netcdf - HINTS ${NETCDF_DIR}/lib ) -mark_as_advanced(NETCDF_LIBRARIES_C) - -if("${NETCDF_DIR}" STREQUAL "") - message(FATAL_ERROR " - Cannot find NETCDF!!!! - - ") -endif() -find_file (NETCDF_NCDUMP - NAMES ncdump - HINTS ${NETCDF_DIR}/bin ) -mark_as_advanced(NETCDF_NCDUMP) -execute_process(COMMAND ${NETCDF_NCDUMP} - ERROR_VARIABLE NCDUMP_INFO) -string(FIND "${NCDUMP_INFO}" "version" VERSION_LOC REVERSE) -math(EXPR VERSION_LOC "${VERSION_LOC} + 9") -string(SUBSTRING "${NCDUMP_INFO}" ${VERSION_LOC} 1 NETCDF_MAJOR_VERSION) -if (${NETCDF_MAJOR_VERSION} LESS 4) - message(FATAL_ERROR " - Current NETCDF is ${NETCDF_DIR} - !!!! NETCDF version 4.0 and above is required !!!! - - ") -endif() - -set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces -set (NetCDF_libs ${NETCDF_LIBRARIES_C} ${NETCDF_LIBRARIES_Fortran}) -message("netcdf_libs is ${NetCDF_libs}") -get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH) - -macro (NetCDF_check_interface lang header libs) - if (NETCDF_${lang}) - find_path (NETCDF_INCLUDES_${lang} NAMES ${header} - HINTS ${NETCDF_INCLUDES} ${NETCDF_FORTRAN}/include NO_DEFAULT_PATH) - find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs} - HINTS ${NetCDF_lib_dirs} ${NETCDF_FORTRAN}/lib NO_DEFAULT_PATH) - mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang}) - if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last - else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - set (NetCDF_has_interfaces "NO") - message (STATUS "Failed to find NetCDF interface for ${lang}") - endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - endif (NETCDF_${lang}) -endmacro (NetCDF_check_interface) - -NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) -NetCDF_check_interface (F77 netcdf.inc netcdff) -NetCDF_check_interface (F90 netcdf.mod netcdff) -if( NETCDF_LIBRARIES_F90 ) - set( NETCDF4 "YES" ) -endif() - -set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level") -# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if -# all listed variables are TRUE -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces) - -mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES) diff --git a/cmake/Modules/FindSFCIO.cmake b/cmake/Modules/FindSFCIO.cmake deleted file mode 100644 index d8928bc210..0000000000 --- a/cmake/Modules/FindSFCIO.cmake +++ /dev/null @@ -1,71 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{SFCIO_VER}) - set(SFCIO_VER $ENV{SFCIO_VER}) - STRING(REGEX REPLACE "v" "" SFCIO_VER ${SFCIO_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_SFCIO ) - if(DEFINED ENV{SFCIO_LIB4} ) - set(SFCIO_LIBRARY $ENV{SFCIO_LIB4} ) - set(SFCIOINC $ENV{SFCIO_INC4} ) - message("SFCIO library ${SFCIO_LIBRARY} set via Environment variable") - else() - findInc( sfcio SFCIO_VER SFCIOINC ) - find_library( SFCIO_LIBRARY - NAMES libsfcio.a libsfcio_4.a libsfcio_i4r4.a libsfcio_v${SFCIO_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sfcio/v${SFCIO_VER} - ${COREPATH}/sfcio/v${SFCIO_VER}/intel - ${COREPATH}/sfcio/v${SFCIO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sfcio "sfcio_v${SFCIO_VER}") - message("Found SFCIO library ${SFCIO_LIBRARY}") - endif() -endif() -if( NOT SFCIO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find SFCIO library, so building from libsrc") - if( NOT DEFINED ENV{SFCIO_SRC} ) - findSrc( "sfcio" SFCIO_VER SFCIO_DIR ) - set(SFCIOINC "${CMAKE_BINARY_DIR}/include") - else() - set( SFCIO_DIR "$ENV{SFCIO_SRC}/libsrc" CACHE STRING "SFCIO Source Location") - set(SFCIOINC "${CORESFCIO}/sfcio/${SFCIO_VER}/incmod/sfcio_v${SFCIO_VER}") - endif() - set( libsuffix "_v${SFCIO_VER}${debug_suffix}" ) - set( SFCIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsfcio${libsuffix}.a" CACHE STRING "SFCIO Library" ) - set( sfcio "sfcio${libsuffix}") - set( BUILD_SFCIO "ON" CACHE INTERNAL "Build the SFCIO library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sfcio) - set( SFCIO_LIBRARY ${sfcio} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SFCIO_LIBRARY} ) - else() - set( CORE_BUILT ${SFCIO_LIBRARY} ) - endif() -else( NOT SFCIO_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${SFCIO_LIBRARY} ) - else() - set( CORE_LIBRARIES ${SFCIO_LIBRARY} ) - endif() -endif( NOT SFCIO_LIBRARY ) - -if( CORE_INCS ) - list( APPEND CORE_INCS ${SFCIOINC} ) -else() - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ) -endif() - -set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) -set( SFCIO_INCLUDE_PATH ${SFCIOINC} CACHE STRING "SFCIO Include Location" ) - diff --git a/cmake/Modules/FindSIGIO.cmake b/cmake/Modules/FindSIGIO.cmake deleted file mode 100644 index 173328c45f..0000000000 --- a/cmake/Modules/FindSIGIO.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{SIGIO_VER}) - set(SIGIO_VER $ENV{SIGIO_VER}) - STRING(REGEX REPLACE "v" "" SIGIO_VER ${SIGIO_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_SIGIO ) - if(DEFINED ENV{SIGIO_LIB4} ) - set(SIGIO_LIBRARY $ENV{SIGIO_LIB4} ) - set(SIGIOINC $ENV{SIGIO_INC4} ) - message("SIGIO library ${SIGIO_LIBRARY} set via Environment variable") - else() - findInc( sigio SIGIO_VER SIGIOINC ) - find_library( SIGIO_LIBRARY - NAMES libsigio.a libsigio_4.a libsigio_i4r4.a libsigio_v${SIGIO_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sigio/v${SIGIO_VER} - ${COREPATH}/sigio/v${SIGIO_VER}/intel - ${COREPATH}/sigio/v${SIGIO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sigio "sigio_v${SIGIO_VER}") - message("Found SIGIO library ${SIGIO_LIBRARY}") - endif() -endif() -if( NOT SIGIO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find SIGIO library, so building from libsrc") - if( NOT DEFINED ENV{SIGIO_SRC} ) - findSrc( "sigio" SIGIO_VER SIGIO_DIR ) - set(SIGIOINC "${CMAKE_BINARY_DIR}/include") - else() - set( SIGIO_DIR "$ENV{SIGIO_SRC}/libsrc" CACHE STRING "SIGIO Source Location") - set(SIGIOINC "${CORESIGIO}/sigio/${SIGIO_VER}/incmod/sigio_v${SIGIO_VER}") - endif() - set( libsuffix "_v${SIGIO_VER}${debug_suffix}" ) - set( SIGIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsigio${libsuffix}.a" CACHE STRING "SIGIO Library" ) - set( sigio "sigio${libsuffix}") - set( BUILD_SIGIO "ON" CACHE INTERNAL "Build the SIGIO library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sigio) - set( SIGIO_LIBRARY ${sigio} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SIGIO_LIBRARY} ) - else() - set( CORE_BUILT ${SIGIO_LIBRARY} ) - endif() -else( NOT SIGIO_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${SIGIO_LIBRARY} ) - else() - set( CORE_LIBRARIES ${SIGIO_LIBRARY} ) - endif() -endif( NOT SIGIO_LIBRARY ) - -if( CORE_INCS ) - list( APPEND CORE_INCS ${SIGIOINC} ) -else() - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SIGIOINC} ) -endif() - - -set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) -set( SIGIO_INCLUDE_PATH ${SIGIOINC} CACHE STRING "SIGIO Include Location" ) - diff --git a/cmake/Modules/FindSP.cmake b/cmake/Modules/FindSP.cmake deleted file mode 100644 index b5fba97341..0000000000 --- a/cmake/Modules/FindSP.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{SP_VER}) - set(SP_VER $ENV{SP_VER}) - STRING(REGEX REPLACE "v" "" SP_VER ${SP_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_SP ) - if(DEFINED ENV{SP_LIBd} ) - set(SP_LIBRARY $ENV{SP_LIBd} ) - message("SP library ${SP_LIBRARY} set via Environment variable") - else() - find_library( SP_LIBRARY - NAMES libsp_d.a libsp_i4r8.a libsp_v${SP_VER}_d.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sp/v${SP_VER} - ${COREPATH}/sp/v${SP_VER}/intel - ${COREPATH}/sp/v${SP_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sp "sp_v${SP_VER}_d") - message("Found SP library ${SP_LIBRARY}") - endif() - if(DEFINED ENV{SP_LIB4} ) - set(SP_4_LIBRARY $ENV{SP_LIB4} ) - message("SP library ${SP_4_LIBRARY} set via Environment variable") - else() - find_library( SP_4_LIBRARY - NAMES libsp_4.a libsp_i4r4.a libsp_v${SP_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/sp/v${SP_VER} - ${COREPATH}/sp/v${SP_VER}/intel - ${COREPATH}/sp/v${SP_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - set( sp "sp_v${SP_VER}_4") - message("Found SP_4 library ${SP_4_LIBRARY}") - endif() -endif() -if( NOT SP_LIBRARY ) # didn't find the library, so build it from source - message("Could not find SP library, so building from libsrc") - if( NOT DEFINED ENV{SP_SRC} ) - findSrc( "sp" SP_VER SP_DIR ) - else() - set( SP_DIR "$ENV{SP_SRC}/libsrc" CACHE STRING "SP Source Location") - endif() - set( libsuffix "_v${SP_VER}${debug_suffix}" ) - set( SP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp${libsuffix}.a" CACHE STRING "SP Library" ) - set( SP_4_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp_4${libsuffix}.a" CACHE STRING "SP_4 Library" ) - set( sp "sp${libsuffix}") - set( sp4 "sp_4${libsuffix}") - set( BUILD_SP "ON" CACHE INTERNAL "Build the SP library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sp) - set( SP_LIBRARY ${sp} ) - set( SP_4_LIBRARY ${sp4} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SP_LIBRARY} ) - else() - set( CORE_BUILT ${SP_LIBRARY} ) - endif() -else( NOT SP_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${SP_LIBRARY} ) - else() - set( CORE_LIBRARIES ${SP_LIBRARY} ) - endif() -endif( NOT SP_LIBRARY ) - - -set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) -set( SP_4_LIBRARY_PATH ${SP_4_LIBRARY} CACHE STRING "SP_4 Library Location" ) - diff --git a/cmake/Modules/FindW3EMC.cmake b/cmake/Modules/FindW3EMC.cmake deleted file mode 100644 index 3cbce42a6d..0000000000 --- a/cmake/Modules/FindW3EMC.cmake +++ /dev/null @@ -1,124 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{W3EMC_VER}) - set(W3EMC_VER $ENV{W3EMC_VER}) - set(W3EMCINC $ENV{W3EMC_INCd} ) - set(W3EMC4INC $ENV{W3EMC_INC4} ) - STRING(REGEX REPLACE "v" "" W3EMC_VER ${W3EMC_VER}) -endif() -if(DEFINED ENV{W3EMC_LIBd}) - set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} ) - set(W3EMCINC $ENV{W3EMC_INCd} ) - set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} ) - set(W3EMC4INC $ENV{W3EMC_INC4} ) - message("Setting W3EMC library via environment variable ${W3EMC_LIBRARY}") -endif() - -set( NO_DEFAULT_PATH ) -if((NOT BUILD_W3EMC ) AND ( NOT DEFINED W3EMC_LIBRARY )) - if(DEFINED ENV{W3EMC_LIB} ) - set(W3EMC_LIBRARY $ENV{W3EMC_LIB} ) - set(W3EMCINC $ENV{W3EMC_INC} ) - set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} ) - set(W3EMC4INC $ENV{W3EMC_INC4} ) - message("W3EMC library ${W3EMC_LIBRARY} set via Environment variable") - message("W3EMC_4 library ${W3EMC_4_LIBRARY} set via Environment variable") - else() - find_path( W3EMCINC - NAMES mersenne_twister.mod - HINTS - $ENV{COREPATH}/lib/incmod/w3emc_d - $ENV{COREPATH}/include - /usr/local/jcsda/nwprod_gdas_2014/lib/incmod/w3emc_d - ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_d - ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_d - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_d - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_d - ) - find_path( W3EMC4INC - NAMES mersenne_twister.mod - HINTS - $ENV{COREPATH}/lib/incmod/w3emc_4 - $ENV{COREPATH}/include - /usr/local/jcsda/nwprod_gdas_2014/lib/incmod/w3emc_4 - ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_4 - ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_4 - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_4 - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_4 - ) - find_library( W3EMC_LIBRARY - NAMES libw3emc_d.a libw3emc_v${W3EMC_VER}_d.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014 - ${COREPATH}/w3emc/v${W3EMC_VER} - ${COREPATH}/w3emc/v${W3EMC_VER}/intel - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - find_library( W3EMC_4_LIBRARY - NAMES libw3emc_4.a libw3emc_i4r4.a libw3emc_v${W3EMC_VER}_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014 - ${COREPATH}/w3emc/v${W3EMC_VER} - ${COREPATH}/w3emc/v${W3EMC_VER}/intel - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} - ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - message("Found W3EMC_4 library ${W3EMC_4_LIBRARY}") - endif() -endif() -if( NOT W3EMC_LIBRARY ) # didn't find the library, so build it from source - message("Could not find W3EMC library, so building from libsrc") - if( NOT DEFINED ENV{W3EMC_SRC} ) - findSrc( "w3emc" W3EMC_VER W3EMC_DIR ) - set(W3EMCINC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC Include Directory") - set(W3EMC4INC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC4 Include Directory") - else() - set( W3EMC_DIR "$ENV{W3EMC_SRC}/libsrc" CACHE STRING "W3EMC Source Location") - endif() - set( libsuffix "_v${W3EMC_VER}${debug_suffix}" ) - set( W3EMC_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3emc${libsuffix}.a" CACHE STRING "W3EMC Library" ) - set( w3emc "w3emc${libsuffix}") - set( w3emc4 "w3emc_4${libsuffix}") - set( BUILD_W3EMC "ON" CACHE INTERNAL "Build the W3EMC library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/w3emc) - set( W3EMC_LIBRARY ${w3emc} ) - set( W3EMC_4_LIBRARY ${w3emc} ) - set(W3EMCINC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC Include Directory") - set(W3EMC4INC ${CMAKE_INCLUDE_4_OUTPUT_DIRECTORY} CACHE STRING "W3EMC4 Include Directory") - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${W3EMC_LIBRARY} ) - list( APPEND CORE_BUILT ${W3EMC_4_LIBRARY} ) - else() - set( CORE_BUILT ${W3EMC_LIBRARY} ) - set( CORE_BUILT ${W3EMC_4_LIBRARY} ) - endif() -else( NOT W3EMC_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${W3EMC_LIBRARY} ) - else() - set( CORE_LIBRARIES ${W3EMC_LIBRARY} ) - endif() -endif( NOT W3EMC_LIBRARY ) - -if( CORE_INCS ) - list( APPEND CORE_INCS ${W3EMCINC} ) -else() - set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${W3EMCINC} ) -endif() - -set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) -set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) -set( W3EMC_4_LIBRARY_PATH ${W3EMC_4_LIBRARY} CACHE STRING "W3EMC_4 Library Location" ) -set( W3EMC_INCLUDE_4_PATH ${W3EMC4INC} CACHE STRING "W3EMC_4 Include Location" ) - diff --git a/cmake/Modules/FindW3NCO.cmake b/cmake/Modules/FindW3NCO.cmake deleted file mode 100644 index aef2126c8f..0000000000 --- a/cmake/Modules/FindW3NCO.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# This module defines -# CORE_INCS -# List of include file paths for all required modules for GSI -# CORE_LIBRARIES -# Full list of libraries required to link GSI executable -include(findHelpers) -if(DEFINED ENV{W3NCO_VER}) - set(W3NCO_VER $ENV{W3NCO_VER}) - STRING(REGEX REPLACE "v" "" W3NCO_VER ${W3NCO_VER}) -endif() - -set( NO_DEFAULT_PATH ) -if(NOT BUILD_W3NCO ) - if(DEFINED ENV{W3NCO_LIBd} ) - set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} ) - set(W3NCO_4_LIBRARY $ENV{W3NCO_LIB4} ) - message("W3NCO library ${W3NCO_LIBRARY} set via Environment variable") - message("W3NCO_4 library ${W3NCO_4_LIBRARY} set via Environment variable") - else() - find_library( W3NCO_LIBRARY - NAMES libw3nco_v${W3NCO_VER}_d.a libw3nco_d.a libw3nco_i4r8.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/w3nco/v${W3NCO_VER} - ${COREPATH}/w3nco/v${W3NCO_VER}/intel - ${COREPATH}/w3nco/v${W3NCO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - message("Found W3NCO library ${W3NCO_LIBRARY}") - set( w3nco ${W3NCO_LIBRARY}) - - find_library( W3NCO_4_LIBRARY - NAMES libw3nco_v${W3NCO_VER}_4.a libw3nco_4.a - HINTS - $ENV{COREPATH}/lib - /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/w3nco/v${W3NCO_VER} - ${COREPATH}/w3nco/v${W3NCO_VER}/intel - ${COREPATH}/w3nco/v${W3NCO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH}) - message("Found W3NCO_4 library ${W3NCO_4_LIBRARY}") - set( w3nco4 ${W3NCO_4_LIBRARY}) - endif() -endif() -if( NOT W3NCO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find W3NCO library, so building from libsrc") - if( NOT DEFINED ENV{W3NCO_SRC} ) - findSrc( "w3nco" W3NCO_VER W3NCO_DIR ) - else() - set( W3NCO_DIR "$ENV{W3NCO_SRC}/libsrc" CACHE STRING "W3NCO Source Location") - endif() - set( libsuffix "_v${W3NCO_VER}${debug_suffix}" ) - set( W3NCO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3nco${libsuffix}.a" CACHE STRING "W3NCO Library" ) - set( w3nco "w3nco${libsuffix}") - set( w3nco4 "w3nco_4${libsuffix}") - set( BUILD_W3NCO "ON" CACHE INTERNAL "Build the W3NCO library") - add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/w3nco) - set( W3NCO_LIBRARY ${w3nco} ) - set( W3NCO_4_LIBRARY ${w3nco4} ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${W3NCO_LIBRARY} ) - list( APPEND CORE_BUILT ${W3NCO_4_LIBRARY} ) - else() - set( CORE_BUILT ${W3NCO_LIBRARY} ) - set( CORE_BUILT ${W3NCO_4_LIBRARY} ) - endif() -else( NOT W3NCO_LIBRARY ) - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${W3NCO_LIBRARY} ) - else() - set( CORE_LIBRARIES ${W3NCO_LIBRARY} ) - endif() -endif( NOT W3NCO_LIBRARY ) - -set( W3NCO_DIR ${CMAKE_SOURCE_DIR}/libsrc/w3nco CACHE STRING "W3NCO Source Location") -set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) - diff --git a/cmake/Modules/FindWRF.cmake b/cmake/Modules/FindWRF.cmake deleted file mode 100644 index 43faf46643..0000000000 --- a/cmake/Modules/FindWRF.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# - Find the WRF modules - -set( NO_DEFAULT_PATH ) -find_library( IOINT_LIB - NAMES libwrfio_int.a - HINTS - ${WRFPATH}/external/io_int - $ENV{WRFPATH}/external/io_int - /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_int - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_int - ${NO_DEFAULT_PATH}) - -find_library( WRFNETCDF_LIB - NAMES libwrfio_nf.a - HINTS - ${WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf - $ENV{WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_netcdf - ${NO_DEFAULT_PATH}) -find_file( FRAMEPACK - NAMES pack_utils.o - HINTS - ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame - ${NO_DEFAULT_PATH}) -find_file( FRAMEMODULE - NAMES module_machine.o - HINTS - ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame - ${NO_DEFAULT_PATH}) - -set( WRF_LIBRARIES ${IOINT_LIB} ${WRFNETCDF_LIB} ${FRAMEPACK} ${FRAMEMODULE} ) - diff --git a/cmake/Modules/NewCMake/CMakeParseArguments.cmake b/cmake/Modules/NewCMake/CMakeParseArguments.cmake deleted file mode 100644 index 7ee2bbacef..0000000000 --- a/cmake/Modules/NewCMake/CMakeParseArguments.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CMakeParseArguments -# ------------------- -# -# This module once implemented the :command:`cmake_parse_arguments` command -# that is now implemented natively by CMake. It is now an empty placeholder -# for compatibility with projects that include it to get the command from -# CMake 3.4 and lower. diff --git a/cmake/Modules/NewCMake/FindHDF5.cmake b/cmake/Modules/NewCMake/FindHDF5.cmake deleted file mode 100644 index fd8891cf20..0000000000 --- a/cmake/Modules/NewCMake/FindHDF5.cmake +++ /dev/null @@ -1,934 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindHDF5 -# -------- -# -# Find HDF5, a library for reading and writing self describing array data. -# -# -# -# This module invokes the HDF5 wrapper compiler that should be installed -# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper -# compiler is called either h5cc or h5pcc. If this succeeds, the module -# will then call the compiler with the -show argument to see what flags -# are used when compiling an HDF5 client application. -# -# The module will optionally accept the COMPONENTS argument. If no -# COMPONENTS are specified, then the find module will default to finding -# only the HDF5 C library. If one or more COMPONENTS are specified, the -# module will attempt to find the language bindings for the specified -# components. The only valid components are C, CXX, Fortran, HL, and -# Fortran_HL. If the COMPONENTS argument is not given, the module will -# attempt to find only the C bindings. -# -# This module will read the variable -# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a -# static link to a dynamic link for HDF5 and all of it's dependencies. -# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES -# variable is set before the call to find_package. -# -# To provide the module with a hint about where to find your HDF5 -# installation, you can set the environment variable HDF5_ROOT. The -# Find module will then look in this path when searching for HDF5 -# executables, paths, and libraries. -# -# Both the serial and parallel HDF5 wrappers are considered and the first -# directory to contain either one will be used. In the event that both appear -# in the same directory the serial version is preferentially selected. This -# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to -# true. -# -# In addition to finding the includes and libraries required to compile -# an HDF5 client application, this module also makes an effort to find -# tools that come with the HDF5 distribution that may be useful for -# regression testing. -# -# This module will define the following variables: -# -# :: -# -# HDF5_FOUND - true if HDF5 was found on the system -# HDF5_VERSION - HDF5 version in format Major.Minor.Release -# HDF5_INCLUDE_DIRS - Location of the hdf5 includes -# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) -# HDF5_DEFINITIONS - Required compiler definitions for HDF5 -# HDF5_LIBRARIES - Required libraries for all requested bindings -# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all -# bindings, if the HL component is enabled -# -# Available components are: C CXX Fortran and HL. For each enabled language -# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially -# HDF5_${LANG}_DEFINITIONS, will be defined. -# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will -# also be defined. With all components enabled, the following variables will be defined: -# -# :: -# -# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings -# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings -# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings -# HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings -# HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings -# HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings -# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings -# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings -# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings -# HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings -# HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings -# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran -# bindings. -# -# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support -# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler -# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler -# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler -# HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler -# which is also the HDF5 wrapper -# HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++ -# compiler which is also -# the HDF5 wrapper -# HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary -# Fortran compiler which -# is also the HDF5 wrapper -# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool -# -# The following variable can be set to guide the search for HDF5 libraries and includes: -# -# ``HDF5_ROOT`` -# Specify the path to the HDF5 installation to use. -# -# ``HDF5_FIND_DEBUG`` -# Set to a true value to get some extra debugging output. -# -# ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE`` -# Set to a true value to skip trying to find ``hdf5-config.cmake``. - -# This module is maintained by Will Dicharry . - -include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -# List of the valid HDF5 components -set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran) - -# Validate the list of find components. -if(NOT HDF5_FIND_COMPONENTS) - set(HDF5_LANGUAGE_BINDINGS "C") -else() - set(HDF5_LANGUAGE_BINDINGS) - # add the extra specified components, ensuring that they are valid. - set(FIND_HL OFF) - foreach(component IN LISTS HDF5_FIND_COMPONENTS) - list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location) - if(NOT component_location EQUAL -1) - list(APPEND HDF5_LANGUAGE_BINDINGS ${component}) - elseif(component STREQUAL "HL") - set(FIND_HL ON) - elseif(component STREQUAL "Fortran_HL") # only for compatibility - list(APPEND HDF5_LANGUAGE_BINDINGS Fortran) - set(FIND_HL ON) - set(HDF5_FIND_REQUIRED_Fortran_HL False) - set(HDF5_FIND_REQUIRED_Fortran True) - set(HDF5_FIND_REQUIRED_HL True) - else() - message(FATAL_ERROR "${component} is not a valid HDF5 component.") - endif() - endforeach() - if(NOT HDF5_LANGUAGE_BINDINGS) - get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) - foreach(__lang IN LISTS __langs) - if(__lang MATCHES "^(C|CXX|Fortran)$") - list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang}) - endif() - endforeach() - endif() - list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL - list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS) -endif() - -# Determine whether to search for serial or parallel executable first -if(HDF5_PREFER_PARALLEL) - set(HDF5_C_COMPILER_NAMES h5pcc h5cc) - set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++) - set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc) -else() - set(HDF5_C_COMPILER_NAMES h5cc h5pcc) - set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++) - set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) -endif() - -# We may have picked up some duplicates in various lists during the above -# process for the language bindings (both the C and C++ bindings depend on -# libz for example). Remove the duplicates. It appears that the default -# CMake behavior is to remove duplicates from the end of a list. However, -# for link lines, this is incorrect since unresolved symbols are searched -# for down the link line. Therefore, we reverse the list, remove the -# duplicates, and then reverse it again to get the duplicates removed from -# the beginning. -macro(_HDF5_remove_duplicates_from_beginning _list_name) - if(${_list_name}) - list(REVERSE ${_list_name}) - list(REMOVE_DUPLICATES ${_list_name}) - list(REVERSE ${_list_name}) - endif() -endmacro() - - -# Test first if the current compilers automatically wrap HDF5 - -function(_HDF5_test_regular_compiler_C success version is_parallel) - set(scratch_directory - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if(NOT ${success} OR - NOT EXISTS ${scratch_directory}/compiler_has_h5_c) - set(test_file ${scratch_directory}/cmake_hdf5_test.c) - file(WRITE ${test_file} - "#include \n" - "#include \n" - "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" - "#ifdef H5_HAVE_PARALLEL\n" - "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" - "#endif\n" - "int main(int argc, char **argv) {\n" - " int require = 0;\n" - " require += info_ver[argc];\n" - "#ifdef H5_HAVE_PARALLEL\n" - " require += info_parallel[argc];\n" - "#endif\n" - " hid_t fid;\n" - " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n" - " return 0;\n" - "}") - try_compile(${success} ${scratch_directory} ${test_file} - COPY_FILE ${scratch_directory}/compiler_has_h5_c - ) - endif() - if(${success}) - file(STRINGS ${scratch_directory}/compiler_has_h5_c INFO_STRINGS - REGEX "^INFO:" - ) - string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" - INFO_VER "${INFO_STRINGS}" - ) - set(${version} ${CMAKE_MATCH_1}) - if(CMAKE_MATCH_3) - set(${version} ${HDF5_C_VERSION}.${CMAKE_MATCH_3}) - endif() - set(${version} ${${version}} PARENT_SCOPE) - - if(INFO_STRINGS MATCHES "INFO:PARALLEL") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() -endfunction() - -function(_HDF5_test_regular_compiler_CXX success version is_parallel) - set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if(NOT ${success} OR - NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx) - set(test_file ${scratch_directory}/cmake_hdf5_test.cxx) - file(WRITE ${test_file} - "#include \n" - "#ifndef H5_NO_NAMESPACE\n" - "using namespace H5;\n" - "#endif\n" - "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" - "#ifdef H5_HAVE_PARALLEL\n" - "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" - "#endif\n" - "int main(int argc, char **argv) {\n" - " int require = 0;\n" - " require += info_ver[argc];\n" - "#ifdef H5_HAVE_PARALLEL\n" - " require += info_parallel[argc];\n" - "#endif\n" - " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n" - " return 0;\n" - "}") - try_compile(${success} ${scratch_directory} ${test_file} - COPY_FILE ${scratch_directory}/compiler_has_h5_cxx - ) - endif() - if(${success}) - file(STRINGS ${scratch_directory}/compiler_has_h5_cxx INFO_STRINGS - REGEX "^INFO:" - ) - string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" - INFO_VER "${INFO_STRINGS}" - ) - set(${version} ${CMAKE_MATCH_1}) - if(CMAKE_MATCH_3) - set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) - endif() - set(${version} ${${version}} PARENT_SCOPE) - - if(INFO_STRINGS MATCHES "INFO:PARALLEL") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() -endfunction() - -function(_HDF5_test_regular_compiler_Fortran success is_parallel) - if(NOT ${success}) - set(scratch_directory - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - set(test_file ${scratch_directory}/cmake_hdf5_test.f90) - file(WRITE ${test_file} - "program hdf5_hello\n" - " use hdf5\n" - " use h5lt\n" - " use h5ds\n" - " integer error\n" - " call h5open_f(error)\n" - " call h5close_f(error)\n" - "end\n") - try_compile(${success} ${scratch_directory} ${test_file}) - if(${success}) - execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig - OUTPUT_VARIABLE config_output - ERROR_VARIABLE config_error - RESULT_VARIABLE config_result - ) - if(config_output MATCHES "Parallel HDF5: yes") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() - endif() -endfunction() - -# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the -# return_value argument, the text output is stored to the output variable. -macro( _HDF5_invoke_compiler language output return_value version is_parallel) - set(${version}) - if(HDF5_USE_STATIC_LIBRARIES) - set(lib_type_args -noshlib) - else() - set(lib_type_args -shlib) - endif() - set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if("${language}" STREQUAL "C") - set(test_file ${scratch_dir}/cmake_hdf5_test.c) - elseif("${language}" STREQUAL "CXX") - set(test_file ${scratch_dir}/cmake_hdf5_test.cxx) - elseif("${language}" STREQUAL "Fortran") - set(test_file ${scratch_dir}/cmake_hdf5_test.f90) - endif() - exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} - ARGS -show ${lib_type_args} ${test_file} - OUTPUT_VARIABLE ${output} - RETURN_VALUE ${return_value} - ) - if(NOT ${${return_value}} EQUAL 0) - message(STATUS - "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") - endif() - exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} - ARGS -showconfig - OUTPUT_VARIABLE config_output - RETURN_VALUE config_return - ) - if(NOT ${return_value} EQUAL 0) - message( STATUS - "Unable to determine HDF5 ${language} version from HDF5 wrapper.") - endif() - string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}") - if(version_match) - string(REPLACE "HDF5 Version: " "" ${version} "${version_match}") - string(REPLACE "-patch" "." ${version} "${${version}}") - endif() - if(config_output MATCHES "Parallel HDF5: yes") - set(${is_parallel} TRUE) - else() - set(${is_parallel} FALSE) - endif() -endmacro() - -# Parse a compile line for definitions, includes, library paths, and libraries. -macro( _HDF5_parse_compile_line - compile_line_var - include_paths - definitions - library_paths - libraries - libraries_hl) - - separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}") - - foreach(arg IN LISTS _HDF5_COMPILE_ARGS) - if("${arg}" MATCHES "^-I(.*)$") - # include directory - list(APPEND ${include_paths} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-D(.*)$") - # compile definition - list(APPEND ${definitions} "-D${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-L(.*)$") - # library search path - list(APPEND ${library_paths} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$") - # library name (hl) - list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-l(.*)$") - # library name - list(APPEND ${libraries} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$") - # library file - if(NOT EXISTS "${arg}") - continue() - endif() - get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY) - get_filename_component(_HDF5_LNAME "${arg}" NAME_WE) - string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}") - list(APPEND ${library_paths} "${_HDF5_LPATH}") - if(_HDF5_LNAME MATCHES "hdf5.*hl") - list(APPEND ${libraries_hl} "${_HDF5_LNAME}") - else() - list(APPEND ${libraries} "${_HDF5_LNAME}") - endif() - endif() - endforeach() -endmacro() - -# Select a preferred imported configuration from a target -function(_HDF5_select_imported_config target imported_conf) - # We will first assign the value to a local variable _imported_conf, then assign - # it to the function argument at the end. - get_target_property(_imported_conf ${target} MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE}) - if (NOT _imported_conf) - # Get available imported configurations by examining target properties - get_target_property(_imported_conf ${target} IMPORTED_CONFIGURATIONS) - if(HDF5_FIND_DEBUG) - message(STATUS "Found imported configurations: ${_imported_conf}") - endif() - # Find the imported configuration that we prefer. - # We do this by making list of configurations in order of preference, - # starting with ${CMAKE_BUILD_TYPE} and ending with the first imported_conf - set(_preferred_confs ${CMAKE_BUILD_TYPE}) - list(GET _imported_conf 0 _fallback_conf) - list(APPEND _preferred_confs RELWITHDEBINFO RELEASE DEBUG ${_fallback_conf}) - if(HDF5_FIND_DEBUG) - message(STATUS "Start search through imported configurations in the following order: ${_preferred_confs}") - endif() - # Now find the first of these that is present in imported_conf - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) # support IN_LISTS - foreach (_conf IN LISTS _preferred_confs) - if (${_conf} IN_LIST _imported_conf) - set(_imported_conf ${_conf}) - break() - endif() - endforeach() - cmake_policy(POP) - endif() - if(HDF5_FIND_DEBUG) - message(STATUS "Selected imported configuration: ${_imported_conf}") - endif() - # assign value to function argument - set(${imported_conf} ${_imported_conf} PARENT_SCOPE) -endfunction() - - -if(NOT HDF5_ROOT) - set(HDF5_ROOT $ENV{HDF5_ROOT}) -endif() -if(HDF5_ROOT) - set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH) -else() - set(_HDF5_SEARCH_OPTS) -endif() - -# Try to find HDF5 using an installed hdf5-config.cmake -if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE) - find_package(HDF5 QUIET NO_MODULE - HINTS ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS} - ) - if( HDF5_FOUND) - if(HDF5_FIND_DEBUG) - message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.") - endif() - set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL}) - set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) - set(HDF5_LIBRARIES) - if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared) - # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc - set(_target_prefix "hdf5::") - endif() - set(HDF5_C_TARGET ${_target_prefix}hdf5) - set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl) - set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp) - set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp) - set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran) - set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran) - set(HDF5_DEFINITIONS "") - if(HDF5_USE_STATIC_LIBRARIES) - set(_suffix "-static") - else() - set(_suffix "-shared") - endif() - foreach(_lang ${HDF5_LANGUAGE_BINDINGS}) - - #Older versions of hdf5 don't have a static/shared suffix so - #if we detect that occurrence clear the suffix - if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix}) - if(NOT TARGET ${HDF5_${_lang}_TARGET}) - #cant find this component with or without the suffix - #so bail out, and let the following locate HDF5 - set(HDF5_FOUND FALSE) - break() - endif() - set(_suffix "") - endif() - - if(HDF5_FIND_DEBUG) - message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}") - endif() - # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib. - _HDF5_select_imported_config(${HDF5_${_lang}_TARGET}${_suffix} _hdf5_imported_conf) - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) - if (NOT _hdf5_lang_location) - # no import lib, just try LOCATION - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) - if (NOT _hdf5_lang_location) - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION) - endif() - endif() - if( _hdf5_lang_location ) - set(HDF5_${_lang}_LIBRARY ${_hdf5_lang_location}) - list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) - set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) - set(HDF5_${_lang}_FOUND True) - endif() - if(FIND_HL) - get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) - if (NOT _hdf5_lang_hl_location) - get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) - if (NOT _hdf5_hl_lang_location) - get_target_property(_hdf5_hl_lang_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION) - endif() - endif() - if( _hdf5_lang_hl_location ) - set(HDF5_${_lang}_HL_LIBRARY ${_hdf5_lang_hl_location}) - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) - set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) - set(HDF5_HL_FOUND True) - endif() - unset(_hdf5_lang_hl_location) - endif() - unset(_hdf5_imported_conf) - unset(_hdf5_lang_location) - endforeach() - endif() -endif() - -if(NOT HDF5_FOUND) - set(_HDF5_NEED_TO_SEARCH False) - set(HDF5_COMPILER_NO_INTERROGATE True) - # Only search for languages we've enabled - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - # First check to see if our regular compiler is one of wrappers - if(__lang STREQUAL "C") - _HDF5_test_regular_compiler_C( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION - HDF5_${__lang}_IS_PARALLEL) - elseif(__lang STREQUAL "CXX") - _HDF5_test_regular_compiler_CXX( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION - HDF5_${__lang}_IS_PARALLEL) - elseif(__lang STREQUAL "Fortran") - _HDF5_test_regular_compiler_Fortran( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_IS_PARALLEL) - else() - continue() - endif() - if(HDF5_${__lang}_COMPILER_NO_INTERROGATE) - message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling") - set(HDF5_${__lang}_FOUND True) - set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE - "${CMAKE_${__lang}_COMPILER}" - CACHE FILEPATH "HDF5 ${__lang} compiler wrapper") - set(HDF5_${__lang}_DEFINITIONS) - set(HDF5_${__lang}_INCLUDE_DIRS) - set(HDF5_${__lang}_LIBRARIES) - set(HDF5_${__lang}_HL_LIBRARIES) - - mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE) - - set(HDF5_${__lang}_FOUND True) - set(HDF5_HL_FOUND True) - else() - set(HDF5_COMPILER_NO_INTERROGATE False) - # If this language isn't using the wrapper, then try to seed the - # search options with the wrapper - find_program(HDF5_${__lang}_COMPILER_EXECUTABLE - NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR - HINTS ${HDF5_ROOT} - PATH_SUFFIXES bin Bin - DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags." - ${_HDF5_SEARCH_OPTS} - ) - mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE ) - unset(HDF5_${__lang}_COMPILER_NAMES) - - if(HDF5_${__lang}_COMPILER_EXECUTABLE) - _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE - HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL) - if(HDF5_${__lang}_RETURN_VALUE EQUAL 0) - message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration") - _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE - HDF5_${__lang}_INCLUDE_DIRS - HDF5_${__lang}_DEFINITIONS - HDF5_${__lang}_LIBRARY_DIRS - HDF5_${__lang}_LIBRARY_NAMES - HDF5_${__lang}_HL_LIBRARY_NAMES - ) - set(HDF5_${__lang}_LIBRARIES) - - foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES) - set(_HDF5_SEARCH_NAMES_LOCAL) - if("x${L}" MATCHES "hdf5") - # hdf5 library - set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) - if(HDF5_USE_STATIC_LIBRARIES) - if(WIN32) - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) - else() - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) - endif() - endif() - else() - # external library - set(_HDF5_SEARCH_OPTS_LOCAL) - endif() - find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR - HINTS ${HDF5_${__lang}_LIBRARY_DIRS} - ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS_LOCAL} - ) - unset(_HDF5_SEARCH_OPTS_LOCAL) - unset(_HDF5_SEARCH_NAMES_LOCAL) - if(HDF5_${__lang}_LIBRARY_${L}) - list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) - else() - list(APPEND HDF5_${__lang}_LIBRARIES ${L}) - endif() - endforeach() - if(FIND_HL) - set(HDF5_${__lang}_HL_LIBRARIES) - foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) - set(_HDF5_SEARCH_NAMES_LOCAL) - if("x${L}" MATCHES "hdf5") - # hdf5 library - set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) - if(HDF5_USE_STATIC_LIBRARIES) - if(WIN32) - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) - else() - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) - endif() - endif() - else() - # external library - set(_HDF5_SEARCH_OPTS_LOCAL) - endif() - find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR - HINTS ${HDF5_${__lang}_LIBRARY_DIRS} - ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS_LOCAL} - ) - unset(_HDF5_SEARCH_OPTS_LOCAL) - unset(_HDF5_SEARCH_NAMES_LOCAL) - if(HDF5_${__lang}_LIBRARY_${L}) - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) - else() - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L}) - endif() - endforeach() - set(HDF5_HL_FOUND True) - endif() - - set(HDF5_${__lang}_FOUND True) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES) - else() - set(_HDF5_NEED_TO_SEARCH True) - endif() - else() - set(_HDF5_NEED_TO_SEARCH True) - endif() - endif() - if(HDF5_${__lang}_VERSION) - if(NOT HDF5_VERSION) - set(HDF5_VERSION ${HDF5_${__lang}_VERSION}) - elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION) - message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}") - endif() - endif() - if(DEFINED HDF5_${__lang}_IS_PARALLEL) - if(NOT DEFINED HDF5_IS_PARALLEL) - set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL}) - elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL) - message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.") - elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL) - message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.") - endif() - endif() - endforeach() -else() - set(_HDF5_NEED_TO_SEARCH True) -endif() - -if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE) - # No arguments necessary, all languages can use the compiler wrappers - set(HDF5_FOUND True) - set(HDF5_METHOD "Included by compiler wrappers") - set(HDF5_REQUIRED_VARS HDF5_METHOD) -elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH) - # Compiler wrappers aren't being used by the build but were found and used - # to determine necessary include and library flags - set(HDF5_INCLUDE_DIRS) - set(HDF5_LIBRARIES) - set(HDF5_HL_LIBRARIES) - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - if(HDF5_${__lang}_FOUND) - if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE) - list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS}) - list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS}) - list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) - if(FIND_HL) - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) - endif() - endif() - endif() - endforeach() - _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) - set(HDF5_FOUND True) - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES) - if(FIND_HL) - list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) - endif() -endif() - -find_program( HDF5_DIFF_EXECUTABLE - NAMES h5diff - HINTS ${HDF5_ROOT} - PATH_SUFFIXES bin Bin - ${_HDF5_SEARCH_OPTS} - DOC "HDF5 file differencing tool." ) -mark_as_advanced( HDF5_DIFF_EXECUTABLE ) - -if( NOT HDF5_FOUND ) - # seed the initial lists of libraries to find with items we know we need - set(HDF5_C_LIBRARY_NAMES hdf5) - set(HDF5_C_HL_LIBRARY_NAMES hdf5_hl) - - set(HDF5_CXX_LIBRARY_NAMES hdf5_cpp ${HDF5_C_LIBRARY_NAMES}) - set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES}) - - set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES}) - set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES}) - - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - # find the HDF5 include directories - if("${__lang}" STREQUAL "Fortran") - set(HDF5_INCLUDE_FILENAME hdf5.mod) - elseif("${__lang}" STREQUAL "CXX") - set(HDF5_INCLUDE_FILENAME H5Cpp.h) - else() - set(HDF5_INCLUDE_FILENAME hdf5.h) - endif() - - find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} - HINTS ${HDF5_ROOT} - PATHS $ENV{HOME}/.local/include - PATH_SUFFIXES include Include - ${_HDF5_SEARCH_OPTS} - ) - mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR) - # set the _DIRS variable as this is what the user will normally use - set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) - list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) - - # find the HDF5 libraries - foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES) - if(HDF5_USE_STATIC_LIBRARIES) - # According to bug 1643 on the CMake bug tracker, this is the - # preferred method for searching for a static library. - # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search - # first for the full static library name, but fall back to a - # generic search on the name if the static search fails. - set( THIS_LIBRARY_SEARCH_DEBUG - lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug - lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_D-static ${LIB}_debug-static ) - set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a ${LIB}-static) - else() - set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) - set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) - if(WIN32) - list(APPEND HDF5_DEFINITIONS "-DH5_BUILT_AS_DYNAMIC_LIB") - endif() - endif() - find_library(HDF5_${LIB}_LIBRARY_DEBUG - NAMES ${THIS_LIBRARY_SEARCH_DEBUG} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - find_library( HDF5_${LIB}_LIBRARY_RELEASE - NAMES ${THIS_LIBRARY_SEARCH_RELEASE} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - select_library_configurations( HDF5_${LIB} ) - list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) - endforeach() - if(HDF5_${__lang}_LIBRARIES) - set(HDF5_${__lang}_FOUND True) - endif() - - # Append the libraries for this language binding to the list of all - # required libraries. - list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) - - if(FIND_HL) - foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) - if(HDF5_USE_STATIC_LIBRARIES) - # According to bug 1643 on the CMake bug tracker, this is the - # preferred method for searching for a static library. - # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search - # first for the full static library name, but fall back to a - # generic search on the name if the static search fails. - set( THIS_LIBRARY_SEARCH_DEBUG - lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug - lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static ) - set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static) - else() - set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) - set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) - endif() - find_library(HDF5_${LIB}_LIBRARY_DEBUG - NAMES ${THIS_LIBRARY_SEARCH_DEBUG} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - find_library( HDF5_${LIB}_LIBRARY_RELEASE - NAMES ${THIS_LIBRARY_SEARCH_RELEASE} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - select_library_configurations( HDF5_${LIB} ) - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY}) - endforeach() - - # Append the libraries for this language binding to the list of all - # required libraries. - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) - endif() - endforeach() - if(FIND_HL AND HDF5_HL_LIBRARIES) - set(HDF5_HL_FOUND True) - endif() - - _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) - - # If the HDF5 include directory was found, open H5pubconf.h to determine if - # HDF5 was compiled with parallel IO support - set( HDF5_IS_PARALLEL FALSE ) - set( HDF5_VERSION "" ) - foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) - foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h") - if( EXISTS "${_hdr}" ) - file( STRINGS "${_hdr}" - HDF5_HAVE_PARALLEL_DEFINE - REGEX "HAVE_PARALLEL 1" ) - if( HDF5_HAVE_PARALLEL_DEFINE ) - set( HDF5_IS_PARALLEL TRUE ) - endif() - unset(HDF5_HAVE_PARALLEL_DEFINE) - - file( STRINGS "${_hdr}" - HDF5_VERSION_DEFINE - REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" ) - if( "${HDF5_VERSION_DEFINE}" MATCHES - "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?\"" ) - set( HDF5_VERSION "${CMAKE_MATCH_1}" ) - if( CMAKE_MATCH_3 ) - set( HDF5_VERSION ${HDF5_VERSION}.${CMAKE_MATCH_3}) - endif() - endif() - unset(HDF5_VERSION_DEFINE) - endif() - endforeach() - endforeach() - set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL - "HDF5 library compiled with parallel IO support" ) - mark_as_advanced( HDF5_IS_PARALLEL ) - - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) - if(FIND_HL) - list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) - endif() -endif() - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -if( HDF5_INCLUDE_DIRS ) - set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) -endif() - -# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that -# something external is trying to explicitly pass already found -# locations -if(NOT HDF5_REQUIRED_VARS) - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) -endif() - -find_package_handle_standard_args(HDF5 - REQUIRED_VARS ${HDF5_REQUIRED_VARS} - VERSION_VAR HDF5_VERSION - HANDLE_COMPONENTS -) - -unset(_HDF5_SEARCH_OPTS) - -if( HDF5_FOUND AND NOT HDF5_DIR) - # hide HDF5_DIR for the non-advanced user to avoid confusion with - # HDF5_DIR-NOT_FOUND while HDF5 was found. - mark_as_advanced(HDF5_DIR) -endif() - -if (HDF5_FIND_DEBUG) - message(STATUS "HDF5_DIR: ${HDF5_DIR}") - message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}") - message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}") - message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}") - message(STATUS "HDF5_HL_LIBRARIES: ${HDF5_HL_LIBRARIES}") - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}") - message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}") - message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}") - message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}") - message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}") - message(STATUS "HDF5_${__lang}_HL_LIBRARY: ${HDF5_${__lang}_HL_LIBRARY}") - message(STATUS "HDF5_${__lang}_HL_LIBRARIES: ${HDF5_${__lang}_HL_LIBRARIES}") - endforeach() -endif() diff --git a/cmake/Modules/NewCMake/FindMPI.cmake b/cmake/Modules/NewCMake/FindMPI.cmake deleted file mode 100644 index 5cd2a2afe7..0000000000 --- a/cmake/Modules/NewCMake/FindMPI.cmake +++ /dev/null @@ -1,1514 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindMPI -# ------- -# -# Find a Message Passing Interface (MPI) implementation. -# -# The Message Passing Interface (MPI) is a library used to write -# high-performance distributed-memory parallel applications, and is -# typically deployed on a cluster. MPI is a standard interface (defined -# by the MPI forum) for which many implementations are available. -# -# Variables for using MPI -# ^^^^^^^^^^^^^^^^^^^^^^^ -# -# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``. -# Each of these controls the various MPI languages to search for. -# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the -# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API -# that was removed again in MPI-3. -# -# Depending on the enabled components the following variables will be set: -# -# ``MPI_FOUND`` -# Variable indicating that MPI settings for all requested languages have been found. -# If no components are specified, this is true if MPI settings for all enabled languages -# were detected. Note that the ``MPICXX`` component does not affect this variable. -# ``MPI_VERSION`` -# Minimal version of MPI detected among the requested languages, or all enabled languages -# if no components were specified. -# -# This module will set the following variables per language in your -# project, where ```` is one of C, CXX, or Fortran: -# -# ``MPI__FOUND`` -# Variable indicating the MPI settings for ```` were found and that -# simple MPI test programs compile with the provided settings. -# ``MPI__COMPILER`` -# MPI compiler for ```` if such a program exists. -# ``MPI__COMPILE_OPTIONS`` -# Compilation options for MPI programs in ````, given as a :ref:`;-list `. -# ``MPI__COMPILE_DEFINITIONS`` -# Compilation definitions for MPI programs in ````, given as a :ref:`;-list `. -# ``MPI__INCLUDE_DIRS`` -# Include path(s) for MPI header. -# ``MPI__LINK_FLAGS`` -# Linker flags for MPI programs. -# ``MPI__LIBRARIES`` -# All libraries to link MPI programs against. -# -# Additionally, the following :prop_tgt:`IMPORTED` targets are defined: -# -# ``MPI::MPI_`` -# Target for using MPI from ````. -# -# The following variables indicating which bindings are present will be defined: -# -# ``MPI_MPICXX_FOUND`` -# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3). -# ``MPI_Fortran_HAVE_F77_HEADER`` -# True if the Fortran 77 header ``mpif.h`` is available. -# ``MPI_Fortran_HAVE_F90_MODULE`` -# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only). -# ``MPI_Fortran_HAVE_F08_MODULE`` -# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only). -# -# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version -# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions. -# -# ``MPI__VERSION_MAJOR`` -# Major version of MPI implemented for ```` by the MPI distribution. -# ``MPI__VERSION_MINOR`` -# Minor version of MPI implemented for ```` by the MPI distribution. -# ``MPI__VERSION`` -# MPI version implemented for ```` by the MPI distribution. -# -# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards -# always have required this binding to work in both C and C++ code. -# -# For running MPI programs, the module sets the following variables -# -# ``MPIEXEC_EXECUTABLE`` -# Executable for running MPI programs, if such exists. -# ``MPIEXEC_NUMPROC_FLAG`` -# Flag to pass to ``mpiexec`` before giving it the number of processors to run on. -# ``MPIEXEC_MAX_NUMPROCS`` -# Number of MPI processors to utilize. Defaults to the number -# of processors detected on the host system. -# ``MPIEXEC_PREFLAGS`` -# Flags to pass to ``mpiexec`` directly before the executable to run. -# ``MPIEXEC_POSTFLAGS`` -# Flags to pass to ``mpiexec`` after other flags. -# -# Variables for locating MPI -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# This module performs a three step search for an MPI implementation: -# -# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a -# compiler wrapper as ``CMAKE__COMPILER`` or if they're on a Cray system. -# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. -# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. -# Currently, only Microsoft MPI and MPICH2 on Windows are supported. -# -# For controlling the second step, the following variables may be set: -# -# ``MPI__COMPILER`` -# Search for the specified compiler wrapper and use it. -# ``MPI__COMPILER_FLAGS`` -# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers -# support linking debug or tracing libraries if a specific flag is passed and this variable -# may be used to obtain them. -# ``MPI_COMPILER_FLAGS`` -# Used to initialize ``MPI__COMPILER_FLAGS`` if no language specific flag has been given. -# Empty by default. -# ``MPI_EXECUTABLE_SUFFIX`` -# A suffix which is appended to all names that are being looked for. For instance you may set this -# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives. -# -# In order to control the guessing step, the following variable may be set: -# -# ``MPI_GUESS_LIBRARY_NAME`` -# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for. -# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available. -# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden. -# -# Each of the search steps may be skipped with the following control variables: -# -# ``MPI_ASSUME_NO_BUILTIN_MPI`` -# If true, the module assumes that the compiler itself does not provide an MPI implementation and -# skips to step 2. -# ``MPI_SKIP_COMPILER_WRAPPER`` -# If true, no compiler wrapper will be searched for. -# ``MPI_SKIP_GUESSING`` -# If true, the guessing step will be skipped. -# -# Additionally, the following control variable is available to change search behavior: -# -# ``MPI_CXX_SKIP_MPICXX`` -# Add some definitions that will disable the MPI-2 C++ bindings. -# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, -# for example MVAPICH or Intel MPI. -# -# If the find procedure fails for a variable ``MPI__WORKS``, then the settings detected by or passed to -# the module did not work and even a simple MPI test program failed to compile. -# -# If all of these parameters were not sufficient to find the right MPI implementation, a user may -# disable the entire autodetection process by specifying both a list of libraries in ``MPI__LIBRARIES`` -# and a list of include directories in ``MPI__ADDITIONAL_INCLUDE_DIRS``. -# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the -# settings in the cache. -# -# Cache variables for MPI -# ^^^^^^^^^^^^^^^^^^^^^^^ -# -# The variable ``MPI__INCLUDE_DIRS`` will be assembled from the following variables. -# For C and CXX: -# -# ``MPI__HEADER_DIR`` -# Location of the ``mpi.h`` header on disk. -# -# For Fortran: -# -# ``MPI_Fortran_F77_HEADER_DIR`` -# Location of the Fortran 77 header ``mpif.h``, if it exists. -# ``MPI_Fortran_MODULE_DIR`` -# Location of the ``mpi`` or ``mpi_f08`` modules, if available. -# -# For all languages the following variables are additionally considered: -# -# ``MPI__ADDITIONAL_INCLUDE_DIRS`` -# A :ref:`;-list ` of paths needed in addition to the normal include directories. -# ``MPI__INCLUDE_DIR`` -# Path variables for include folders referred to by ````. -# ``MPI__ADDITIONAL_INCLUDE_VARS`` -# A :ref:`;-list ` of ```` that will be added to the include locations of ````. -# -# The variable ``MPI__LIBRARIES`` will be assembled from the following variables: -# -# ``MPI__LIBRARY`` -# The location of a library called ```` for use with MPI. -# ``MPI__LIB_NAMES`` -# A :ref:`;-list ` of ```` that will be added to the include locations of ````. -# -# Usage of mpiexec -# ^^^^^^^^^^^^^^^^ -# -# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically -# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows: -# -# :: -# -# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} -# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS -# -# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to -# pass to the MPI program. -# -# Advanced variables for using MPI -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The module can perform some advanced feature detections upon explicit request. -# -# **Important notice:** The following checks cannot be performed without *executing* an MPI test program. -# Consider the special considerations for the behavior of :command:`try_run` during cross compilation. -# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. -# You should only enable these detections if you absolutely need the information. -# -# If the following variables are set to true, the respective search will be performed: -# -# ``MPI_DETERMINE_Fortran_CAPABILITIES`` -# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and -# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran__SUBARRAYS`` -# and ``MPI_Fortran__ASYNCPROT``, where ```` is one of ``F77_HEADER``, ``F90_MODULE`` and -# ``F08_MODULE``. -# ``MPI_DETERMINE_LIBRARY_VERSION`` -# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI__LIBRARY_VERSION``. -# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ````. -# Note that the return value is entirely implementation defined. This information might be used to identify -# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor. -# -# Backward Compatibility -# ^^^^^^^^^^^^^^^^^^^^^^ -# -# For backward compatibility with older versions of FindMPI, these -# variables are set, but deprecated: -# -# :: -# -# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY -# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS -# MPI_LIBRARIES -# -# In new projects, please use the ``MPI__XXX`` equivalents. -# Additionally, the following variables are deprecated: -# -# ``MPI__COMPILE_FLAGS`` -# Use ``MPI__COMPILE_OPTIONS`` and ``MPI__COMPILE_DEFINITIONS`` instead. -# ``MPI__INCLUDE_PATH`` -# For consumption use ``MPI__INCLUDE_DIRS`` and for specifying folders use ``MPI__ADDITIONAL_INCLUDE_DIRS`` instead. -# ``MPIEXEC`` -# Use ``MPIEXEC_EXECUTABLE`` instead. - -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -# Generic compiler names -set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) -set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ - mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) -set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r - mpif90 mpif90_r mpf90 mpf90_r - mpif77 mpif77_r mpf77 mpf77_r - mpifc) - -# GNU compiler names -set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) -set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) -set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r - mpig77 mpig77_r mpg77 mpg77_r) - -# Intel MPI compiler names on Windows -if(WIN32) - list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat) - list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat) - list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat) - - # Intel MPI compiler names - set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat) - set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat) - set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat) - - # Intel MPI compiler names for MSMPI - set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat) - set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat) -else() - # Intel compiler names - set(_MPI_Intel_C_COMPILER_NAMES mpiicc) - set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++) - set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) -endif() - -# PGI compiler names -set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) -set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) -set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) - -# XLC MPI Compiler names -set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) -set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC - mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) -set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r - mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r - mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r - mpixlf mpixlf_r mpxlf mpxlf_r) - -# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, -# attempt all of them. -# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper -# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI -# controls its settings via the I_MPI_CC environment variables if the generic name is being used. -# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to -# pick up the right settings for it. -foreach (LANG IN ITEMS C CXX Fortran) - set(_MPI_${LANG}_COMPILER_NAMES "") - foreach (id IN ITEMS GNU Intel MSVC PGI XL) - if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) - list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) - endif() - unset(_MPI_${id}_${LANG}_COMPILER_NAMES) - endforeach() - list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) - unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) -endforeach() - -# Names to try for mpiexec -# Only mpiexec commands are guaranteed to behave as described in the standard, -# mpirun commands are not covered by the standard in any way whatsoever. -# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. -# srun -n X is however a valid command, so it behaves 'like' mpiexec. -set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) - -unset(_MPIEXEC_NAMES) -foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) - list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") -endforeach() -unset(_MPIEXEC_NAMES_BASE) - -function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) - if(DEFINED MPI_${LANG}_COMPILER_FLAGS) -# separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS "${MPI_${LANG}_COMPILER_FLAGS}") - else() - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") - endif() - execute_process( - COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} - OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE WRAPPER_RETURN) - # Some compiler wrappers will yield spurious zero return values, for example - # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared - # library that has invalid or missing version information there would be warning - # messages emitted by ld.so in the compiler output. In either case, we'll treat - # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") - set(WRAPPER_RETURN 255) - endif() - # Ensure that no error output might be passed upwards. - if(NOT WRAPPER_RETURN EQUAL 0) - unset(WRAPPER_OUTPUT) - endif() - set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) - set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) -endfunction() - -function (_MPI_interrogate_compiler lang) - unset(MPI_COMPILE_CMDLINE) - unset(MPI_LINK_CMDLINE) - - unset(MPI_COMPILE_OPTIONS_WORK) - unset(MPI_COMPILE_DEFINITIONS_WORK) - unset(MPI_INCLUDE_DIRS_WORK) - unset(MPI_LINK_FLAGS_WORK) - unset(MPI_LIB_NAMES_WORK) - unset(MPI_LIB_FULLPATHS_WORK) - - # Check whether the -showme:compile option works. This indicates that we have either Open MPI - # or a newer version of LAM/MPI, and implies that -showme:link will also work. - # Open MPI also supports -show, but separates linker and compiler information - _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - - # MPICH and MVAPICH offer -compile-info and -link-info. - # For modern versions, both do the same as -show. However, for old versions, they do differ - # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the - # removed MPI C++ bindings. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - endif() - - # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the - # -showme commands are more specialized. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - # Older versions of LAM/MPI have "-showme". Open MPI also supports this. - # Unknown to MPICH, MVAPICH and Intel MPI. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) - # Cannot interrogate this compiler, so exit. - set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) - return() - endif() - unset(MPI_COMPILER_RETURN) - - # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE - # into MPI_LINK_CMDLINE, if we didn't find the link line. - if (NOT DEFINED MPI_LINK_CMDLINE) - set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") - endif() - - # At this point, we obtained some output from a compiler wrapper that works. - # We'll now try to parse it into variables with meaning to us. - if("${LANG}" STREQUAL "Fortran") - # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting - # out of a symlink command for mpif.h, the actual compiler command and a deletion of the - # created symlink. We need to detect that case, remember the include path and drop the - # symlink/deletion operation to obtain the link/compile lines we'd usually expect. - if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") - get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - endif() - - # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command - # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. - if(UNIX) - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - - # Extract compile options from the compile command line. - string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) - string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") - # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries - # themselves were built with this flag. However, this flag is unrelated to using MPI, and - # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore - # produce inconsistent results with the regularly flags. - # Similarly, aliasing flags do not belong into our flag array. - if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") - list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") - endif() - endforeach() - - # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. - string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) - string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") - endif() - endforeach() - - # Extract include paths from compile command line - string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:incdirs. - if (NOT MPI_ALL_INCLUDE_PATHS) - _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) - if(MPI_INCDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) - string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) - list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") - endforeach() - - # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:libdirs. - if (NOT MPI_ALL_LINK_PATHS) - _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) - if(MPI_LIBDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) - string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") - string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") - get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") - endforeach() - - # Extract linker flags from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) - string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) - # MPI might be marked to build with non-executable stacks but this should not propagate. - if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") - if (MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") - else() - set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") - endif() - endif() - endforeach() - - # Extract the set of libraries to link against from the link command - # line - string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - - if(WIN32) - # A compiler wrapper on Windows will just have the name of the - # library to link on its link line, potentially with a full path - string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - else() - # On UNIX platforms, archive libraries can be given with full path. - string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - endif() - - # An MPI compiler wrapper could have its MPI libraries in the implictly - # linked directories of the compiler itself. - if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") - endif() - - # Determine full path names for all of the libraries that one needs - # to link against in an MPI program - unset(MPI_PLAIN_LIB_NAMES_WORK) - foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${MPI_LINK_DIRECTORIES_WORK} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - - # Deal with the libraries given with full path next - unset(MPI_DIRECT_LIB_NAMES_WORK) - foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) - list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_PATH} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - if(MPI_DIRECT_LIB_NAMES_WORK) - set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") - endif() - - # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to - # link it in that case. -lpthread is covered by the normal library treatment on the other hand. - if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") - list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") - if(MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " -pthread") - else() - set(MPI_LINK_FLAGS_WORK "-pthread") - endif() - endif() - - if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") - endif() - if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_EXTRA_LIB_NAMES) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") - endif() - - # If we found MPI, set up all of the appropriate cache entries - if(NOT MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) - endif() - if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) - endif() - if(NOT MPI_${LANG}_LINK_FLAGS) - set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) - endif() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) -endfunction() - -function(_MPI_guess_settings LANG) - set(MPI_GUESS_FOUND FALSE) - # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. - if(WIN32) - # MSMPI - - # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, - # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers - # or import libraries and vice versa. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") - # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed - # Microsoft MPI. - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") - else() - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") - endif() - - find_library(MPI_msmpi_LIBRARY - NAMES msmpi - HINTS ${MPI_MSMPI_LIB_PATH} - DOC "Location of the msmpi library for Microsoft MPI") - mark_as_advanced(MPI_msmpi_LIBRARY) - - if(MPI_msmpi_LIBRARY) - # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way - # MSMPI can be used and therefore that header has to be present. - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) - unset(MPI_MSMPI_INC_DIR) - endif() - - # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, - # thus it might be present or provided by the user. Figuring out which is supported is done later on. - # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. - # Should a user be employing PGI or have built its own set and provided it via cache variables, the - # splitting routine would have located the module files. - - # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran - # we need some extra library to glue Fortran support together: - # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names - # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran - # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit - # has both variants available. - # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is - # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), - # it's passed immediately after the string address. - - # To summarize: - # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention - # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention - # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention - # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention - # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. - - # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas - # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran - # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - - # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). - - # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. - # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and - # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. - if ("${LANG}" STREQUAL "Fortran") - set(MPI_MSMPI_CALLINGCONVS c) - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) - list(APPEND MPI_MSMPI_CALLINGCONVS s) - endif() - foreach(mpistrlenpos IN ITEMS e m) - foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) - find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY - NAMES msmpif${mpistrlenpos}${mpicallingconv} - HINTS "${MPI_MSMPI_LIB_PATH}" - DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") - mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) - endforeach() - endforeach() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - - # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value - # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. - find_path(MPI_mpifptr_INCLUDE_DIR - NAMES "mpifptr.h" - HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" - DOC "Location of the mpifptr.h extra header for Microsoft MPI") - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) - else() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - endif() - mark_as_advanced(MPI_${LANG}_LIB_NAMES) - set(MPI_GUESS_FOUND TRUE) - endif() - endif() - - # At this point there's not many MPIs that we could still consider. - # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. - # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") - set(MPI_MPICH_PREFIX_PATHS - "$ENV{ProgramW6432}/MPICH2/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" - ) - - # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first - find_library(MPI_mpi_LIBRARY - NAMES mpi - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_mpi_LIBRARY) - # If we found mpi.lib, we detect the rest of MPICH2 - if(MPI_mpi_LIBRARY) - set(MPI_MPICH_LIB_NAMES "mpi") - # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. - # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. - if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) - find_library(MPI_cxx_LIBRARY - NAMES cxx - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_cxx_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "cxx") - # For Fortran, MPICH2 provides three different libraries: - # fmpich2.lib which uses uppercase symbols and cdecl, - # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), - # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. - # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also - # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one - # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation - elseif("${LANG}" STREQUAL "Fortran") - find_library(MPI_fmpich2_LIBRARY - NAMES fmpich2 - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2s_LIBRARY - NAMES fmpich2s - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2g_LIBRARY - NAMES fmpich2g - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") - endif() - - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - unset(MPI_MPICH_LIB_NAMES) - - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - # For MPICH2, the include folder would be in ../include relative to the library folder. - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) - if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - unset(MPI_MPICH_ROOT_DIR) - endif() - set(MPI_GUESS_FOUND TRUE) - endif() - unset(MPI_MPICH_PREFIX_PATHS) - endif() - endif() - set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) -endfunction() - -function(_MPI_adjust_compile_definitions LANG) - if("${LANG}" STREQUAL "CXX") - # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ - # bindings in MPI-2. - if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") - # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI - # OMPI_SKIP_MPICXX is being used in Open MPI - # _MPICC_H is being used for IBM Platform MPI - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") - set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - endif() -endfunction() - -macro(_MPI_assemble_libraries LANG) - set(MPI_${LANG}_LIBRARIES "") - # Only for libraries do we need to check whether the compiler's linking stage is separate. - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() - endif() -endmacro() - -macro(_MPI_assemble_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_${LANG}_INCLUDE_DIRS "") - else() - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") - endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") - endif() - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") - endforeach() - endif() - endif() -endmacro() - -function(_MPI_split_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - return() - endif() - # Backwards compatibility: Search INCLUDE_PATH if given. - if(MPI_${LANG}_INCLUDE_PATH) - list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") - endif() - - # We try to find the headers/modules among those paths (and system paths) - # For C/C++, we just need to have a look for mpi.h. - if("${LANG}" MATCHES "(C|CXX)") - find_path(MPI_${LANG}_HEADER_DIR "mpi.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - mark_as_advanced(MPI_${LANG}_HEADER_DIR) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - # Fortran is more complicated here: An implementation could provide - # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI - # only provides Fortran 77 and - if mpi.f90 is built - potentially - # a Fortran 90 module. - elseif("${LANG}" STREQUAL "Fortran") - find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - find_path(MPI_${LANG}_MODULE_DIR - NAMES "mpi.mod" "mpi_f08.mod" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS - "${MPI_${LANG}_F77_HEADER_DIR}" - "${MPI_${LANG}_MODULE_DIR}" - ) - endif() - mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) - endif() - # Remove duplicates and default system directories from the list. - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) - endforeach() - endif() - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) -endfunction() - -macro(_MPI_create_imported_target LANG) - if(NOT TARGET MPI::MPI_${LANG}) - add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) - endif() - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") - if(MPI_${LANG}_LINK_FLAGS) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") - endif() - # If the compiler links MPI implicitly, no libraries will be found as they're contained within - # CMAKE__IMPLICIT_LINK_LIBRARIES already. - if(MPI_${LANG}_LIBRARIES) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") - endif() - # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") -endmacro() - -function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) - set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") - set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI") - set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") - unset(MPI_TEST_COMPILE_DEFINITIONS) - if("${LANG}" STREQUAL "Fortran") - if("${MODE}" STREQUAL "F90_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") - elseif("${MODE}" STREQUAL "F08_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") - else() # F77 header - set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") - endif() - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") - elseif("${LANG}" STREQUAL "CXX") - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") - if("${MODE}" STREQUAL "TEST_MPICXX") - set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) - endif() - else() # C - set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") - endif() - if(RUN_BINARY) - try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) - set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) - else() - try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - COPY_FILE "${BIN_FILE}") - endif() -endfunction() - -macro(_MPI_check_lang_works LANG) - # For Fortran we may have by the MPI-3 standard an implementation that provides: - # - the mpi_f08 module - # - *both*, the mpi module and 'mpif.h' - # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. - if( NOT MPI_${LANG}_WORKS ) - if("${LANG}" STREQUAL "Fortran") - set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) - - set(MPI_${LANG}_WORKS FALSE) - - foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) - if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_${mpimethod} TRUE) - else() - set(MPI_${LANG}_HAVE_${mpimethod} FALSE) - endif() - endforeach() - # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. - # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. - unset(MPI_Fortran_INTEGER_LINE) - if(NOT MPI_${LANG}_WORKS) - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) - if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_F77_HEADER TRUE) - endif() - endif() - else() - _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) - # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't - # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. - set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") - endif() - endif() -endmacro() - -# Some systems install various MPI implementations in separate folders in some MPI prefix -# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. -macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) - if(EXISTS "${PREFIX_FOLDER}") - file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") - foreach(_MPI_folder_child IN LISTS _MPI_folder_children) - if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") - list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") - endif() - endforeach() - endif() -endmacro() - -set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_ROOT} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) -if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") - # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ - # We enumerate the subfolders and append each as a prefix - MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") - # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. - list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") - # FreeBSD ships mpich under the normal system paths - but available openmpi implementations - # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi") -endif() - -# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. -# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution -# ships an mpiexec program (mpirun executables are not regulated by the standard). -find_program(MPIEXEC_EXECUTABLE - NAMES ${_MPIEXEC_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${MPI_HINT_DIRS} - DOC "Executable for running MPI programs.") - -# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). -# This gives us a fairly reliable base directory to search for /bin /lib and /include from. -get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) -get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) - -# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to -# launch an MPI process using mpiexec if such a program exists. -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") -set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") -set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") - -# Set the number of processes to the physical processor count -cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) -set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") -unset(_MPIEXEC_NUMPROCS) -mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) - -#============================================================================= -# Backward compatibility input hacks. Propagate the FindMPI hints to C and -# CXX if the respective new versions are not defined. Translate the old -# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. -# -# Once we find the new variables, we translate them back into their old -# equivalents below. -if(NOT MPI_IGNORE_LEGACY_VARIABLES) - foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - - unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - if(MPI_${LANG}_COMPILE_FLAGS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") - endif() - endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - - # If a list of libraries was given, we'll split it into new-style cache variables - unset(MPI_${LANG}_EXTRA_LIB_NAMES) - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - if(_MPI_LIB) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endif() - endforeach() - endif() - endforeach() -endif() -#============================================================================= - -unset(MPI_VERSION) -unset(MPI_VERSION_MAJOR) -unset(MPI_VERSION_MINOR) - -unset(_MPI_MIN_VERSION) - -# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. -if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) -endif() - -# This loop finds the compilers and sends them off for interrogation. -foreach(LANG IN ITEMS C CXX Fortran) - if(CMAKE_${LANG}_COMPILER_LOADED) - if(NOT MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(_MPI_FIND_${LANG} TRUE) - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - if(_MPI_FIND_${LANG}) - if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") - mark_as_advanced(MPI_CXX_SKIP_MPICXX) - endif() - if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) - set(MPI_${LANG}_TRIED_IMPLICIT FALSE) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) - if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) - # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. - # Cray PrgEnv. - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - - # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. - if(MPI_${LANG}_WORKS) - set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) - endif() - set(MPI_${LANG}_TRIED_IMPLICIT TRUE) - endif() - - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) - endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - endif() - - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH - DOC "MPI compiler for ${LANG}" - ) - endif() - - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_PINNED_COMPILER TRUE) - - # If we haven't made the implicit compiler test yet, perform it now. - if(NOT MPI_${LANG}_TRIED_IMPLICIT) - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - endif() - - # Should the MPI compiler not work implicitly for MPI, still interrogate it. - # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used - # directly during linkage instead of CMAKE__COMPILER will not work. - if(NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) - endif() - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - endif() - endif() - - if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - else() - _MPI_guess_settings(${LANG}) - endif() - endif() - endif() - endif() - - _MPI_split_include_dirs(${LANG}) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - - _MPI_adjust_compile_definitions(${LANG}) - # We always create imported targets even if they're empty - _MPI_create_imported_target(${LANG}) - - if(NOT MPI_${LANG}_WORKS) - _MPI_check_lang_works(${LANG}) - endif() - - # Next, we'll initialize the MPI variables that have not been previously set. - set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) - endif() - mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS - MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) - - # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported - # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. - if(MPI_${LANG}_WORKS) - if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) - if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) - _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) - if(MPI_RESULT_${LANG}_test_mpi_MPICXX) - set(MPI_MPICXX_FOUND TRUE) - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - endif() - - # At this point, we know the bindings present but not the MPI version or anything else. - if(NOT DEFINED MPI_${LANG}_VERSION) - unset(MPI_${LANG}_VERSION_MAJOR) - unset(MPI_${LANG}_VERSION_MINOR) - endif() - set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) - - # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the - # Fortran parameters, since those depend on the method of consumption. - # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 - # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. - if("${LANG}" STREQUAL "Fortran") - if(MPI_${LANG}_HAVE_F08_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) - elseif(MPI_${LANG}_HAVE_F90_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) - else() - set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) - endif() - - # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION - # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not - # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. - if(NOT DEFINED MPI_${LANG}_VERSION) - _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) - if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) - file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. - # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING - # and might vary between the different methods of consumption. - if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) - foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) - if(MPI_${LANG}_HAVE_${mpimethod}) - set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) - set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) - _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) - if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND - NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") - if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES - ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") - if("${CMAKE_MATCH_1}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) - endif() - if("${CMAKE_MATCH_2}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) - endif() - endif() - endif() - endif() - endforeach() - set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) - endif() - else() - set(MPI_${LANG}_HIGHEST_METHOD normal) - - # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. - if(NOT DEFINED MPI_${LANG}_VERSION) - file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - unset(MPI_BIN_FOLDER) - - # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. - # The one remaining issue is to determine which MPI library is installed. - # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, - # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING - # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). - # It's also worth noting that the installed version string can depend on the language, or on the system the binary - # runs on if MPI is not statically linked. - if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) - _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) - if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND - "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") - string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" - MPI_${LANG}_LIBRARY_VERSION_STRING) - else() - set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") - endif() - endif() - endif() - - set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) - set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) - set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) - - unset(MPI_${LANG}_REQUIRED_VARS) - if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") - endforeach() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") - if("${LANG}" STREQUAL "Fortran") - # For Fortran we only need one of the module or header directories to have *some* support for MPI. - if(NOT MPI_${LANG}_MODULE_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") - endif() - if(NOT MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") - endif() - else() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") - endforeach() - endif() - # Append the works variable now. If the settings did not work, this will show up properly. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - else() - # If the compiler worked implicitly, use its path as output. - # Should the compiler variable be set, we also require it to work. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") - if(MPI_${LANG}_COMPILER) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - endif() - endif() - find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} - VERSION_VAR MPI_${LANG}_VERSION) - - if(DEFINED MPI_${LANG}_VERSION) - if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) - set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) - endif() - endif() - endif() -endforeach() - -unset(_MPI_REQ_VARS) -foreach(LANG IN ITEMS C CXX Fortran) - if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") - endif() -endforeach() - -if(MPICXX IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") -endif() - -find_package_handle_standard_args(MPI - REQUIRED_VARS ${_MPI_REQ_VARS} - VERSION_VAR ${_MPI_MIN_VERSION} - HANDLE_COMPONENTS) - -#============================================================================= -# More backward compatibility stuff - -# For compatibility reasons, we also define MPIEXEC -set(MPIEXEC "${MPIEXEC_EXECUTABLE}") - -# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. -foreach(LANG IN ITEMS C CXX Fortran) - if(MPI_${LANG}_FOUND) - set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") - unset(MPI_${LANG}_COMPILE_FLAGS) - if(MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_COMPILE_DEFINITIONS) - foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) - string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") - endforeach() - endif() - endif() -endforeach() - -# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. -# This mimics the behavior of the old language-oblivious FindMPI. -set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) -if (MPI_CXX_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_CXX_${var}}) - endforeach() -elseif (MPI_C_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_C_${var}}) - endforeach() -endif() - -# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. -if (MPI_LIBRARIES) - list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) - set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") - unset(MPI_LIBRARY_WORK) -else() - set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") -endif() - -list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) -if (MPI_NUMLIBS GREATER 1) - set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") - list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) - set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") - unset(MPI_EXTRA_LIBRARY_WORK) -else() - set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") -endif() -set(MPI_IGNORE_LEGACY_VARIABLES TRUE) -#============================================================================= - -# unset these vars to cleanup namespace -unset(_MPI_OLD_VARS) -unset(_MPI_PREFIX_PATH) -unset(_MPI_BASE_DIR) -foreach (lang C CXX Fortran) - unset(_MPI_${LANG}_COMPILER_NAMES) -endforeach() - -cmake_policy(POP) diff --git a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in deleted file mode 100644 index 30f912c627..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in +++ /dev/null @@ -1,4 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c deleted file mode 100644 index be9d19d435..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#ifdef __cplusplus -#include -#else -#include -#endif - -int main(int argc, char* argv[]) -{ - char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; - int mpilibver_len; - MPI_Get_library_version(mpilibver_str, &mpilibver_len); -#ifdef __cplusplus - std::puts(mpilibver_str); -#else - puts(mpilibver_str); -#endif -} diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in deleted file mode 100644 index 7938587168..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in +++ /dev/null @@ -1,7 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str - integer(kind=MPI_INTEGER_KIND) :: ierror, reslen - call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) - print *, mpilibver_str - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in deleted file mode 100644 index a254523853..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in +++ /dev/null @@ -1,10 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') - character, dimension(17), parameter :: mpiver_str =& - (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & - char(zero + MPI_VERSION), & - '.', & - char(zero + MPI_SUBVERSION), ']' /) - print *, mpiver_str - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.c b/cmake/Modules/NewCMake/FindMPI/test_mpi.c deleted file mode 100644 index b8a308a4b0..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/test_mpi.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -#ifdef __cplusplus -#include -#else -#include -#endif - -#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) -const char mpiver_str[] = { 'I', 'N', - 'F', 'O', - ':', 'M', - 'P', 'I', - '-', 'V', - 'E', 'R', - '[', ('0' + MPI_VERSION), - '.', ('0' + MPI_SUBVERSION), - ']', '\0' }; -#endif - -int main(int argc, char* argv[]) -{ -#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) -#ifdef __cplusplus - std::puts(mpiver_str); -#else - puts(mpiver_str); -#endif -#endif -#ifdef TEST_MPI_MPICXX - MPI::MPI_Init(&argc, &argv); - MPI::MPI_Finalize(); -#else - MPI_Init(&argc, &argv); - MPI_Finalize(); -#endif -} diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in deleted file mode 100644 index 4d43a04d65..0000000000 --- a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in +++ /dev/null @@ -1,6 +0,0 @@ - program hello - @MPI_Fortran_INCLUDE_LINE@ - integer@MPI_Fortran_INTEGER_LINE@ ierror - call MPI_INIT(ierror) - call MPI_FINALIZE(ierror) - end program diff --git a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake deleted file mode 100644 index 67f6bd6f2b..0000000000 --- a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake +++ /dev/null @@ -1,386 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindPackageHandleStandardArgs ------------------------------ - -This module provides a function intended to be used in :ref:`Find Modules` -implementing :command:`find_package()` calls. It handles the -``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. -It also sets the ``_FOUND`` variable. The package is -considered found if all variables listed contain valid results, e.g. -valid filepaths. - -.. command:: find_package_handle_standard_args - - There are two signatures:: - - find_package_handle_standard_args( - (DEFAULT_MSG|) - ... - ) - - find_package_handle_standard_args( - [FOUND_VAR ] - [REQUIRED_VARS ...] - [VERSION_VAR ] - [HANDLE_COMPONENTS] - [CONFIG_MODE] - [FAIL_MESSAGE ] - ) - - The ``_FOUND`` variable will be set to ``TRUE`` if all - the variables ``...`` are valid and any optional - constraints are satisfied, and ``FALSE`` otherwise. A success or - failure message may be displayed based on the results and on - whether the ``REQUIRED`` and/or ``QUIET`` option was given to - the :command:`find_package` call. - - The options are: - - ``(DEFAULT_MSG|)`` - In the simple signature this specifies the failure message. - Use ``DEFAULT_MSG`` to ask for a default message to be computed - (recommended). Not valid in the full signature. - - ``FOUND_VAR `` - Obsolete. Specifies either ``_FOUND`` or - ``_FOUND`` as the result variable. This exists only - for compatibility with older versions of CMake and is now ignored. - Result variables of both names are always set for compatibility. - - ``REQUIRED_VARS ...`` - Specify the variables which are required for this package. - These may be named in the generated failure message asking the - user to set the missing variable values. Therefore these should - typically be cache entries such as ``FOO_LIBRARY`` and not output - variables like ``FOO_LIBRARIES``. - - ``VERSION_VAR `` - Specify the name of a variable that holds the version of the package - that has been found. This version will be checked against the - (potentially) specified required version given to the - :command:`find_package` call, including its ``EXACT`` option. - The default messages include information about the required - version and the version which has been actually found, both - if the version is ok or not. - - ``HANDLE_COMPONENTS`` - Enable handling of package components. In this case, the command - will report which components have been found and which are missing, - and the ``_FOUND`` variable will be set to ``FALSE`` - if any of the required components (i.e. not the ones listed after - the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are - missing. - - ``CONFIG_MODE`` - Specify that the calling find module is a wrapper around a - call to ``find_package( NO_MODULE)``. This implies - a ``VERSION_VAR`` value of ``_VERSION``. The command - will automatically check whether the package configuration file - was found. - - ``FAIL_MESSAGE `` - Specify a custom failure message instead of using the default - generated message. Not recommended. - -Example for the simple signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibXml2 DEFAULT_MSG - LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) - -The ``LibXml2`` package is considered to be found if both -``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. -Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found -and ``REQUIRED`` was used, it fails with a -:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was -used or not. If it is found, success will be reported, including -the content of the first ````. On repeated CMake runs, -the same message will not be printed again. - -Example for the full signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibArchive - REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR - VERSION_VAR LibArchive_VERSION) - -In this case, the ``LibArchive`` package is considered to be found if -both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. -Also the version of ``LibArchive`` will be checked by using the version -contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, -the default messages will be printed. - -Another example for the full signature: - -.. code-block:: cmake - - find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) - find_package_handle_standard_args(Automoc4 CONFIG_MODE) - -In this case, a ``FindAutmoc4.cmake`` module wraps a call to -``find_package(Automoc4 NO_MODULE)`` and adds an additional search -directory for ``automoc4``. Then the call to -``find_package_handle_standard_args`` produces a proper success/failure -message. -#]=======================================================================] - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) - -# internal helper macro -macro(_FPHSA_FAILURE_MESSAGE _msg) - if (${_NAME}_FIND_REQUIRED) - message(FATAL_ERROR "${_msg}") - else () - if (NOT ${_NAME}_FIND_QUIETLY) - message(STATUS "${_msg}") - endif () - endif () -endmacro() - - -# internal helper macro to generate the failure message when used in CONFIG_MODE: -macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) - # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: - if(${_NAME}_CONFIG) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") - else() - # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. - # List them all in the error message: - if(${_NAME}_CONSIDERED_CONFIGS) - set(configsText "") - list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) - math(EXPR configsCount "${configsCount} - 1") - foreach(currentConfigIndex RANGE ${configsCount}) - list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) - list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) - string(APPEND configsText " ${filename} (version ${version})\n") - endforeach() - if (${_NAME}_NOT_FOUND_MESSAGE) - string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") - endif() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") - - else() - # Simple case: No Config-file was found at all: - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") - endif() - endif() -endmacro() - - -function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) - -# Set up the arguments for `cmake_parse_arguments`. - set(options CONFIG_MODE HANDLE_COMPONENTS) - set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) - set(multiValueArgs REQUIRED_VARS) - -# Check whether we are in 'simple' or 'extended' mode: - set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) - list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) - - if(${INDEX} EQUAL -1) - set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - set(FPHSA_REQUIRED_VARS ${ARGN}) - set(FPHSA_VERSION_VAR) - else() - cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) - - if(FPHSA_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT FPHSA_FAIL_MESSAGE) - set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") - endif() - - # In config-mode, we rely on the variable _CONFIG, which is set by find_package() - # when it successfully found the config-file, including version checking: - if(FPHSA_CONFIG_MODE) - list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) - list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) - set(FPHSA_VERSION_VAR ${_NAME}_VERSION) - endif() - - if(NOT FPHSA_REQUIRED_VARS) - message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") - endif() - endif() - -# now that we collected all arguments, process them - - if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") - set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") - endif() - - list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) - - string(TOUPPER ${_NAME} _NAME_UPPER) - string(TOLOWER ${_NAME} _NAME_LOWER) - - if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") - set(_FOUND_VAR ${FPHSA_FOUND_VAR}) - else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") - endif() - else() - set(_FOUND_VAR ${_NAME_UPPER}_FOUND) - endif() - - # collect all variables which were not found, so they can be printed, so the - # user knows better what went wrong (#6375) - set(MISSING_VARS "") - set(DETAILS "") - # check if all passed variables are valid - set(FPHSA_FOUND_${_NAME} TRUE) - foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) - if(NOT ${_CURRENT_VAR}) - set(FPHSA_FOUND_${_NAME} FALSE) - string(APPEND MISSING_VARS " ${_CURRENT_VAR}") - else() - string(APPEND DETAILS "[${${_CURRENT_VAR}}]") - endif() - endforeach() - if(FPHSA_FOUND_${_NAME}) - set(${_NAME}_FOUND TRUE) - set(${_NAME_UPPER}_FOUND TRUE) - else() - set(${_NAME}_FOUND FALSE) - set(${_NAME_UPPER}_FOUND FALSE) - endif() - - # component handling - unset(FOUND_COMPONENTS_MSG) - unset(MISSING_COMPONENTS_MSG) - - if(FPHSA_HANDLE_COMPONENTS) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(${_NAME}_${comp}_FOUND) - - if(NOT DEFINED FOUND_COMPONENTS_MSG) - set(FOUND_COMPONENTS_MSG "found components: ") - endif() - string(APPEND FOUND_COMPONENTS_MSG " ${comp}") - - else() - - if(NOT DEFINED MISSING_COMPONENTS_MSG) - set(MISSING_COMPONENTS_MSG "missing components: ") - endif() - string(APPEND MISSING_COMPONENTS_MSG " ${comp}") - - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - string(APPEND MISSING_VARS " ${comp}") - endif() - - endif() - endforeach() - set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") - string(APPEND DETAILS "[c${COMPONENT_MSG}]") - endif() - - # version handling: - set(VERSION_MSG "") - set(VERSION_OK TRUE) - - # check with DEFINED here as the requested or found version may be "0" - if (DEFINED ${_NAME}_FIND_VERSION) - if(DEFINED ${FPHSA_VERSION_VAR}) - set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) - - if(${_NAME}_FIND_VERSION_EXACT) # exact version required - # count the dots in the version string - string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") - # add one dot because there is one dot more than there are components - string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) - if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) - # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT - # is at most 4 here. Therefore a simple lookup table is used. - if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) - set(_VERSION_REGEX "[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) - set(_VERSION_REGEX "[^.]*\\.[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") - else () - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") - endif () - string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") - unset(_VERSION_REGEX) - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") - endif () - unset(_VERSION_HEAD) - else () - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") - endif () - endif () - unset(_VERSION_DOTS) - - else() # minimum version specified: - if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") - endif () - endif() - - else() - - # if the package was not found, but a version was given, add that to the output: - if(${_NAME}_FIND_VERSION_EXACT) - set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") - else() - set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") - endif() - - endif() - else () - # Check with DEFINED as the found version may be 0. - if(DEFINED ${FPHSA_VERSION_VAR}) - set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") - endif() - endif () - - if(VERSION_OK) - string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") - else() - set(${_NAME}_FOUND FALSE) - endif() - - - # print the result: - if (${_NAME}_FOUND) - FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") - else () - - if(FPHSA_CONFIG_MODE) - _FPHSA_HANDLE_FAILURE_CONFIG_MODE() - else() - if(NOT VERSION_OK) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - else() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") - endif() - endif() - - endif () - - set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) - set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) -endfunction() diff --git a/cmake/Modules/NewCMake/FindPackageMessage.cmake b/cmake/Modules/NewCMake/FindPackageMessage.cmake deleted file mode 100644 index 6821cee4f7..0000000000 --- a/cmake/Modules/NewCMake/FindPackageMessage.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindPackageMessage -# ------------------ -# -# -# -# FIND_PACKAGE_MESSAGE( "message for user" "find result details") -# -# This macro is intended to be used in FindXXX.cmake modules files. It -# will print a message once for each unique find result. This is useful -# for telling the user where a package was found. The first argument -# specifies the name (XXX) of the package. The second argument -# specifies the message to display. The third argument lists details -# about the find result so that if they change the message will be -# displayed again. The macro also obeys the QUIET argument to the -# find_package command. -# -# Example: -# -# :: -# -# if(X11_FOUND) -# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" -# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") -# else() -# ... -# endif() - -function(FIND_PACKAGE_MESSAGE pkg msg details) - # Avoid printing a message repeatedly for the same find result. - if(NOT ${pkg}_FIND_QUIETLY) - string(REPLACE "\n" "" details "${details}") - set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) - if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") - # The message has not yet been printed. - message(STATUS "${msg}") - - # Save the find details in the cache to avoid printing the same - # message again. - set("${DETAILS_VAR}" "${details}" - CACHE INTERNAL "Details about finding ${pkg}") - endif() - endif() -endfunction() diff --git a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake deleted file mode 100644 index dce6f99262..0000000000 --- a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake +++ /dev/null @@ -1,70 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# SelectLibraryConfigurations -# --------------------------- -# -# -# -# select_library_configurations( basename ) -# -# This macro takes a library base name as an argument, and will choose -# good values for basename_LIBRARY, basename_LIBRARIES, -# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what -# has been found and set. If only basename_LIBRARY_RELEASE is defined, -# basename_LIBRARY will be set to the release value, and -# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. -# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will -# take the debug value, and basename_LIBRARY_RELEASE will be set to -# basename_LIBRARY_RELEASE-NOTFOUND. -# -# If the generator supports configuration types, then basename_LIBRARY -# and basename_LIBRARIES will be set with debug and optimized flags -# specifying the library to be used for the given configuration. If no -# build type has been set or the generator in use does not support -# configuration types, then basename_LIBRARY and basename_LIBRARIES will -# take only the release value, or the debug value if the release one is -# not set. - -# This macro was adapted from the FindQt4 CMake module and is maintained by Will -# Dicharry . - -macro( select_library_configurations basename ) - if(NOT ${basename}_LIBRARY_RELEASE) - set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") - endif() - if(NOT ${basename}_LIBRARY_DEBUG) - set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") - endif() - - if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND - NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND - ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) - # if the generator supports configuration types or CMAKE_BUILD_TYPE - # is set, then set optimized and debug options. - set( ${basename}_LIBRARY "" ) - foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) - list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) - endforeach() - foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) - list( APPEND ${basename}_LIBRARY debug "${_libname}" ) - endforeach() - elseif( ${basename}_LIBRARY_RELEASE ) - set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - elseif( ${basename}_LIBRARY_DEBUG ) - set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) - else() - set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") - endif() - - set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) - - if( ${basename}_LIBRARY ) - set( ${basename}_FOUND TRUE ) - endif() - - mark_as_advanced( ${basename}_LIBRARY_RELEASE - ${basename}_LIBRARY_DEBUG - ) -endmacro() diff --git a/cmake/Modules/findHelpers.cmake b/cmake/Modules/findHelpers.cmake deleted file mode 100644 index 028957a0a6..0000000000 --- a/cmake/Modules/findHelpers.cmake +++ /dev/null @@ -1,173 +0,0 @@ -function (findSrc varName version varDir ) - if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) - message("setting source for ${varName} to be in libsrc") - set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) - set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) - else() - set(searchName ${varName}_v${${version}}) - message("searching for source for ${searchName} in ${CRTM_BASE}") - string( TOLOWER ${varName} varNameLower ) - find_path( TMP_DIR - NAMES ${searchName} - HINTS - ${CMAKE_SOURCE_DIR}/../libs - ${CRTM_BASE}/${version} - ${CRTM_BASE}/${varName} - ${CRTM_BASE}/${varName}/${version} - ${CRTM_BASE}/${varNameLower} - ${CRTM_BASE}/${varNameLower}/${version} - ${COREPATH}/sorc - $ENV{${varDir}}/libsrc - $ENV{${varDir}}/lib/sorc - $ENV{CORPATH}/lib/sorc - ${CMAKE_SOURCE_DIR}/libsrc/${varName} - ) - if( NOT TMP_DIR ) - message("didn't find directory") - set(secondSearchName v${${version}}) - find_path( TMP2_DIR - NAMES ${secondSearchName} - HINTS - ${CRTM_BASE}/${varName} - ) - endif() - set( varCacheName "${varDir}_SRC" ) - file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/*.f*" "${TMP_DIR}/${varName}_v${${version}}/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}" PARENT_SCOPE) - set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/src/*.f*" "${TMP_DIR}/${varName}_v${${version}}/src/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/src" PARENT_SCOPE) - set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/src" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/libsrc/*.f*" "${TMP_DIR}/${varName}_v${${version}}/src/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/libsrc" PARENT_SCOPE) - set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/libsrc" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/sorc/*.f*" "${TMP_DIR}/${varName}_v${${version}}/sorc/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/sorc" PARENT_SCOPE) - set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/sorc" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc/*.f*" - "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc" PARENT_SCOPE) - set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${TMP2_DIR}/v${${version}}/src/*.f*" - "${TMP_DIR}/v${${version}}/src/*.F*") - if( f_FILES ) - set( ${varDir} "${TMP2_DIR}/v${${version}}/src" PARENT_SCOPE) - set( ${varCacheName} "${TMP2_DIR}/v${${version}}/src" CACHE STRING "" FORCE ) - endif() - endif() - endif() - endif() - endif() - endif() - if( NOT f_FILES ) # look for source that is of a different version - message("WARNING: Did not find ${${version}} of ${varName}, looking for alternates") - findOtherVersion( TMP_DIR ${varName} srcPath ${version} ) - file(GLOB f_FILES "${srcPath}/*.f*" "${srcPath}/*.F*") - if( f_FILES ) - set( ${varDir} "${srcPath}" PARENT_SCOPE) - set( ${varCacheName} "${srcPath}" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${srcPath}/src/*.f*" "${srcPath}/src/*.F*") - if( f_FILES ) - set( ${varDir} "${srcPath}/src" PARENT_SCOPE) - set( ${varCacheName} "${srcPath}/src" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${srcPath}/libsrc/*.f*" "${srcPath}/src/*.F*") - if( f_FILES ) - set( ${varDir} "${srcPath}/libsrc" PARENT_SCOPE) - set( ${varCacheName} "${srcPath}/libsrc" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${srcPath}/sorc/*.f*" "${srcPath}/sorc/*.F*") - if( f_FILES ) - set( ${varDir} "${srcPath}/sorc" PARENT_SCOPE) - set( ${varCacheName} "${srcPath}/sorc" CACHE STRING "" FORCE ) - else() - file(GLOB f_FILES "${srcPath}/sorc/libsrc/*.f*" - "${srcPath}/sorc/libsrc/*.F*") - if( f_FILES ) - set( ${varDir} "${srcPath}/sorc/libsrc" PARENT_SCOPE) - set( ${varCacheName} "${srcPath}/sorc/libsrc" CACHE STRING "" FORCE ) - endif() - endif() - endif() - endif() - endif() - endif() - endif() -endfunction() - -function (findInc incName version incFile ) - cmake_policy(SET CMP0011 NEW) - cmake_policy(SET CMP0009 NEW) - STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) - if(( USECRTMBASE ) AND ( CRTM_BASE )) - execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) -# file(GLOB_RECURSE INCFILES ${CRTM_BASE}/*${CRTM_VER}*/*mod ) -# file(GLOB_RECURSE INCFILES2 ${CRTM_BASE}/crtm/*${CRTM_VER}*/*/*mod ) -# list(APPEND INCFILES ${INCFILES2} ) - else() - if(crayComp) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - else() - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - else() - execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - if( NOT (INCFILES) ) - execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - endif() -# message("incfiles are ${INCFILES}") - if( INCFILES ) - string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) - endif() - foreach( INC_FILE in ${INCFILES} ) - string(REGEX MATCH ${${version}} MATCHFOUND ${INC_FILE} ) -# message("matchfound is ${MATCHFOUND}, version is ${${version}} for ${INC_FILE}") - if( MATCHFOUND ) - message("found ${INC_FILE}") - string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) - set( ${incFile} ${INCPATH} PARENT_SCOPE ) - return() - endif() - endforeach() - file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) - list(LENGTH INCFILES numFiles) - if(numFiles EQUAL 1) - get_filename_component( INCPATH ${INCFILES} DIRECTORY ) - else() - foreach( INC_FILE in ${INCFILES} ) - get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) -# message("WARNING: Did not find explicit version ${${version}} of ${incName} module, using un-versioned path") -# set( ${incFile} ${INCPATH} PARENT_SCOPE ) -# return() - endforeach() - endif() - set( ${incFile} ${INCPATH} PARENT_SCOPE ) -endfunction() - -function (findOtherVersion rootPath srcName srcPath newVer ) - file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) - foreach( SRC_DIR in ${SRCDIRS} ) - string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) - if( MATCHFOUND ) - set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) - string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) - message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") - set( ${newVer} ${ALTVER} PARENT_SCOPE ) - return() - endif() - endforeach() -endfunction() diff --git a/cmake/Modules/platforms/Cheyenne.cmake b/cmake/Modules/platforms/Cheyenne.cmake deleted file mode 100644 index 54477168e8..0000000000 --- a/cmake/Modules/platforms/Cheyenne.cmake +++ /dev/null @@ -1,24 +0,0 @@ -macro (setCheyenne) - message("Setting paths for Cheyenne") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - - set(BUILD_CORELIBS "ON" ) - set(BUILD_UTIL "OFF" CACHE INTERNAL "" ) - set(BUILD_BUFR "ON" CACHE INTERNAL "") - set(BUILD_SFCIO "ON" CACHE INTERNAL "") - set(BUILD_SIGIO "ON" CACHE INTERNAL "") - set(BUILD_W3EMC "ON" CACHE INTERNAL "") - set(BUILD_W3NCO "ON" CACHE INTERNAL "") - set(BUILD_BACIO "ON" CACHE INTERNAL "") - set(BUILD_CRTM "ON" CACHE INTERNAL "") - set(BUILD_SP "ON" CACHE INTERNAL "") - set(BUILD_NEMSIO "ON" CACHE INTERNAL "") - set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) -endmacro() - diff --git a/cmake/Modules/platforms/Discover.cmake b/cmake/Modules/platforms/Discover.cmake deleted file mode 100644 index fe8a2dfc0e..0000000000 --- a/cmake/Modules/platforms/Discover.cmake +++ /dev/null @@ -1,55 +0,0 @@ -macro (setDiscover) - message("Setting paths for Discover") -# option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) -# option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HDF5_USE_STATIC_LIBRARIES "OFF") - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(host "Discover" CACHE INTERNAL "") - - set(COREPATH $ENV{COREPATH} ) - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.1.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.2.0" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() - - if( ENV{BASEDIR} ) - set(BASEDIR $ENV{BASEDIR}/Linux CACHE INTERNAL "") - endif() - set(BUILD_CORELIBS "ON" CACHE INTERNAL "") - set(USE_WRF "OFF" CACHE INTERNAL "") - set(BUILD_GLOBAL "ON" CACHE INTERNAL "") - - set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) - -endmacro() - diff --git a/cmake/Modules/platforms/Gaea.cmake b/cmake/Modules/platforms/Gaea.cmake deleted file mode 100644 index d6929b8f03..0000000000 --- a/cmake/Modules/platforms/Gaea.cmake +++ /dev/null @@ -1,14 +0,0 @@ -macro (setGaea) - - message("Setting flags and paths for Cray") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) - - set(HOST_FLAG "-xCORE-AVX2" CACHE INTERNAL "Host Flag") # for Haswell (C4) - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag" ) - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") - set(GSI_LDFLAGS "${MKL_FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(BUILD_CORELIBS "OFF" ) -endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake b/cmake/Modules/platforms/Generic.cmake deleted file mode 100644 index b584cf66cf..0000000000 --- a/cmake/Modules/platforms/Generic.cmake +++ /dev/null @@ -1,24 +0,0 @@ -macro (setGeneric) - message("Setting paths for Generic System") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - if(EXISTS /jetmon) - set(HOST_FLAG "" CACHE INTERNAL "Host Flag") ## default, no host_flag required - else() - set(HOST_FLAG "" CACHE INTERNAL "Host Flag") ## default, no host_flag required - endif() - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - - message("setting values for corelibs") - set(BUILD_BUFR "OFF" CACHE INTERNAL "Build the BUFR library" ) - set(BUILD_BACIO "OFF" CACHE INTERNAL "Build the BACIO library" ) - set(BUILD_SFCIO "OFF" CACHE INTERNAL "Build the SFCIO library" ) - set(BUILD_SIGIO "OFF" CACHE INTERNAL "Build the SIGIO library" ) - set(BUILD_NEMSIO "OFF" CACHE INTERNAL "Build the NEMSIO library" ) - set(BUILD_SP "OFF" CACHE INTERNAL "Build the SP library" ) - set(BUILD_CRTM "OFF" CACHE INTERNAL "Build the CRTM library" ) - set(BUILD_W3EMC "OFF" CACHE INTERNAL "Build the EMC library" ) - set(BUILD_NCO "OFF" CACHE INTERNAL "Build the NCO library" ) -endmacro() diff --git a/cmake/Modules/platforms/Hera.cmake b/cmake/Modules/platforms/Hera.cmake deleted file mode 100644 index d8af27696c..0000000000 --- a/cmake/Modules/platforms/Hera.cmake +++ /dev/null @@ -1,42 +0,0 @@ -macro (setHERA) - message("Setting paths for HERA") - option(FIND_HDF5 "Try to Find HDF5 libraries" ON) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "ON") - - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.0.5" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() - diff --git a/cmake/Modules/platforms/Jet.cmake b/cmake/Modules/platforms/Jet.cmake deleted file mode 100644 index 8178526d40..0000000000 --- a/cmake/Modules/platforms/Jet.cmake +++ /dev/null @@ -1,10 +0,0 @@ -macro (setJet) - message("Setting paths for Jet") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") -endmacro() - diff --git a/cmake/Modules/platforms/Orion.cmake b/cmake/Modules/platforms/Orion.cmake deleted file mode 100644 index 56ddd1f2c3..0000000000 --- a/cmake/Modules/platforms/Orion.cmake +++ /dev/null @@ -1,42 +0,0 @@ -macro (setOrion) - message("Setting paths for Orion") - option(FIND_HDF5 "Try to Find HDF5 libraries" ON) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "ON") - - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.0.5" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() - diff --git a/cmake/Modules/platforms/S4.cmake b/cmake/Modules/platforms/S4.cmake deleted file mode 100644 index c727765c16..0000000000 --- a/cmake/Modules/platforms/S4.cmake +++ /dev/null @@ -1,10 +0,0 @@ -macro (setS4) - message("Setting paths for S4") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "OFF") -endmacro() diff --git a/cmake/Modules/platforms/WCOSS-C.cmake b/cmake/Modules/platforms/WCOSS-C.cmake deleted file mode 100644 index 1c9cf712cd..0000000000 --- a/cmake/Modules/platforms/WCOSS-C.cmake +++ /dev/null @@ -1,60 +0,0 @@ -macro (setWCOSS_C) - - message("Setting flags and paths for Cray") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "" CACHE INTERNAL "MKL flag" ) - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") - set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/gpfs/hps/nco/ops/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/gpfs/hps/nco/ops/nwprod/lib/crtm" ) - endif() - if( NOT DEFINED ENV{WRFPATH} ) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-intel" ) - else() - set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-cray" ) - endif() - else() - set(WRFPATH $ENV{WRFPATH} ) - endif() - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "11.0.1" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.2" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.2.0" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() diff --git a/cmake/Modules/platforms/WCOSS-D.cmake b/cmake/Modules/platforms/WCOSS-D.cmake deleted file mode 100644 index e0daffa593..0000000000 --- a/cmake/Modules/platforms/WCOSS-D.cmake +++ /dev/null @@ -1,51 +0,0 @@ -macro (setWCOSS_D) - message("Setting paths for Dell") - option(FIND_HDF5 "Try to Find HDF5 libraries" ON) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "GSI Fortran Flags") - set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS} ${MKL_FLAG}" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "ENKF Fortran Flags") - - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "" ) - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/gpfs/dell1/nco/ops/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/gpfs/dell1/nco/ops/nwprod/lib/crtm" ) - endif() - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "11.3.0" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.5" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.3.0" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() diff --git a/cmake/Modules/platforms/WCOSS.cmake b/cmake/Modules/platforms/WCOSS.cmake deleted file mode 100644 index 81b1297392..0000000000 --- a/cmake/Modules/platforms/WCOSS.cmake +++ /dev/null @@ -1,61 +0,0 @@ -macro (setWCOSS) - message("Setting paths for WCOSS") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HDF5_USE_STATIC_LIBRARIES "OFF") - - #if ibmpe module is not loaded last, CMake tries to use intel mpi. Force use of ibmhpc - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set( MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${HOST_FLAG} " CACHE INTERNAL "") - - set(MPI_Fortran_COMPILER /opt/ibmhpc/pe13010/base/bin/mpif90 CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - set(MPI_C_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicc CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - set(MPI_CXX_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicxx CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/nwprod2/lib" ) - endif() - if( NOT DEFINED ENV{WRFPATH} ) - set(WRFPATH "/nwprod/sorc/wrf_shared.fd" ) - else() - set(WRFPATH $ENV{WRFPATH} ) - endif() - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.0.5" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() - -endmacro() diff --git a/cmake/Modules/setGNUFlags.cmake b/cmake/Modules/setGNUFlags.cmake deleted file mode 100644 index e4ef2d9ade..0000000000 --- a/cmake/Modules/setGNUFlags.cmake +++ /dev/null @@ -1,66 +0,0 @@ -function (setGNU) - set(COMPILER_TYPE "gnu" CACHE INTERNAL "Compiler brand") - message("Setting GNU Compiler Flags") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") - set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -DLINUX -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) - set( FV3GFS_NCIO_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) - set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "") - set( COV_CALC_FLAGS "-c -O3 -fconvert=little-endian -ffast-math -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fopenmp" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") - else( ) #DEBUG - set(GSI_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -fbacktrace -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") - set(BUFR_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -fbacktrace -g -fbacktrace -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BACIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -fbacktrace -std=f2003 -fdollar-ok -g -fbacktrace -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -g -fbacktrace -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -DLINUX -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) - set( FV3GFS_NCIO_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) - set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -fbacktrace -Wl,-noinhibit-exec" CACHE INTERNAL "") - set( COV_CALC_FLAGS "-c -O3 -fconvert=little-endian -ffast-math -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fopenmp" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") - endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) -endfunction() - diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake deleted file mode 100644 index bdf358c332..0000000000 --- a/cmake/Modules/setHOST.cmake +++ /dev/null @@ -1,97 +0,0 @@ -macro( setHOST ) - site_name(HOSTNAME) - message("The hostname is ${HOSTNAME}" ) - string(REGEX MATCH "s4-" HOST-S4 ${HOSTNAME} ) - string(REGEX MATCH "gaea" HOST-Gaea ${HOSTNAME} ) - string(REGEX MATCH "hfe[0-9]" HOST-Hera ${HOSTNAME} ) - string(REGEX MATCH "Orion" HOST-Orion ${HOSTNAME} ) - if(EXISTS /jetmon) - set(HOST-Jet "True" ) - endif() - string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - if( HOST-WCOSS ) - message("host is WCOSS") - endif() - string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - if( NOT HOST-WCOSS ) # don't overwrite if we are on gyre - string(REGEX MATCH "t[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - endif() - string(REGEX MATCH "v[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus Phase 3 - string(REGEX MATCH "v[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - endif() - if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus/Phase 3.5 - string(REGEX MATCH "m[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - if( NOT HOST-WCOSS_D )# don't overwrite if we are on mars Phase 3 - string(REGEX MATCH "m[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - endif() - endif() - string(REGEX MATCH "llogin" HOST-WCOSS_C ${HOSTNAME} ) - if( NOT HOST-WCOSS_C )# don't overwrite if we are on luna - string(REGEX MATCH "slogin" HOST-WCOSS_C ${HOSTNAME} ) - endif() - string(REGEX MATCH "discover" HOST-Discover ${HOSTNAME} ) - string(REGEX MATCH "cheyenne" HOST-Cheyenne ${HOSTNAME} ) - message("done figuring out host--${HOSTNAME}") - if ( BUILD_CORELIBS ) - MESSAGE(STATUS "BUILD_CORELIBS manually-specified as ON") - set( host "GENERIC" ) - set( HOST-Generic "TRUE" ) - setGeneric() - elseif(HOST-Jet) - option(BUILD_CORELIBS "Build the Core libraries " ON) - set( host "Jet" ) - set( HOST-Jet "TRUE" ) - setJet() - elseif( HOST-S4 ) - option(BUILD_CORELIBS "Build the Core libraries " ON) - set( host "S4" ) - set( HOST-S4 "TRUE" ) - setS4() - elseif( HOST-WCOSS ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - set( host "WCOSS" ) - set( HOST-WCOSS "TRUE" ) - setWCOSS() - elseif( HOST-Hera ) - set( host "Hera" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setHERA() - set( HOST-Hera "TRUE" ) - elseif( HOST-Orion ) - set( host "Orion" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setOrion() - set( HOST-Orion "TRUE" ) - elseif( HOST-Gaea ) - set( host "Gaea" ) - option(BUILD_CORELIBS "Build the Core libraries " On) - setGaea() - set( HOST-Gaea "TRUE" ) - elseif( HOST-Cheyenne ) - option(BUILD_CORELIBS "Build the Core libraries " ON) - set( host "Cheyenne" ) - setCheyenne() - set( HOST-Cheyenne "TRUE" ) - elseif( HOST-WCOSS_C ) - set( host "WCOSS_C" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setWCOSS_C() - set( HOST-WCOSS_C "TRUE" ) - elseif( HOST-WCOSS_D ) - set( host "WCOSS_D" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setWCOSS_D() - set( HOST-WCOSS_D "TRUE" ) - elseif( HOST-Discover ) - set(host "Discover" ) - setDiscover() - set( HOST-Discover "TRUE" ) - else( ) - set( host "GENERIC" ) - option(BUILD_CORELIBS "Build the Core libraries " ON) - setGeneric() - set( HOST-Generic "TRUE" ) - endif() - message("Host is set to ${host}") -endmacro() diff --git a/cmake/Modules/setIntelFlags.cmake b/cmake/Modules/setIntelFlags.cmake deleted file mode 100644 index 88e5061ffc..0000000000 --- a/cmake/Modules/setIntelFlags.cmake +++ /dev/null @@ -1,94 +0,0 @@ -set(intsize 4) -function(set_LIBRARY_UTIL_Intel) - set(BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp ${HOST_FLAG} " CACHE INTERNAL "" ) - set(BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -O3 ${HOST_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) - set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback ${HOST_FLAG}" CACHE INTERNAL "" ) - set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_Fortran_4_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3EMC_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) - set (NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "" ) - set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) - set(FV3GFS_NCIO_Fortran_FLAGS "-free" CACHE INTERNAL "" ) - set(UTIL_Fortran_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone" CACHE INTERNAL "") -# set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert little_endian -D_REAL8_ -openmp -fpp -auto" CACHE INTERNAL "" ) - set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert little_endian ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") -# set(COV_CALC_FLAGS ${GSI_Intel_Platform_FLAGS} CACHE INTERNAL "Full GSI Fortran FLAGS" ) -endfunction(set_LIBRARY_UTIL_Intel) - -function(set_LIBRARY_UTIL_Debug_Intel) - set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " CACHE INTERNAL "" ) - set(BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " CACHE INTERNAL "" ) - set(BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) - set(CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_Fortran_4_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3EMC_4_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_4_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) - set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) - set(FV3GFS_NCIO_Fortran_FLAGS "-free" CACHE INTERNAL "" ) - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -Wl,-noinhibit-exec" CACHE INTERNAL "" ) - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(UTIL_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS "-O0 -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian" CACHE INTERNAL "") - set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -implicitnone -traceback -fp-model strict -convert little_endian ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) -endfunction(set_LIBRARY_UTIL_Debug_Intel) - -function(set_GSI_ENKF_Intel) - #Common release/production flags - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) - set(GSI_Fortran_FLAGS "${GSI_Intel_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full GSI Fortran FLAGS" ) - set(ENKF_Fortran_FLAGS "${ENKF_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full ENKF Fortran FLAGS" ) - set(GSDCLOUD_Fortran_FLAGS "-O3 -convert big_endian" CACHE INTERNAL "") -endfunction(set_GSI_ENKF_Intel) - -function (set_GSI_ENKF_Debug_Intel) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") - set(ENKF_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug all -check all,noarg_temp_created -fp-model strict -convert big_endian -assume byterecl -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -convert big_endian" CACHE INTERNAL "") - #Common debug flags - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) -endfunction (set_GSI_ENKF_Debug_Intel) - -function (setIntel) - string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) - list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) - list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) - list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) - set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") - set(COMPILER_TYPE "intel" CACHE INTERNAL "Compiler brand") - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) - set(EXTRA_LINKER_FLAGS ${MKL_FLAG} CACHE INTERNAL "Extra Linker flags") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set_GSI_ENKF_Intel() - set_LIBRARY_UTIL_Intel() - else( ) #DEBUG flags - message("Building DEBUG version of GSI") - set( debug_suffix "_DBG" CACHE INTERNAL "" ) - set_GSI_ENKF_Debug_Intel() - set_LIBRARY_UTIL_Debug_Intel() - endif() -endfunction() - diff --git a/cmake/Modules/setPGIFlags.cmake b/cmake/Modules/setPGIFlags.cmake deleted file mode 100644 index 2088a7416d..0000000000 --- a/cmake/Modules/setPGIFlags.cmake +++ /dev/null @@ -1,78 +0,0 @@ -function (setPGI) - message("Setting PGI Compiler Flags") - set(COMPILER_TYPE "pgi" CACHE INTERNAL "Compiler brand") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set(CMAKE_Fortran_FLAGS_RELEASE "") - set(Fortran_FLAGS "" CACHE INTERNAL "") - set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -O3 -byteswapio -fast" CACHE INTERNAL "") - - set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - - set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") - set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_4_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -DLINUX -O1 -byteswapio " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 " CACHE INTERNAL "") - set(COV_CALC_FLAGS "-O3 -byteswapio -mp" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") - if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) - set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) - else() - set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) - endif() - else() - set(Fortran_FLAGS "" CACHE INTERNAL "") - set(GSI_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -traceback -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -g -traceback -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -g -traceback -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -g -traceback -byteswapio -fast" CACHE INTERNAL "") - - set(BUFR_Fortran_FLAGS "-g -traceback -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -traceback -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - - set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") - set(BACIO_Fortran_FLAGS " -g -traceback -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -traceback -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -g -traceback -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -g -traceback -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_4_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -DLINUX -g -traceback -D_REAL8_ -mp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -traceback " CACHE INTERNAL "") - set(COV_CALC_FLAGS "-O3 -byteswapio -traceback -mp" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") - if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) - set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) - else() - set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) - endif() - endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) -endfunction() diff --git a/cmake/Modules/setPlatformVariables.cmake b/cmake/Modules/setPlatformVariables.cmake deleted file mode 100644 index 79408821a6..0000000000 --- a/cmake/Modules/setPlatformVariables.cmake +++ /dev/null @@ -1,11 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Jet.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-C.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/S4.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Hera.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Orion.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Gaea.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Cheyenne.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Discover.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-D.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Generic.cmake) diff --git a/src/class_get_fv3_regional_ensperts.f90 b/src/class_get_fv3_regional_ensperts.f90 deleted file mode 100644 index e3e4b5ed46..0000000000 --- a/src/class_get_fv3_regional_ensperts.f90 +++ /dev/null @@ -1,32 +0,0 @@ -module abstract_get_fv3_regional_ensperts_mod -!clt first copied from class_get_wrf_nmm_ensperts.f90 - type, abstract :: abstract_get_fv3_regional_ensperts_class - contains - procedure(get_fv3_regional_ensperts), deferred, pass(this) :: get_fv3_regional_ensperts -!cltthink procedure(convert_binary_nmm_ens), deferred, pass(this) :: convert_binary_nmm_ens - end type abstract_get_fv3_regional_ensperts_class - - abstract interface - subroutine get_fv3_regional_ensperts(this,en_perts,nelen,ps_bar) - use gsi_bundlemod, only: gsi_bundle - use kinds, only: r_kind,i_kind,r_single - - import abstract_get_fv3_regional_ensperts_class - implicit none - class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this - type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - real(r_single),dimension(:,:,:),allocatable, intent(inout):: ps_bar - - end subroutine get_fv3_regional_ensperts - end interface - abstract interface - - subroutine convert_binary_fv3_regional_ens(this) - import abstract_get_fv3_regional_ensperts_class - implicit none - class(abstract_get_fv3_regional_ensperts_class),intent(inout) :: this - end subroutine convert_binary_fv3_regional_ens - end interface - -end module abstract_get_fv3_regional_ensperts_mod diff --git a/src/cplr_get_fv3_regional_ensperts.f90 b/src/cplr_get_fv3_regional_ensperts.f90 deleted file mode 100644 index 112ea9457f..0000000000 --- a/src/cplr_get_fv3_regional_ensperts.f90 +++ /dev/null @@ -1,667 +0,0 @@ -module get_fv3_regional_ensperts_mod -!clt started from cplr_get_fv3_regional_ensperts.f90 -use abstract_get_fv3_regional_ensperts_mod - use kinds, only : i_kind - type, extends(abstract_get_fv3_regional_ensperts_class) :: get_fv3_regional_ensperts_class - contains - procedure, pass(this) :: get_fv3_regional_ensperts => get_fv3_regional_ensperts_run - procedure, pass(this) :: ens_spread_dualres_regional => ens_spread_dualres_regional_fv3_regional - procedure, pass(this) :: general_read_fv3_regional - end type get_fv3_regional_ensperts_class -contains - subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) - !$$$ subprogram documentation block - ! . . . . - ! subprogram: get_fv3_regional_ensperts read arw model ensemble members - ! prgmmr: Ting org: ncar/mmm date: 2018-12-13 - ! - ! abstract: read ensemble members from the fv3 regional (fv3_SAR) - ! model,following Wanshu's programs to read those background files - ! - ! - ! program history log: - ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle - ! - ! input argument list: - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - - use kinds, only: r_kind,i_kind,r_single - use constants, only: zero,one,half,zero_single,rd_over_cp,one_tenth - use mpimod, only: mpi_comm_world,ierror,mype - use hybrid_ensemble_parameters, only: n_ens,grd_ens - use hybrid_ensemble_parameters, only: ntlevs_ens,ensemble_path - use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d - use gsi_bundlemod, only: gsi_bundlecreate - use gsi_bundlemod, only: gsi_grid - use gsi_bundlemod, only: gsi_bundle - use gsi_bundlemod, only: gsi_bundlegetpointer - use gsi_bundlemod, only: gsi_bundledestroy - use gsi_bundlemod, only: gsi_gridcreate - use guess_grids, only: ntguessig,ifilesig - use gsi_4dvar, only: nhr_assimilation - use gsi_4dvar, only: ens_fhrlevs - use gsi_rfv3io_mod, only: type_fv3regfilenameg - - implicit none - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type(gsi_bundle),allocatable, intent(inout) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - real(r_single),dimension(:,:,:),allocatable,intent(inout):: ps_bar - - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig):: u,v,tv,cwmr,oz,rh - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2):: ps - - real(r_single),pointer,dimension(:,:,:):: w3 - real(r_single),pointer,dimension(:,:):: w2 - real(r_kind),pointer,dimension(:,:,:):: x3 - real(r_kind),pointer,dimension(:,:):: x2 - type(gsi_bundle),allocatable,dimension(:):: en_bar - type(gsi_grid):: grid_ens - real(r_kind):: bar_norm,sig_norm,kapr,kap1 - - integer(i_kind):: i,j,k,n,mm1,istatus - integer(i_kind):: ic2,ic3 - integer(i_kind):: m - - character(255) filelists(ntlevs_ens) - character(255) ensfilenam_str - type(type_fv3regfilenameg)::fv3_filename - - call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) - ! Allocate bundle to hold mean of ensemble members - allocate(en_bar(ntlevs_ens)) - do m=1,ntlevs_ens - call gsi_bundlecreate(en_bar(m),grid_ens,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' get_fv3_regional_ensperts_netcdf: trouble creating en_bar bundle' - call stop2(999) - endif - enddo ! for m - - - do m=1,ntlevs_ens - - - - ! - ! INITIALIZE ENSEMBLE MEAN ACCUMULATORS - en_bar(m)%values=zero - - do n=1,n_ens - en_perts(n,m)%valuesr4 = zero - enddo - - mm1=mype+1 - kap1=rd_over_cp+one - kapr=one/rd_over_cp - ! - ! LOOP OVER ENSEMBLE MEMBERS - do n=1,n_ens - write(ensfilenam_str,22) trim(adjustl(ensemble_path)),ens_fhrlevs(m),n -22 format(a,'fv3SAR',i2.2,'_ens_mem',i3.3) - ! DEFINE INPUT FILE NAME - fv3_filename%grid_spec=trim(ensfilenam_str)//'-fv3_grid_spec' !exmaple thinktobe - fv3_filename%ak_bk=trim(ensfilenam_str)//'fv3_akbk' - fv3_filename%dynvars=trim(ensfilenam_str)//'-fv3_dynavars' - fv3_filename%tracers=trim(ensfilenam_str)//"-fv3_tracer" - fv3_filename%sfcdata=trim(ensfilenam_str)//"-fv3_sfcdata" - fv3_filename%couplerres=trim(ensfilenam_str)//"-coupler.res" - ! - ! READ ENEMBLE MEMBERS DATA - if (mype == 0) write(6,'(a,a)') 'CALL READ_FV3_REGIONAL_ENSPERTS FOR ENS DATA with the filename str : ',trim(ensfilenam_str) - call this%general_read_fv3_regional(fv3_filename,ps,u,v,tv,rh,oz,mype) - - ! SAVE ENSEMBLE MEMBER DATA IN COLUMN VECTOR - do ic3=1,nc3d - - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars3d(ic3)),w3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for ensemble member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars3d(ic3)),x3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for en_bar' - call stop2(999) - end if - - select case (trim(cvars3d(ic3))) - - case('sf','SF') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = u(j,i,k) - x3(j,i,k)=x3(j,i,k)+u(j,i,k) - end do - end do - end do - - case('vp','VP') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = v(j,i,k) - x3(j,i,k)=x3(j,i,k)+v(j,i,k) - end do - end do - end do - - case('t','T') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = tv(j,i,k) - x3(j,i,k)=x3(j,i,k)+tv(j,i,k) - end do - end do - end do - - case('q','Q') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = rh(j,i,k) - x3(j,i,k)=x3(j,i,k)+rh(j,i,k) - end do - end do - end do - - case('oz','OZ') - - do k=1,grd_ens%nsig - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w3(j,i,k) = oz(j,i,k) - x3(j,i,k)=x3(j,i,k)+oz(j,i,k) - end do - end do - end do - - - end select - end do - - do ic2=1,nc2d - - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars2d(ic2)),w2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for ensemble member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar' - call stop2(999) - end if - - select case (trim(cvars2d(ic2))) - - case('ps','PS') - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w2(j,i) = ps(j,i) - x2(j,i)=x2(j,i)+ps(j,i) - end do - end do - - case('sst','SST') - ! IGNORE SST IN HYBRID for now - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - w2(j,i) = zero - x2(j,i)=zero - end do - end do - - end select - end do - enddo - ! - ! CALCULATE ENSEMBLE MEAN - bar_norm = one/float(n_ens) - en_bar(m)%values=en_bar(m)%values*bar_norm - - ! Copy pbar to module array. ps_bar may be needed for vertical localization - ! in terms of scale heights/normalized p/p - do ic2=1,nc2d - - if(trim(cvars2d(ic2)) == 'ps'.or.trim(cvars2d(ic2)) == 'PS') then - - call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar to get ps_bar' - call stop2(999) - end if - - do i=1,grd_ens%lon2 - do j=1,grd_ens%lat2 - ps_bar(j,i,1)=x2(j,i) - end do - end do - exit - end if - end do - - call mpi_barrier(mpi_comm_world,ierror) - ! - ! CALCULATE ENSEMBLE SPREAD - call this%ens_spread_dualres_regional(mype,en_perts,nelen,en_bar(m)) - call mpi_barrier(mpi_comm_world,ierror) - ! - ! CONVERT ENSEMBLE MEMBERS TO ENSEMBLE PERTURBATIONS - sig_norm=sqrt(one/max(one,n_ens-one)) - - do n=1,n_ens - do i=1,nelen - en_perts(n,m)%valuesr4(i)=(en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i))*sig_norm - end do - end do - - enddo ! it 4d loop - do m=1,ntlevs_ens - call gsi_bundledestroy(en_bar(m),istatus) - if(istatus/=0) then - write(6,*)' in get_fv3_regional_ensperts_netcdf: trouble destroying en_bar bundle' - call stop2(999) - endif - end do - - deallocate(en_bar) - ! - - return - -30 write(6,*) 'get_fv3_regional_ensperts_netcdf: open filelist failed ' - call stop2(555) -20 write(6,*) 'get_fv3_regional_ensperts_netcdf: read WRF-ARW ens failed ',n - call stop2(555) - - end subroutine get_fv3_regional_ensperts_run - - subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g_rh,g_oz,mype) -!clt modified from rad_fv3_netcdf_guess - !$$$ subprogram documentation block - ! . . . . - ! subprogram: general_read_fv3_regional read arw model ensemble members - ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 - ! - ! abstract: read ensemble members from the arw model in "wrfout" netcdf format - ! for use with hybrid ensemble option. - ! - ! program history log: - ! 2010-08-11 parrish, initial documentation - ! 2010-09-10 parrish, modify so ensemble variables are read in the same way as in - ! subroutines convert_netcdf_mass and read_fv3_regional_binary_guess. - ! There were substantial differences due to different opinion about what - ! to use for surface pressure. This issue should be resolved by coordinating - ! with Ming Hu (ming.hu@noaa.gov). At the moment, these changes result in - ! agreement to single precision between this input method and the guess input - ! procedure when the same file is read by both methods. - ! 2012-03-12 whitaker: read data on root, distribute with scatterv. - ! remove call to general_reload. - ! simplify, fix memory leaks, reduce memory footprint. - ! use genqsat, remove genqsat2_regional. - ! replace bare 'stop' statements with call stop2(999). - ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS core - ! - ! input argument list: - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - - use netcdf, only: nf90_nowrite - use netcdf, only: nf90_open,nf90_close - use netcdf, only: nf90_inq_dimid,nf90_inquire_dimension - use netcdf, only: nf90_inq_varid,nf90_inquire_variable,nf90_get_var - use kinds, only: r_kind,r_single,i_kind - use gridmod, only: nsig,eta1_ll,pt_ll,aeta1_ll,eta2_ll,aeta2_ll - use constants, only: zero,one,fv,zero_single,rd_over_cp_mass,one_tenth,h300 - use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens - use mpimod, only: mpi_comm_world,ierror,mpi_rtype - use mpimod, only: npe - use netcdf_mod, only: nc_check - use gsi_rfv3io_mod,only: type_fv3regfilenameg - use gsi_rfv3io_mod,only:n2d - use gsi_rfv3io_mod,only:mype_t,mype_p ,mype_q,mype_oz - use constants, only: half,zero - use gsi_rfv3io_mod, only: gsi_fv3ncdf_read - use gsi_rfv3io_mod, only: gsi_fv3ncdf_readuv - - implicit none - ! - ! Declare passed variables - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type (type_fv3regfilenameg) , intent (in) :: fv3_filenameginput - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig),intent(out)::g_u,g_v,g_tv,g_rh,g_oz - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2),intent(out):: g_ps - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) ::g_tsen, g_q,g_prsl - real(r_kind),dimension(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig+1) ::g_prsi - ! - ! Declare local parameters - real(r_kind),parameter:: r0_01 = 0.01_r_kind - real(r_kind),parameter:: r10 = 10.0_r_kind - real(r_kind),parameter:: r100 = 100.0_r_kind - ! - ! Declare local variables - real(r_single),allocatable,dimension(:):: temp_1d - real(r_single),allocatable,dimension(:,:):: temp_2d,temp_2d2 - real(r_single),allocatable,dimension(:,:,:):: temp_3d - real(r_kind),allocatable,dimension(:):: p_top - real(r_kind),allocatable,dimension(:,:):: q_integral,gg_ps,q_integralc4h - real(r_kind),allocatable,dimension(:,:,:):: tsn,qst,prsl,& - gg_u,gg_v,gg_tv,gg_rh - real(r_kind),allocatable,dimension(:):: wrk_fill_2d - integer(i_kind),allocatable,dimension(:):: dim,dim_id - - integer(i_kind):: nx,ny,nz,i,j,k,d_max,file_id,var_id,ndim,mype,kp - integer(i_kind):: Time_id,s_n_id,w_e_id,b_t_id,s_n_stag_id,w_e_stag_id,b_t_stag_id - integer(i_kind):: Time_len,s_n_len,w_e_len,b_t_len,s_n_stag_len,w_e_stag_len,b_t_stag_len - integer(i_kind) iderivative - - real(r_kind):: deltasigma - real(r_kind) psfc_this_dry,psfc_this - real(r_kind) work_prslk,work_prsl - - logical ice - - character(len=24),parameter :: myname_ = 'general_read_fv3_regional' - - character(len=:),allocatable :: grid_spec !='fv3_grid_spec' - character(len=:),allocatable :: ak_bk !='fv3_akbk' - character(len=:),allocatable :: dynvars !='fv3_dynvars' - character(len=:),allocatable :: tracers !='fv3_tracer' - character(len=:),allocatable :: sfcdata !='fv3_sfcdata' - character(len=:),allocatable :: couplerres!='coupler.res' - integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) - integer(i_kind),allocatable:: ijnz(:),displsz_g(:) - - grid_spec=fv3_filenameginput%grid_spec - ak_bk=fv3_filenameginput%ak_bk - dynvars=fv3_filenameginput%dynvars - tracers=fv3_filenameginput%tracers - sfcdata=fv3_filenameginput%sfcdata - couplerres=fv3_filenameginput%couplerres - - - - allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) - allocate(displss(npe),displss2d(npe),displsz_g(npe) ) - -!cltthinktobe should be contained in variable like grd_ens - do i=1,npe - ijns(i)=grd_ens%ijn_s(i)*grd_ens%nsig - ijnz(i)=grd_ens%ijn(i)*grd_ens%nsig - ijns2d(i)=grd_ens%ijn_s(i)*n2d - enddo - displss(1)=0 - displsz_g(1)=0 - displss2d(1)=0 - do i=2,npe - displss(i)=displss(i-1)+ ijns(i-1) - displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) - displss2d(i)=displss2d(i-1)+ ijns2d(i-1) - enddo - -! do it=1,nfldsig - - - - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) - g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid - do i=grd_ens%nsig,1,-1 - g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) - enddo - g_ps(:,:)=g_prsi(:,:,1) - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) -! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) - -!! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_tv(i,j,k)=g_tsen(i,j,k)*(one+fv*g_q(i,j,k)) - enddo - enddo - enddo - if (.not.q_hyb_ens) then - ice=.true. - iderivative=0 - do k=1,grd_ens%nsig - kp=k+1 - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_prsl(i,j,k)=(g_prsi(i,j,k)+g_prsi(i,j,kp))*half - - end do - end do - end do - - call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k)/g_rh(i,j,k) - end do - end do - end do - else - do k=1,grd_ens%nsig - do j=1,grd_ens%lon2 - do i=1,grd_ens%lat2 - g_rh(i,j,k) = g_q(i,j,k) - end do - end do - end do - end if - - - -!clt not needed call gsi_fv3ncdf2d_read(it,ges_z) - - return - end subroutine general_read_fv3_regional - subroutine ens_spread_dualres_regional_fv3_regional(this,mype,en_perts,nelen,en_bar) - !$$$ subprogram documentation block - ! . . . . - ! subprogram: ens_spread_dualres_regional - ! prgmmr: mizzi org: ncar/mmm date: 2010-08-11 - ! - ! abstract: - ! - ! - ! program history log: - ! 2010-08-11 parrish, initial documentation - ! 2011-04-05 parrish - add pseudo-bundle capability - ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle - ! - ! input argument list: - ! en_bar - ensemble mean - ! mype - current processor number - ! - ! output argument list: - ! - ! attributes: - ! language: f90 - ! machine: ibm RS/6000 SP - ! - !$$$ end documentation block - ! - use kinds, only: r_single,r_kind,i_kind - use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_anl,p_e2a,uv_hyb_ens, & - regional_ensemble_option - use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_create_info,general_sube2suba - use constants, only: zero,two,half,one - use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d - use gsi_bundlemod, only: gsi_bundlecreate - use gsi_bundlemod, only: gsi_grid - use gsi_bundlemod, only: gsi_bundle - use gsi_bundlemod, only: gsi_bundlegetpointer - use gsi_bundlemod, only: gsi_bundledestroy - use gsi_bundlemod, only: gsi_gridcreate - implicit none - - class(get_fv3_regional_ensperts_class), intent(inout) :: this - type(gsi_bundle),OPTIONAL,intent(in):: en_bar - integer(i_kind),intent(in):: mype - type(gsi_bundle),allocatable, intent(in ) :: en_perts(:,:) - integer(i_kind), intent(in ):: nelen - - type(gsi_bundle):: sube,suba - type(gsi_grid):: grid_ens,grid_anl - real(r_kind) sp_norm,sig_norm_sq_inv - type(sub2grid_info)::se,sa - integer(i_kind) k - - integer(i_kind) i,n,ic3 - logical regional - integer(i_kind) num_fields,inner_vars,istat,istatus - logical,allocatable::vector(:) - real(r_kind),pointer,dimension(:,:,:):: st,vp,tv,rh,oz,cw - real(r_kind),pointer,dimension(:,:):: ps - real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2,grd_anl%nsig),target::dum3 - real(r_kind),dimension(grd_anl%lat2,grd_anl%lon2),target::dum2 - - associate( this => this ) ! eliminates warning for unused dummy argument needed for binding - end associate - - ! create simple regular grid - call gsi_gridcreate(grid_anl,grd_anl%lat2,grd_anl%lon2,grd_anl%nsig) - call gsi_gridcreate(grid_ens,grd_ens%lat2,grd_ens%lon2,grd_ens%nsig) - - ! create two internal bundles, one on analysis grid and one on ensemble grid - - call gsi_bundlecreate (suba,grid_anl,'ensemble work',istatus, & - names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' in ens_spread_dualres_regional: trouble creating bundle_anl bundle' - call stop2(999) - endif - call gsi_bundlecreate (sube,grid_ens,'ensemble work ens',istatus, & - names2d=cvars2d,names3d=cvars3d,bundle_kind=r_kind) - if(istatus/=0) then - write(6,*)' ens_spread_dualres_regional: trouble creating bundle_ens bundle' - call stop2(999) - endif - - sp_norm=(one/float(n_ens)) - - sube%values=zero - ! - - if(regional_ensemble_option == 1)then - print *,'global ensemble' - sig_norm_sq_inv=n_ens-one - - do n=1,n_ens - do i=1,nelen - sube%values(i)=sube%values(i) & - +en_perts(n,1)%valuesr4(i)*en_perts(n,1)%valuesr4(i) - end do - end do - - do i=1,nelen - sube%values(i) = sqrt(sp_norm*sig_norm_sq_inv*sube%values(i)) - end do - else - do n=1,n_ens - do i=1,nelen - sube%values(i)=sube%values(i) & - +(en_perts(n,1)%valuesr4(i)-en_bar%values(i))*(en_perts(n,1)%valuesr4(i)-en_bar%values(i)) - end do - end do - - do i=1,nelen - sube%values(i) = sqrt(sp_norm*sube%values(i)) - end do - end if - - if(grd_ens%latlon1n == grd_anl%latlon1n) then - do i=1,nelen - suba%values(i)=sube%values(i) - end do - else - inner_vars=1 - num_fields=max(0,nc3d)*grd_ens%nsig+max(0,nc2d) - allocate(vector(num_fields)) - vector=.false. - do ic3=1,nc3d - if(trim(cvars3d(ic3))=='sf'.or.trim(cvars3d(ic3))=='vp') then - do k=1,grd_ens%nsig - vector((ic3-1)*grd_ens%nsig+k)=uv_hyb_ens - end do - end if - end do - call general_sub2grid_create_info(se,inner_vars,grd_ens%nlat,grd_ens%nlon,grd_ens%nsig,num_fields, & - regional,vector) - call general_sub2grid_create_info(sa,inner_vars,grd_anl%nlat,grd_anl%nlon,grd_anl%nsig,num_fields, & - regional,vector) - deallocate(vector) - call general_sube2suba(se,sa,p_e2a,sube%values,suba%values,regional) - end if - - dum2=zero - dum3=zero - call gsi_bundlegetpointer(suba,'sf',st,istat) - if(istat/=0) then - write(6,*)' no sf pointer in ens_spread_dualres, point st at dum3 array' - st => dum3 - end if - call gsi_bundlegetpointer(suba,'vp',vp,istat) - if(istat/=0) then - write(6,*)' no vp pointer in ens_spread_dualres, point vp at dum3 array' - vp => dum3 - end if - call gsi_bundlegetpointer(suba,'t',tv,istat) - if(istat/=0) then - write(6,*)' no t pointer in ens_spread_dualres, point tv at dum3 array' - tv => dum3 - end if - call gsi_bundlegetpointer(suba,'q',rh,istat) - if(istat/=0) then - write(6,*)' no q pointer in ens_spread_dualres, point rh at dum3 array' - rh => dum3 - end if - call gsi_bundlegetpointer(suba,'oz',oz,istat) - if(istat/=0) then - write(6,*)' no oz pointer in ens_spread_dualres, point oz at dum3 array' - oz => dum3 - end if - call gsi_bundlegetpointer(suba,'cw',cw,istat) - if(istat/=0) then - write(6,*)' no cw pointer in ens_spread_dualres, point cw at dum3 array' - cw => dum3 - end if - call gsi_bundlegetpointer(suba,'ps',ps,istat) - if(istat/=0) then - write(6,*)' no ps pointer in ens_spread_dualres, point ps at dum2 array' - ps => dum2 - end if - - call write_spread_dualres(st,vp,tv,rh,oz,cw,ps,mype) - - return - end subroutine ens_spread_dualres_regional_fv3_regional - -end module get_fv3_regional_ensperts_mod diff --git a/src/enkf/fv3_netcdf_mod.F90 b/src/enkf/fv3_netcdf_mod.F90 deleted file mode 100644 index 696ae841d9..0000000000 --- a/src/enkf/fv3_netcdf_mod.F90 +++ /dev/null @@ -1,62 +0,0 @@ -module fv3_netcdf_mod - -use kinds, only: r_single, i_kind, r_double, r_single -use netcdf, only: nf90_get_var,nf90_inq_varid -use netcdf_mod, only: nc_check - -implicit none - -private -public :: read_fv3_restart_data1d, read_fv3_restart_data2d, & - read_fv3_restart_data3d, read_fv3_restart_data4d -contains - - subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) - end subroutine read_fv3_restart_data1d - - subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) - end subroutine read_fv3_restart_data2d - - subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1) - end subroutine read_fv3_restart_data3d - - subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1,lbound(data_arr,4):ubound(data_arr,4)) -!Notice, the 4th dimension is not reversed - - end subroutine read_fv3_restart_data4d - -end module fv3_netcdf_mod diff --git a/src/enkf/gridinfo_fv3.f90 b/src/enkf/gridinfo_fv3.f90 deleted file mode 100644 index 859c0bd8e8..0000000000 --- a/src/enkf/gridinfo_fv3.f90 +++ /dev/null @@ -1,226 +0,0 @@ -module gridinfo -!$$$ module documentation block -! -! module: gridinfo read horizontal (lons, lats) and -! vertical (pressure) information from -! ensemble mean first guess file. -! -! prgmmr: whitaker org: esrl/psd date: 2009-02-23 -! -! abstract: This module reads the ensemble mean background file and -! extracts information about the analysis grid, including the -! longitudes and latitudes of the analysis grid points and -! the pressure on each grid point/vertical level. -! -! Public Subroutines: -! getgridinfo: read latitudes, longitudes, pressures and orography for analysis grid, -! broadcast to each task. Compute spherical cartesian coordinate values -! for each analysis horizontal grid point. -! gridinfo_cleanup: deallocate allocated module variables. -! -! Public Variables: -! npts: number of analysis grid points in the horizontal (from module params). -! nlevs: number of analysis vertical levels (from module params). -! specific humidity, ozone and cloud condensate). -! ptop: (real scalar) pressure (hPa) at top model layer interface. -! lonsgrd(npts): real array of analysis grid longitudes (radians). -! latsgrd(npts): real array of analysis grid latitudes (radians). -! logp(npts,ndim): -log(press) for all 2d analysis grids. Assumed invariant -! in assimilation window, computed fro ensemble mean at middle of window. -! gridloc(3,npts): spherical cartesian coordinates (x,y,z) for analysis grid. -! -! Modules Used: mpisetup, params, kinds -! -! program history log: -! 2009-02-23 Initial version. -! 2016-05-02: shlyaeva: Modification for reading state vector from table -! 2016-04-20 Modify to handle the updated nemsio sig file (P, DP & DPDT removed) -! -! attributes: -! language: f95 -! -!$$$ - -use mpisetup, only: nproc, mpi_integer, mpi_real4, mpi_comm_world -use params, only: datapath,nlevs,nlons,nlats,use_gfs_nemsio, fgfileprefixes, & - fv3fixpath, res, ntiles -use kinds, only: r_kind, i_kind, r_double, r_single -use constants, only: one,zero,pi,cp,rd,grav,rearth,max_varname_length -use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr -use netcdf, only: nf90_inq_dimid,nf90_inq_varid -use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension -use netcdf_mod, only: nc_check - -implicit none -private -public :: getgridinfo, gridinfo_cleanup -integer(i_kind),public :: nlevs_pres, idvc -real(r_single),public :: ptop -real(r_single),public, allocatable, dimension(:) :: lonsgrd, latsgrd -! arrays passed to kdtree2 routines must be single -real(r_single),public, allocatable, dimension(:,:) :: gridloc -real(r_single),public, allocatable, dimension(:,:) :: logp -integer,public :: npts -integer,public :: ntrunc -! supported variable names in anavinfo -character(len=max_varname_length),public, dimension(10) :: vars3d_supported = (/'u ', 'v ', 'tv ', 'q ', 'oz ', 'cw ', 'tsen', 'prse', 'ql ', 'qi '/) -character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) -! supported variable names in anavinfo -contains - -subroutine getgridinfo(fileprefix, reducedgrid) -! read latitudes, longitudes and pressures for analysis grid, -! broadcast to each task. -use fv3_netcdf_mod, only: read_restart_data2d -implicit none - -character(len=120), intent(in) :: fileprefix -logical, intent(in) :: reducedgrid - -integer(i_kind) nlevsin, ierr, iunit, k, nn, idvc -character(len=500) filename -integer(i_kind) iret,i,j,nlonsin,nlatsin -real(r_kind), allocatable, dimension(:) :: spressmn,tmpspec -real(r_kind), allocatable, dimension(:,:) :: pressimn,presslmn -real(r_single),allocatable,dimension(:,:,:) :: nems_vcoord -real(r_kind) kap,kapr,kap1 - -integer(i_kind) i,j,nn,file_id,var_id,dim_id,nlevsp1 -real(r_single), allocatable, dimension(:,:) :: ak,bk,lat_tile,lon_tile,ps -real(r_single), allocatable, dimension(:,:,:,:) :: delp -real(r_single) ptop -character(len=4) char_res -character(len=1) char_tile - -nlevsp1 = nlevs + 1 -nlevs_pres = nlevsp1 -npts = ntiles*res*res -kap = rd/cp -kapr = cp/rd -kap1 = kap + one - -! read data on root task -if (nproc .eq. 0) then - - ! read ak,bk from ensmean fv_core.res.nc - filename = trim(adjustl(fileprefix))//'/ensmean/INPUT/fv_core.res.nc' - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& - myname_,'inq_dimid xaxis_1 '//trim(filename) ) - call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1),& - myname_,'inquire_dimension xaxis_1 '//trim(filename) ) - allocate(ak(nlevsp1,1),bk(nlevsp1,1)) - call read_fv3_restart_data2d('ak',filename,file_id,ak) - call read_fv3_restart_data2d('bk',filename,file_id,bk) - ptop = ak(1,1) - - ! read lats/lons from C###_oro_data.tile#.nc - ! (this requires path to FV3 fix dir) - write(char_res, '(i4)') res - allocate(lat_tile(res,res),lon_tile(res,res)) - nn = 0 - allocate(latsgrd(npts),lonsgrd(npts)) - do ntile=1,ntiles - nn = nn + 1 - write(char_tile, '(i1)') ntile - filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - call read_fv3_restart_data2d('geolon',filename,file_id,lon_tile) - !print *,'min/max lon_tile',ntile,minval(lon_tile),maxval(lon_tile) - call read_fv3_restart_data2d('geolat',filename,file_id,lat_tile) - !print *,'min/max lat_tile',ntile,minval(lat_tile),maxval(lat_tile) - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - do j=1,res - do i=1,res - latsgrd(nn) = lats_tile(i,j) - lonsgrd(nn) = lons_tile(i,j) - enddo - enddo - latsgrd = pi*latsgrd/180._r_single - lonsgrd = pi*lonsgrd/180._r_single - enddo -!cltthink the unit of the lat/lon - allocate(delp(res,res,nlevs,1),ps(res,nres)) - allocate(pressimn(npts,nlevsp1),presslmn(npts,nlevs)) - nn = 0 - do ntile=1,ntiles - nn = nn + 1 - write(char_tile, '(i1)') ntile - filename = trim(adjustl(datapath))//'/ensmean/fv_core.res.tile'//char_tile//'.nc' - !print *,trim(adjustl(filename)) - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - call read_fv3_restart_data4d('delp',filename,file_id,delp) - !print *,'min/max delp',ntile,minval(delp),maxval(delp) - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - ps = sum(delp,3) + ptop - !print *,'min/max ps',ntile,minval(ps),maxval(ps) - do j=1,res - do i=1,res - spressmn(nn) = ps(i,j) - enddo - enddo - enddo - ! pressure at interfaces - do k=1,nlevsp1 - pressimn(:,k) = ak(nlevs-k,1)+bk(nlevs-k,1)*spressmn(:) - enddo - deallocate(delp,ak,bk,ps) - do k=1,nlevs - ! layer pressure from Phillips vertical interpolation. - presslmn(:,k) = ((pressimn(:,k)**kap1-pressimn(:,k+1)**kap1)/& - (kap1*(pressimn(:,k)-pressimn(:,k+1))))**kapr - end do - print *,'ensemble mean first guess surface pressure:' - print *,minval(spressmn),maxval(spressmn) - ! logp holds log(pressure) or pseudo-height on grid, for each level/variable. - allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers - do k=1,nlevs - ! all variables to be updated are on mid-layers, not layer interfaces. - logp(:,k) = -log(presslmn(:,k)) - !print *,'min/max presslmn',k,minval(presslmn(:,k)),maxval(presslmn(:,k)),minval(logp(:,k)),maxval(logp(:,k)) - end do - logp(:,nlevs_pres) = -log(spressmn(:)) - deallocate(spressmn,presslmn,pressimn) - -endif ! root task - -if (nproc .ne. 0) then - ! allocate arrays on other (non-root) tasks - allocate(latsgrd(npts),lonsgrd(npts)) - allocate(logp(npts,nlevs_pres)) ! log(ens mean first guess press) on mid-layers - allocate(gridloc(3,npts)) - ! initialize reducedgrid_mod on other tasks. - if (reducedgrid) then - call reducedgrid_init(nlons,nlats,asin_gaulats) - end if -endif -!call mpi_bcast(logp,npts*nlevs_pres,mpi_real4,0,MPI_COMM_WORLD,ierr) -do k=1,nlevs_pres - call mpi_bcast(logp(1,k),npts,mpi_real4,0,MPI_COMM_WORLD,ierr) -enddo -call mpi_bcast(lonsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) -call mpi_bcast(latsgrd,npts,mpi_real4,0,MPI_COMM_WORLD,ierr) -call mpi_bcast(ptop,1,mpi_real4,0,MPI_COMM_WORLD,ierr) - -!==> precompute cartesian coords of analysis grid points. -do nn=1,npts - gridloc(1,nn) = cos(latsgrd(nn))*cos(lonsgrd(nn)) - gridloc(2,nn) = cos(latsgrd(nn))*sin(lonsgrd(nn)) - gridloc(3,nn) = sin(latsgrd(nn)) -end do - -end subroutine getgridinfo - -subroutine gridinfo_cleanup() -if (allocated(lonsgrd)) deallocate(lonsgrd) -if (allocated(latsgrd)) deallocate(latsgrd) -if (allocated(logp)) deallocate(logp) -if (allocated(gridloc)) deallocate(gridloc) -end subroutine gridinfo_cleanup - -end module gridinfo diff --git a/src/enkf/read_fv3_restart_data.f90 b/src/enkf/read_fv3_restart_data.f90 deleted file mode 100644 index ddd9522949..0000000000 --- a/src/enkf/read_fv3_restart_data.f90 +++ /dev/null @@ -1,4 +0,0 @@ - call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& - myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) - call nc_check( nf90_get_var(file_id,var_id,data_arr),& - myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) diff --git a/src/enkf/read_fv3_restarts.f90 b/src/enkf/read_fv3_restarts.f90 deleted file mode 100644 index 1542516f2e..0000000000 --- a/src/enkf/read_fv3_restarts.f90 +++ /dev/null @@ -1,165 +0,0 @@ - program read_fv3_restarts - -! ifort -I${NETCDF}/include -O2 -traceback read_fv3_restarts.f90 kinds.o -! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff - -! read data from FV3 restart files. - - use kinds, only: i_kind,r_single,r_kind - use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr - use netcdf, only: nf90_inq_dimid,nf90_inq_varid - use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension - use netcdf_mod, only: nc_check - - implicit none - character(len=120) datapath,filename,fv3fixpath - character(len=24),parameter :: myname_ = 'read_fv3_restarts' - character(len=4) char_res - character(len=1) char_tile - integer(i_kind):: file_id,var_id,dim_id - integer(i_kind):: nlevsp1,ntile,ntiles,nx,ny,res,nlevs - real(r_single), allocatable, dimension(:,:) :: ak,bk,lon_tile,lat_tile - real(r_single), allocatable, dimension(:,:,:) :: ps,zs - real(r_single), allocatable, dimension(:,:,:,:) :: & - delp,u,v,temp,q,oz,cwmr,icmr - real(r_single) ptop - real(r_single) :: grav=9.806 - - - ! these need to be input from namelist - ntiles = 6 - res = 192 - datapath='/scratch3/BMC/gsienkf/whitaker/C192C192_modloc/2016010606/mem001/INPUT' - fv3fixpath='/scratch4/NCEPDEV/global/save/glopara/svn/fv3gfs/fix/fix_fv3_gmted2010' - -! read ak,bk from fv_core.res.nc - filename = trim(adjustl(datapath))//'/fv_core.res.nc' - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - call nc_check( nf90_inq_dimid(file_id,'xaxis_1',dim_id),& - myname_,'inq_dimid xaxis_1 '//trim(filename) ) - call nc_check( nf90_inquire_dimension(file_id,dim_id,len=nlevsp1),& - myname_,'inquire_dimension xaxis_1 '//trim(filename) ) - nlevs = nlevsp1-1 - print *,'nlevsp1 = ',nlevsp1 - allocate(ak(nlevsp1,1),bk(nlevsp1,1)) - - call read_fv3_restart_data2d('ak',filename,file_id,ak) - call read_fv3_restart_data2d('bk',filename,file_id,bk) - ptop = ak(1,1) - print *,'ak=',ak - print *,'bk=',bk - -! read lats/lons from C###_oro_data.tile#.nc -! (this requires path to FV3 fix dir) - write(char_res, '(i4)') res - allocate(lat_tile(res,res),lon_tile(res,res)) - do ntile=1,ntiles - write(char_tile, '(i1)') ntile - filename=trim(adjustl(fv3fixpath))//'/C'//trim(adjustl(char_res))//'/C'//trim(adjustl(char_res))//'_oro_data.tile'//char_tile//'.nc' - print *,trim(adjustl(filename)) - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - - call read_fv3_restart_data2d('geolon',filename,file_id,lon_tile) - print *,'min/max lon_tile',minval(lon_tile),maxval(lon_tile) - - call read_fv3_restart_data2d('geolat',filename,file_id,lat_tile) - print *,'min/max lat_tile',minval(lat_tile),maxval(lat_tile) - - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - enddo - -! read data from fv_core - allocate(delp(res,res,nlevs,1),u(res,res,nlevs,1),v(res,res,nlevs,1),temp(res,res,nlevs,1)) - allocate(ps(res,res,1),zs(res,res,1)) - do ntile=1,ntiles - - write(char_tile, '(i1)') ntile - filename = trim(adjustl(datapath))//'/fv_core.res.tile'//char_tile//'.nc' - print *,trim(adjustl(filename)) - - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - - call read_fv3_restart_data4d('delp',filename,file_id,delp) - print *,'min/max delp',minval(delp),maxval(delp) - - call read_fv3_restart_data4d('u',filename,file_id,u) - print *,'min/max u',minval(u),maxval(u) - - call read_fv3_restart_data4d('v',filename,file_id,v) - print *,'min/max v',minval(v),maxval(v) - - call read_fv3_restart_data4d('T',filename,file_id,temp) - print *,'min/max T',minval(temp),maxval(temp) - - call read_fv3_restart_data3d('phis',filename,file_id,zs) - zs = zs/grav - print *,'min/max zs',minval(zs),maxval(zs) - ps = sum(delp,3) + ptop - print *,'min/max ps',minval(ps),maxval(ps) - - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - - enddo - -! read data from fv_tracer - allocate(q(res,res,nlevs,1),oz(res,res,nlevs,1),cwmr(res,res,nlevs,1),icmr(res,res,nlevs,1)) - do ntile=1,ntiles - - write(char_tile, '(i1)') ntile - filename = trim(adjustl(datapath))//'/fv_tracer.res.tile'//char_tile//'.nc' - print *,trim(adjustl(filename)) - - call nc_check( nf90_open(trim(adjustl(filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(filename)) ) - - call read_fv3_restart_data4d('sphum',filename,file_id,q) - print *,'min/max spfhum',minval(q),maxval(q) - - call read_fv3_restart_data4d('o3mr',filename,file_id,oz) - print *,'min/max o3mr',minval(oz),maxval(oz) - - call read_fv3_restart_data4d('liq_wat',filename,file_id,cwmr) - print *,'min/max cwmr',minval(cwmr),maxval(cwmr) - - call read_fv3_restart_data4d('ice_wat',filename,file_id,icmr) - print *,'min/max icmr',minval(icmr),maxval(icmr) - - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) - - enddo - - deallocate(ak,bk,lon_tile,lat_tile,delp,u,v,temp,zs,ps,q,oz,cwmr,icmr) - - contains - - subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' - include "read_fv3_restart_data.f90" - end subroutine read_fv3_restart_data1d - - subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' - include "read_fv3_restart_data.f90" - end subroutine read_fv3_restart_data2d - - subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' - include "read_fv3_restart_data.f90" - end subroutine read_fv3_restart_data3d - - subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' - include "read_fv3_restart_data.f90" - end subroutine read_fv3_restart_data4d - - end program read_fv3_restarts diff --git a/src/enkf/read_fv3regional_restart_data.f90 b/src/enkf/read_fv3regional_restart_data.f90 deleted file mode 100644 index 39a25cf6a6..0000000000 --- a/src/enkf/read_fv3regional_restart_data.f90 +++ /dev/null @@ -1,8 +0,0 @@ - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& - myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) - call nc_check( nf90_get_var(file_id,var_id,data_arr),& - myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) diff --git a/src/enkf/read_fv3regional_restarts.f90 b/src/enkf/read_fv3regional_restarts.f90 deleted file mode 100644 index 0d3cd5a74e..0000000000 --- a/src/enkf/read_fv3regional_restarts.f90 +++ /dev/null @@ -1,66 +0,0 @@ - module read_fv3regional_restarts -!clt modified from read_fv3_restarts.f90 - -! ifort -I${NETCDF}/include -O2 -traceback read_fv3_restarts.f90 kinds.o -! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff - -! read data from FV3 restart files. - - - use kinds, only: i_kind,r_single,r_kind - use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr - use netcdf, only: nf90_inq_dimid,nf90_inq_varid - use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension - use netcdf_mod, only: nc_check - public read_fv3_restart_data1d,read_fv3_restart_data2d - public read_fv3_restart_data3d,read_fv3_restart_data4d - - contains - - subroutine read_fv3_restart_data1d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data1d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) - end subroutine read_fv3_restart_data1d - - subroutine read_fv3_restart_data2d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data2d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) - end subroutine read_fv3_restart_data2d - - subroutine read_fv3_restart_data3d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data3d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1) - end subroutine read_fv3_restart_data3d - - subroutine read_fv3_restart_data4d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'read_fv3_restart_data4d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - include "read_fv3_restart_data.f90" - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1,ubound(data_arr,4):lbound(data_arr,4):-1) - end subroutine read_fv3_restart_data4d - - end module read_fv3regional_restarts diff --git a/src/enkf/write_fv3_restart_data.f90 b/src/enkf/write_fv3_restart_data.f90 deleted file mode 100644 index 9196d5bb0b..0000000000 --- a/src/enkf/write_fv3_restart_data.f90 +++ /dev/null @@ -1,4 +0,0 @@ - call nc_check( nf90_inq_varid(file_id,trim(adjustl(varname)),var_id),& - myname_,'inq_varid '//trim(adjustl(varname))//' '//trim(filename) ) - call nc_check( nf90_put_var(file_id,var_id,data_arr),& - myname_,'get_var '//trim(adjustl(varname))//' '//trim(filename) ) From 0673863a8c169a977bd4932ce52a24cae5ddcf4b Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Thu, 19 Nov 2020 19:57:19 +0000 Subject: [PATCH 054/155] cleaning files which should be not in the git monitoring --- 1 | 1153 ------------- cmake/Modules/FindBACIO.cmake | 55 + cmake/Modules/FindBUFR.cmake | 60 + cmake/Modules/FindBaselibs.cmake | 68 + cmake/Modules/FindCORELIBS.cmake | 287 ++++ cmake/Modules/FindCRTM.cmake | 81 + cmake/Modules/FindGSICONTROL.cmake | 52 + cmake/Modules/FindHDF5.cmake | 24 + cmake/Modules/FindIP.cmake | 83 + cmake/Modules/FindMPI.cmake | 18 + cmake/Modules/FindNDATE.cmake | 13 + cmake/Modules/FindNEMSIO.cmake | 72 + cmake/Modules/FindNetCDF.cmake | 147 ++ cmake/Modules/FindSFCIO.cmake | 71 + cmake/Modules/FindSIGIO.cmake | 72 + cmake/Modules/FindSP.cmake | 83 + cmake/Modules/FindW3EMC.cmake | 124 ++ cmake/Modules/FindW3NCO.cmake | 81 + cmake/Modules/FindWRF.cmake | 36 + .../NewCMake/CMakeParseArguments.cmake | 11 + cmake/Modules/NewCMake/FindHDF5.cmake | 934 ++++++++++ cmake/Modules/NewCMake/FindMPI.cmake | 1514 +++++++++++++++++ .../NewCMake/FindMPI/fortranparam_mpi.f90.in | 4 + cmake/Modules/NewCMake/FindMPI/libver_mpi.c | 19 + .../NewCMake/FindMPI/libver_mpi.f90.in | 7 + cmake/Modules/NewCMake/FindMPI/mpiver.f90.in | 10 + cmake/Modules/NewCMake/FindMPI/test_mpi.c | 37 + .../Modules/NewCMake/FindMPI/test_mpi.f90.in | 6 + .../FindPackageHandleStandardArgs.cmake | 386 +++++ .../Modules/NewCMake/FindPackageMessage.cmake | 47 + .../SelectLibraryConfigurations.cmake | 70 + cmake/Modules/findHelpers.cmake | 173 ++ cmake/Modules/platforms/Cheyenne.cmake | 24 + cmake/Modules/platforms/Discover.cmake | 55 + cmake/Modules/platforms/Gaea.cmake | 14 + cmake/Modules/platforms/Generic.cmake | 24 + cmake/Modules/platforms/Hera.cmake | 42 + cmake/Modules/platforms/Jet.cmake | 10 + cmake/Modules/platforms/Orion.cmake | 42 + cmake/Modules/platforms/S4.cmake | 10 + cmake/Modules/platforms/WCOSS-C.cmake | 60 + cmake/Modules/platforms/WCOSS-D.cmake | 51 + cmake/Modules/platforms/WCOSS.cmake | 61 + cmake/Modules/setGNUFlags.cmake | 66 + cmake/Modules/setHOST.cmake | 97 ++ cmake/Modules/setIntelFlags.cmake | 94 + cmake/Modules/setPGIFlags.cmake | 78 + cmake/Modules/setPlatformVariables.cmake | 11 + src/enkf/CMakeCache.txt | 313 ---- .../CMakeFiles/2.8.12.2/CMakeCCompiler.cmake | 56 - .../2.8.12.2/CMakeCXXCompiler.cmake | 57 - .../CMakeFiles/2.8.12.2/CMakeSystem.cmake | 15 - .../2.8.12.2/CompilerIdC/CMakeCCompilerId.c | 389 ----- .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 377 ---- .../CMakeDirectoryInformation.cmake | 16 - src/enkf/CMakeFiles/CMakeOutput.log | 263 --- .../CMakeFiles/MODS1.dir/DependInfo.cmake | 38 - src/enkf/CMakeFiles/MODS1.dir/build.make | 88 - .../CMakeFiles/MODS1.dir/cmake_clean.cmake | 8 - src/enkf/CMakeFiles/MODS1.dir/depend.make | 2 - src/enkf/CMakeFiles/MODS1.dir/flags.make | 10 - src/enkf/CMakeFiles/MODS1.dir/progress.make | 2 - .../CMakeFiles/MODS2.dir/DependInfo.cmake | 38 - src/enkf/CMakeFiles/MODS2.dir/build.make | 88 - .../CMakeFiles/MODS2.dir/cmake_clean.cmake | 8 - src/enkf/CMakeFiles/MODS2.dir/depend.make | 2 - src/enkf/CMakeFiles/MODS2.dir/flags.make | 10 - src/enkf/CMakeFiles/MODS2.dir/progress.make | 2 - src/enkf/CMakeFiles/Makefile.cmake | 66 - src/enkf/CMakeFiles/Makefile2 | 67 - src/enkf/CMakeFiles/TargetDirectories.txt | 0 src/enkf/CMakeFiles/cmake.check_cache | 1 - .../enkf_gfs.x.dir/DependInfo.cmake | 43 - src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make | 167 -- .../enkf_gfs.x.dir/cmake_clean.cmake | 10 - .../CMakeFiles/enkf_gfs.x.dir/depend.make | 2 - src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make | 10 - src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt | 1 - .../CMakeFiles/enkf_gfs.x.dir/progress.make | 2 - .../enkfdeplib.dir/DependInfo.cmake | 60 - src/enkf/CMakeFiles/enkfdeplib.dir/build.make | 494 ------ .../enkfdeplib.dir/cmake_clean.cmake | 32 - .../enkfdeplib.dir/cmake_clean_target.cmake | 3 - .../CMakeFiles/enkfdeplib.dir/depend.make | 2 - src/enkf/CMakeFiles/enkfdeplib.dir/flags.make | 54 - src/enkf/CMakeFiles/enkfdeplib.dir/link.txt | 2 - .../CMakeFiles/enkfdeplib.dir/progress.make | 24 - .../CMakeFiles/enkflib.dir/DependInfo.cmake | 50 - src/enkf/CMakeFiles/enkflib.dir/build.make | 318 ---- .../CMakeFiles/enkflib.dir/cmake_clean.cmake | 22 - .../enkflib.dir/cmake_clean_target.cmake | 3 - src/enkf/CMakeFiles/enkflib.dir/depend.make | 2 - src/enkf/CMakeFiles/enkflib.dir/flags.make | 34 - src/enkf/CMakeFiles/enkflib.dir/link.txt | 2 - src/enkf/CMakeFiles/enkflib.dir/progress.make | 14 - src/enkf/CMakeFiles/progress.marks | 1 - 96 files changed, 5384 insertions(+), 4421 deletions(-) delete mode 100644 1 create mode 100644 cmake/Modules/FindBACIO.cmake create mode 100644 cmake/Modules/FindBUFR.cmake create mode 100644 cmake/Modules/FindBaselibs.cmake create mode 100644 cmake/Modules/FindCORELIBS.cmake create mode 100644 cmake/Modules/FindCRTM.cmake create mode 100644 cmake/Modules/FindGSICONTROL.cmake create mode 100644 cmake/Modules/FindHDF5.cmake create mode 100644 cmake/Modules/FindIP.cmake create mode 100644 cmake/Modules/FindMPI.cmake create mode 100644 cmake/Modules/FindNDATE.cmake create mode 100644 cmake/Modules/FindNEMSIO.cmake create mode 100644 cmake/Modules/FindNetCDF.cmake create mode 100644 cmake/Modules/FindSFCIO.cmake create mode 100644 cmake/Modules/FindSIGIO.cmake create mode 100644 cmake/Modules/FindSP.cmake create mode 100644 cmake/Modules/FindW3EMC.cmake create mode 100644 cmake/Modules/FindW3NCO.cmake create mode 100644 cmake/Modules/FindWRF.cmake create mode 100644 cmake/Modules/NewCMake/CMakeParseArguments.cmake create mode 100644 cmake/Modules/NewCMake/FindHDF5.cmake create mode 100644 cmake/Modules/NewCMake/FindMPI.cmake create mode 100644 cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.c create mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/mpiver.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.c create mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake create mode 100644 cmake/Modules/NewCMake/FindPackageMessage.cmake create mode 100644 cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake create mode 100644 cmake/Modules/findHelpers.cmake create mode 100644 cmake/Modules/platforms/Cheyenne.cmake create mode 100644 cmake/Modules/platforms/Discover.cmake create mode 100644 cmake/Modules/platforms/Gaea.cmake create mode 100644 cmake/Modules/platforms/Generic.cmake create mode 100644 cmake/Modules/platforms/Hera.cmake create mode 100644 cmake/Modules/platforms/Jet.cmake create mode 100644 cmake/Modules/platforms/Orion.cmake create mode 100644 cmake/Modules/platforms/S4.cmake create mode 100644 cmake/Modules/platforms/WCOSS-C.cmake create mode 100644 cmake/Modules/platforms/WCOSS-D.cmake create mode 100644 cmake/Modules/platforms/WCOSS.cmake create mode 100644 cmake/Modules/setGNUFlags.cmake create mode 100644 cmake/Modules/setHOST.cmake create mode 100644 cmake/Modules/setIntelFlags.cmake create mode 100644 cmake/Modules/setPGIFlags.cmake create mode 100644 cmake/Modules/setPlatformVariables.cmake delete mode 100644 src/enkf/CMakeCache.txt delete mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake delete mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake delete mode 100644 src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake delete mode 100644 src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c delete mode 100644 src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp delete mode 100644 src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake delete mode 100644 src/enkf/CMakeFiles/CMakeOutput.log delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/build.make delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/depend.make delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/flags.make delete mode 100644 src/enkf/CMakeFiles/MODS1.dir/progress.make delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/build.make delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/depend.make delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/flags.make delete mode 100644 src/enkf/CMakeFiles/MODS2.dir/progress.make delete mode 100644 src/enkf/CMakeFiles/Makefile.cmake delete mode 100644 src/enkf/CMakeFiles/Makefile2 delete mode 100644 src/enkf/CMakeFiles/TargetDirectories.txt delete mode 100644 src/enkf/CMakeFiles/cmake.check_cache delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt delete mode 100644 src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/build.make delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/depend.make delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/flags.make delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/link.txt delete mode 100644 src/enkf/CMakeFiles/enkfdeplib.dir/progress.make delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/build.make delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/depend.make delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/flags.make delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/link.txt delete mode 100644 src/enkf/CMakeFiles/enkflib.dir/progress.make delete mode 100644 src/enkf/CMakeFiles/progress.marks diff --git a/1 b/1 deleted file mode 100644 index 8d77d7b631..0000000000 --- a/1 +++ /dev/null @@ -1,1153 +0,0 @@ -# On branch enkf_fv3native_tl -# You have unmerged paths. -# (fix conflicts and run "git commit") -# -# Changes to be committed: -# -# new file: .gitignore -# modified: .gitmodules -# modified: CMakeLists.txt -# modified: cmake/Modules/FindBACIO.cmake -# modified: cmake/Modules/FindBUFR.cmake -# modified: cmake/Modules/FindBaselibs.cmake -# modified: cmake/Modules/FindCORELIBS.cmake -# modified: cmake/Modules/FindCRTM.cmake -# modified: cmake/Modules/FindGSICONTROL.cmake -# new file: cmake/Modules/FindNDATE.cmake -# modified: cmake/Modules/FindNEMSIO.cmake -# modified: cmake/Modules/FindNetCDF.cmake -# modified: cmake/Modules/FindSFCIO.cmake -# modified: cmake/Modules/FindSIGIO.cmake -# modified: cmake/Modules/FindSP.cmake -# modified: cmake/Modules/FindW3EMC.cmake -# modified: cmake/Modules/FindW3NCO.cmake -# modified: cmake/Modules/FindWRF.cmake -# modified: cmake/Modules/platforms/Cheyenne.cmake -# modified: cmake/Modules/platforms/Discover.cmake -# new file: cmake/Modules/platforms/Gaea.cmake -# modified: cmake/Modules/platforms/Generic.cmake -# new file: cmake/Modules/platforms/Jet.cmake -# modified: cmake/Modules/platforms/S4.cmake -# modified: cmake/Modules/platforms/Theia.cmake -# new file: cmake/Modules/platforms/WCOSS-C.cmake -# deleted: cmake/Modules/platforms/WCOSS-Cray.cmake -# new file: cmake/Modules/platforms/WCOSS-D.cmake -# deleted: cmake/Modules/platforms/WCOSS-Dell.cmake -# modified: cmake/Modules/platforms/WCOSS.cmake -# deleted: cmake/Modules/setCompilerFlags.cmake -# new file: cmake/Modules/setGNUFlags.cmake -# new file: cmake/Modules/setHOST.cmake -# new file: cmake/Modules/setIntelFlags.cmake -# new file: cmake/Modules/setPGIFlags.cmake -# modified: cmake/Modules/setPlatformVariables.cmake -# new file: doc/EnKF_user_guide/.gitignore -# new file: doc/EnKF_user_guide/README -# modified: doc/EnKF_user_guide/ack.tex -# modified: doc/EnKF_user_guide/enkf_appendix_A.tex -# modified: doc/EnKF_user_guide/enkf_ch1.tex -# modified: doc/EnKF_user_guide/enkf_ch2.tex -# modified: doc/EnKF_user_guide/enkf_ch3.tex -# modified: doc/EnKF_user_guide/enkf_ch4.tex -# modified: doc/EnKF_user_guide/enkf_ch5.tex -# modified: doc/EnKF_user_guide/enkf_ch6.tex -# modified: doc/EnKF_user_guide/forward.tex -# new file: doc/EnKF_user_guide/images/DTClogo.png -# new file: doc/EnKF_user_guide/images/ch5_figure1.jpg -# new file: doc/EnKF_user_guide/images/enkfbanner.jpg -# new file: doc/EnKF_user_guide/images/enkfbanner.pdf -# new file: doc/EnKF_user_guide/images/enkfbanner.tiff -# new file: doc/EnKF_user_guide/references.bib -# modified: doc/EnKF_user_guide/title.tex -# new file: doc/GSI_user_guide/.gitignore -# new file: doc/GSI_user_guide/README -# modified: doc/GSI_user_guide/ack.tex -# modified: doc/GSI_user_guide/forward.tex -# modified: doc/GSI_user_guide/gsi_appendixA.tex -# modified: doc/GSI_user_guide/gsi_appendixB.tex -# modified: doc/GSI_user_guide/gsi_appendixC.tex -# modified: doc/GSI_user_guide/gsi_ch1.tex -# modified: doc/GSI_user_guide/gsi_ch2.tex -# modified: doc/GSI_user_guide/gsi_ch3.tex -# modified: doc/GSI_user_guide/gsi_ch4.tex -# modified: doc/GSI_user_guide/gsi_ch5.tex -# modified: doc/GSI_user_guide/gsi_ch6.tex -# new file: doc/GSI_user_guide/images/CostGrad.png -# new file: doc/GSI_user_guide/images/CostGrad_Ch5.png -# new file: doc/GSI_user_guide/images/DTClogo.png -# new file: doc/GSI_user_guide/images/GSIbanner.png -# new file: doc/GSI_user_guide/images/SingleObs.png -# new file: doc/GSI_user_guide/images/ch4_fig1.pdf -# new file: doc/GSI_user_guide/images/ch4_fig2.pdf -# new file: doc/GSI_user_guide/images/ch5_fig1.pdf -# new file: doc/GSI_user_guide/images/ch5_fig_analysisincrement.pdf -# new file: doc/GSI_user_guide/images/ch5_fig_analysisincrement_prepbufr.pdf -# new file: doc/GSI_user_guide/images/ch5_fig_analysisincrement_prepbufr2.pdf -# new file: doc/GSI_user_guide/images/ch5_fig_analysisincrement_prepbufr_lvl48.pdf -# new file: doc/GSI_user_guide/images/ch5_fig_costfunct.pdf -# new file: doc/GSI_user_guide/images/ch6_chem_inc_seas1_bc1.png -# new file: doc/GSI_user_guide/images/gsibanner.pdf -# new file: doc/GSI_user_guide/images/increments.png -# new file: doc/GSI_user_guide/images/increments_bufr.png -# new file: doc/GSI_user_guide/images/increments_rad.png -# new file: doc/GSI_user_guide/images/increments_rad2.png -# new file: doc/GSI_user_guide/images/landmask.png -# new file: doc/GSI_user_guide/images/terrain.png -# modified: doc/GSI_user_guide/references.bib -# modified: doc/GSI_user_guide/title.tex -# new file: doc/Release_Notes.fv3gfs_da.v15.0.0.txt -# deleted: doc/Release_Notes.gdas_da.v13.0.0.txt -# deleted: doc/Release_Notes.gfs_da.v13.0.0.txt -# deleted: doc/Release_Notes.global_shared_da.v13.0.0.txt -# modified: fix -# modified: jobs/JGDAS_ENKF_FCST -# modified: jobs/JGDAS_ENKF_POST -# modified: jobs/JGDAS_ENKF_RECENTER -# modified: jobs/JGLOBAL_ANALYSIS -# modified: jobs/JGLOBAL_ENKF_INNOVATE_OBS -# modified: jobs/JGLOBAL_ENKF_SELECT_OBS -# modified: jobs/JGLOBAL_ENKF_UPDATE -# modified: libsrc -# new file: modulefiles/modulefile.ProdGSI.cheyenne -# deleted: modulefiles/modulefile.ProdGSI.cray -# deleted: modulefiles/modulefile.ProdGSI.dell -# modified: modulefiles/modulefile.ProdGSI.discover -# new file: modulefiles/modulefile.ProdGSI.gaea -# new file: modulefiles/modulefile.ProdGSI.jet -# modified: modulefiles/modulefile.ProdGSI.theia -# modified: modulefiles/modulefile.ProdGSI.wcoss -# new file: modulefiles/modulefile.ProdGSI.wcoss_c -# new file: modulefiles/modulefile.ProdGSI.wcoss_d -# deleted: modulefiles/modulefile.gdas_enkf.cray -# deleted: modulefiles/modulefile.gdas_enkf.theia -# deleted: modulefiles/modulefile.gdas_enkf.wcoss -# deleted: modulefiles/modulefile.global_gsi.cray -# deleted: modulefiles/modulefile.global_gsi.theia -# deleted: modulefiles/modulefile.global_gsi.wcoss -# modified: regression/arw_binary.sh -# modified: regression/arw_netcdf.sh -# modified: regression/global_4denvar_T126.sh -# modified: regression/global_4dvar_T62.sh -# modified: regression/global_T62.sh -# modified: regression/global_T62_ozonly.sh -# new file: regression/global_fv3_4denvar_T126.sh -# modified: regression/global_hybrid_T126.sh -# modified: regression/global_lanczos_T62.sh -# modified: regression/global_nemsio_T62.sh -# modified: regression/hwrf_nmm_d2.sh -# modified: regression/hwrf_nmm_d3.sh -# modified: regression/multi_regression.sh -# modified: regression/netcdf_fv3_regional.sh -# modified: regression/nmm_binary.sh -# modified: regression/nmm_netcdf.sh -# modified: regression/nmmb_nems_4denvar.sh -# modified: regression/regression_namelists.sh -# modified: regression/regression_namelists_db.sh -# modified: regression/regression_nl_update.sh -# modified: regression/regression_param.sh -# modified: regression/regression_test.sh -# modified: regression/regression_test_enkf.sh -# modified: regression/regression_var.sh -# modified: regression/rtma.sh -# modified: scripts/exglobal_analysis.sh.ecf -# modified: scripts/exglobal_analysis_fv3gfs.sh.ecf -# modified: scripts/exglobal_enkf_fcst_fv3gfs.sh.ecf -# modified: scripts/exglobal_enkf_innovate_obs_fv3gfs.sh.ecf -# modified: scripts/exglobal_enkf_post_fv3gfs.sh.ecf -# modified: scripts/exglobal_enkf_recenter_fv3gfs.sh.ecf -# modified: scripts/exglobal_enkf_update_fv3gfs.sh.ecf -# modified: scripts/exglobal_innovate_obs_fv3gfs.sh.ecf -# deleted: src/CMakeLists.txt -# deleted: src/Makefile -# deleted: src/Makefile.conf.AIX -# deleted: src/Makefile.conf.IRIX -# deleted: src/Makefile.conf.IRIX64 -# deleted: src/Makefile.conf.Linux -# deleted: src/Makefile.conf.Linux.IA64.efc -# deleted: src/Makefile.conf.Linux.IA64.ifort -# deleted: src/Makefile.conf.Linux.jet -# deleted: src/Makefile.conf.Linux.lf95 -# deleted: src/Makefile.conf.OSF1 -# deleted: src/Makefile.conf.cheyenne -# deleted: src/Makefile.conf.cray -# deleted: src/Makefile.conf.jet -# deleted: src/Makefile.conf.jibb -# deleted: src/Makefile.conf.nco -# deleted: src/Makefile.conf.s4 -# deleted: src/Makefile.conf.theia -# deleted: src/Makefile.conf.wcoss -# deleted: src/Makefile.conf.zeus -# deleted: src/Makefile.conf.zeus.gsdcloud4arw -# deleted: src/Makefile.conf.zeus.gsdcloud4nmmb -# deleted: src/Makefile.dependency -# deleted: src/Makefile.src -# deleted: src/anisofilter.f90 -# deleted: src/calctends_ad.f90 -# deleted: src/calctends_no_ad.f90 -# deleted: src/control2state.f90 -# deleted: src/control2state_ad.f90 -# deleted: src/control_vectors.f90 -# deleted: src/convthin.f90 -# deleted: src/convthin_time.f90 -# deleted: src/cplr_gfs_ensmod.f90 -# deleted: src/cplr_gfs_nstmod.f90 -# deleted: src/crtm_interface.f90 -# modified: src/enkf/CMakeLists.txt -# deleted: src/enkf/Makefile.conf.cray -# deleted: src/enkf/Makefile.conf.jet -# deleted: src/enkf/Makefile.conf.nco -# deleted: src/enkf/Makefile.conf.theia -# deleted: src/enkf/Makefile.conf.wcoss -# deleted: src/enkf/Makefile.conf.zeus -# deleted: src/enkf/Makefile.dependency -# deleted: src/enkf/Makefile.dependency.gfs -# deleted: src/enkf/Makefile.dependency.nmmb -# deleted: src/enkf/Makefile.dependency.wrf -# deleted: src/enkf/Makefile_gfs -# deleted: src/enkf/Makefile_nmmb -# deleted: src/enkf/Makefile_wrf -# renamed: src/README.EnKF -> src/enkf/README.EnKF -# modified: src/enkf/enkf.f90 -# modified: src/enkf/gridinfo_gfs.f90 -# modified: src/enkf/gridinfo_nmmb.f90 -# modified: src/enkf/gridinfo_wrf.f90 -# modified: src/enkf/gridio_nmmb.f90 -# modified: src/enkf/gridio_wrf.f90 -# typechange: src/enkf/observer_nmmb.f90 -# modified: src/enkf/observer_reg.f90 -# typechange: src/enkf/observer_wrf.f90 -# modified: src/enkf/readsatobs.f90 -# modified: src/enkf/smooth_gfs.f90 -# deleted: src/get_gefs_for_regional.f90 -# deleted: src/gsdcloudanalysis.F90 -# new file: src/gsi/CMakeLists.txt -# renamed: src/Nst_Var_ESMFMod.f90 -> src/gsi/Nst_Var_ESMFMod.f90 -# renamed: src/adjtest.f90 -> src/gsi/adjtest.f90 -# renamed: src/adjtest_obs.f90 -> src/gsi/adjtest_obs.f90 -# renamed: src/adjust_cloudobs_mod.f90 -> src/gsi/adjust_cloudobs_mod.f90 -# renamed: src/aeroinfo.f90 -> src/gsi/aeroinfo.f90 -# renamed: src/aircraftinfo.f90 -> src/gsi/aircraftinfo.f90 -# renamed: src/aircraftobsqc.f90 -> src/gsi/aircraftobsqc.f90 -# renamed: src/anberror.f90 -> src/gsi/anberror.f90 -# renamed: src/anbkerror.f90 -> src/gsi/anbkerror.f90 -# renamed: src/aniso_ens_util.f90 -> src/gsi/aniso_ens_util.f90 -# new file: src/gsi/anisofilter.f90 -# renamed: src/anisofilter_glb.f90 -> src/gsi/anisofilter_glb.f90 -# renamed: src/antcorr_application.f90 -> src/gsi/antcorr_application.f90 -# renamed: src/antest_maps0.f90 -> src/gsi/antest_maps0.f90 -# renamed: src/antest_maps0_glb.f90 -> src/gsi/antest_maps0_glb.f90 -# renamed: src/atms_spatial_average_mod.f90 -> src/gsi/atms_spatial_average_mod.f90 -# renamed: src/balmod.f90 -> src/gsi/balmod.f90 -# renamed: src/berror.f90 -> src/gsi/berror.f90 -# renamed: src/bias_predictors.f90 -> src/gsi/bias_predictors.f90 -# renamed: src/bicg.f90 -> src/gsi/bicg.f90 -# renamed: src/bicglanczos.F90 -> src/gsi/bicglanczos.F90 -# renamed: src/bkerror.f90 -> src/gsi/bkerror.f90 -# renamed: src/bkgcov.f90 -> src/gsi/bkgcov.f90 -# renamed: src/bkgvar.f90 -> src/gsi/bkgvar.f90 -# renamed: src/bkgvar_rewgt.f90 -> src/gsi/bkgvar_rewgt.f90 -# renamed: src/blacklist.f90 -> src/gsi/blacklist.f90 -# renamed: src/blendmod.f90 -> src/gsi/blendmod.f90 -# renamed: src/blockIO.c -> src/gsi/blockIO.c -# renamed: src/buddycheck_mod.f90 -> src/gsi/buddycheck_mod.f90 -# renamed: src/calc_fov_conical.f90 -> src/gsi/calc_fov_conical.f90 -# renamed: src/calc_fov_crosstrk.f90 -> src/gsi/calc_fov_crosstrk.f90 -# renamed: src/calctends.f90 -> src/gsi/calctends.f90 -# new file: src/gsi/calctends_ad.f90 -# new file: src/gsi/calctends_no_ad.f90 -# renamed: src/calctends_no_tl.f90 -> src/gsi/calctends_no_tl.f90 -# renamed: src/calctends_tl.f90 -> src/gsi/calctends_tl.f90 -# renamed: src/chemmod.f90 -> src/gsi/chemmod.f90 -# renamed: src/class_get_pseudo_ensperts.f90 -> src/gsi/class_get_pseudo_ensperts.f90 -# renamed: src/class_get_wrf_mass_ensperts.f90 -> src/gsi/class_get_wrf_mass_ensperts.f90 -# renamed: src/class_get_wrf_nmm_ensperts.f90 -> src/gsi/class_get_wrf_nmm_ensperts.f90 -# renamed: src/class_gfs_ensmod.f90 -> src/gsi/class_gfs_ensmod.f90 -# renamed: src/class_read_wrf_mass_files.f90 -> src/gsi/class_read_wrf_mass_files.f90 -# renamed: src/class_read_wrf_mass_guess.f90 -> src/gsi/class_read_wrf_mass_guess.f90 -# renamed: src/class_read_wrf_nmm_files.f90 -> src/gsi/class_read_wrf_nmm_files.f90 -# renamed: src/class_read_wrf_nmm_guess.f90 -> src/gsi/class_read_wrf_nmm_guess.f90 -# renamed: src/class_regional_io.f90 -> src/gsi/class_regional_io.f90 -# renamed: src/class_wrf_binary_interface.f90 -> src/gsi/class_wrf_binary_interface.f90 -# renamed: src/class_wrf_netcdf_interface.f90 -> src/gsi/class_wrf_netcdf_interface.f90 -# renamed: src/class_wrwrfmassa.f90 -> src/gsi/class_wrwrfmassa.f90 -# renamed: src/class_wrwrfnmma.f90 -> src/gsi/class_wrwrfnmma.f90 -# renamed: src/cloud_efr_mod.f90 -> src/gsi/cloud_efr_mod.f90 -# renamed: src/clw_mod.f90 -> src/gsi/clw_mod.f90 -# renamed: src/cmaq_routines.f90 -> src/gsi/cmaq_routines.f90 -# renamed: src/co_mop_ak.f90 -> src/gsi/co_mop_ak.f90 -# renamed: src/coinfo.f90 -> src/gsi/coinfo.f90 -# renamed: src/combine_radobs.f90 -> src/gsi/combine_radobs.f90 -# renamed: src/compact_diffs.f90 -> src/gsi/compact_diffs.f90 -# renamed: src/compute_derived.f90 -> src/gsi/compute_derived.f90 -# renamed: src/compute_fact10.f90 -> src/gsi/compute_fact10.f90 -# renamed: src/compute_qvar3d.f90 -> src/gsi/compute_qvar3d.f90 -# renamed: src/configure -> src/gsi/configure -# renamed: src/constants.f90 -> src/gsi/constants.f90 -# renamed: src/control2model.f90 -> src/gsi/control2model.f90 -# renamed: src/control2model_ad.f90 -> src/gsi/control2model_ad.f90 -# new file: src/gsi/control2state.f90 -# new file: src/gsi/control2state_ad.f90 -# new file: src/gsi/control_vectors.f90 -# renamed: src/convb_ps.f90 -> src/gsi/convb_ps.f90 -# renamed: src/convb_q.f90 -> src/gsi/convb_q.f90 -# renamed: src/convb_t.f90 -> src/gsi/convb_t.f90 -# renamed: src/convb_uv.f90 -> src/gsi/convb_uv.f90 -# renamed: src/converr.f90 -> src/gsi/converr.f90 -# renamed: src/converr_ps.f90 -> src/gsi/converr_ps.f90 -# renamed: src/converr_pw.f90 -> src/gsi/converr_pw.f90 -# renamed: src/converr_q.f90 -> src/gsi/converr_q.f90 -# renamed: src/converr_t.f90 -> src/gsi/converr_t.f90 -# renamed: src/converr_uv.f90 -> src/gsi/converr_uv.f90 -# renamed: src/convinfo.f90 -> src/gsi/convinfo.f90 -# new file: src/gsi/convthin.f90 -# new file: src/gsi/convthin_time.f90 -# renamed: src/correlated_obsmod.F90 -> src/gsi/correlated_obsmod.F90 -# renamed: src/cplr_get_pseudo_ensperts.f90 -> src/gsi/cplr_get_pseudo_ensperts.f90 -# renamed: src/cplr_get_wrf_mass_ensperts.f90 -> src/gsi/cplr_get_wrf_mass_ensperts.f90 -# renamed: src/cplr_get_wrf_nmm_ensperts.f90 -> src/gsi/cplr_get_wrf_nmm_ensperts.f90 -# new file: src/gsi/cplr_gfs_ensmod.f90 -# new file: src/gsi/cplr_gfs_nstmod.f90 -# renamed: src/cplr_read_wrf_mass_files.f90 -> src/gsi/cplr_read_wrf_mass_files.f90 -# renamed: src/cplr_read_wrf_mass_guess.f90 -> src/gsi/cplr_read_wrf_mass_guess.f90 -# renamed: src/cplr_read_wrf_nmm_files.f90 -> src/gsi/cplr_read_wrf_nmm_files.f90 -# renamed: src/cplr_read_wrf_nmm_guess.f90 -> src/gsi/cplr_read_wrf_nmm_guess.f90 -# renamed: src/cplr_regional_io.f90 -> src/gsi/cplr_regional_io.f90 -# renamed: src/cplr_wrf_binary_interface.f90 -> src/gsi/cplr_wrf_binary_interface.f90 -# renamed: src/cplr_wrf_netcdf_interface.f90 -> src/gsi/cplr_wrf_netcdf_interface.f90 -# renamed: src/cplr_wrwrfmassa.f90 -> src/gsi/cplr_wrwrfmassa.f90 -# renamed: src/cplr_wrwrfnmma.f90 -> src/gsi/cplr_wrwrfnmma.f90 -# new file: src/gsi/crtm_interface.f90 -# renamed: src/cvsection.f90 -> src/gsi/cvsection.f90 -# renamed: src/cwhydromod.f90 -> src/gsi/cwhydromod.f90 -# renamed: src/derivsmod.f90 -> src/gsi/derivsmod.f90 -# renamed: src/deter_sfc_mod.f90 -> src/gsi/deter_sfc_mod.f90 -# renamed: src/dtast.f90 -> src/gsi/dtast.f90 -# renamed: src/egrid2agrid_mod.f90 -> src/gsi/egrid2agrid_mod.f90 -# renamed: src/en_perts_io.f90 -> src/gsi/en_perts_io.f90 -# renamed: src/enorm_state.f90 -> src/gsi/enorm_state.f90 -# renamed: src/ens_spread_mod.f90 -> src/gsi/ens_spread_mod.f90 -# renamed: src/ensctl2model.f90 -> src/gsi/ensctl2model.f90 -# renamed: src/ensctl2model_ad.f90 -> src/gsi/ensctl2model_ad.f90 -# renamed: src/ensctl2state.f90 -> src/gsi/ensctl2state.f90 -# renamed: src/ensctl2state_ad.f90 -> src/gsi/ensctl2state_ad.f90 -# renamed: src/evaljgrad.f90 -> src/gsi/evaljgrad.f90 -# renamed: src/evaljo.f90 -> src/gsi/evaljo.f90 -# renamed: src/evalqlim.f90 -> src/gsi/evalqlim.f90 -# renamed: src/fgrid2agrid_mod.f90 -> src/gsi/fgrid2agrid_mod.f90 -# renamed: src/fill_mass_grid2.f90 -> src/gsi/fill_mass_grid2.f90 -# renamed: src/fill_nmm_grid2.f90 -> src/gsi/fill_nmm_grid2.f90 -# renamed: src/fpvsx_ad.f90 -> src/gsi/fpvsx_ad.f90 -# renamed: src/fv3_regional_interface.f90 -> src/gsi/fv3_regional_interface.f90 -# renamed: src/general_commvars_mod.f90 -> src/gsi/general_commvars_mod.f90 -# renamed: src/general_read_gfsatm.f90 -> src/gsi/general_read_gfsatm.f90 -# renamed: src/general_read_nmmb.f90 -> src/gsi/general_read_nmmb.f90 -# renamed: src/general_specmod.f90 -> src/gsi/general_specmod.f90 -# renamed: src/general_spectral_transforms.f90 -> src/gsi/general_spectral_transforms.f90 -# renamed: src/general_sub2grid_mod.f90 -> src/gsi/general_sub2grid_mod.f90 -# renamed: src/general_tll2xy_mod.f90 -> src/gsi/general_tll2xy_mod.f90 -# renamed: src/general_transform.f90 -> src/gsi/general_transform.f90 -# renamed: src/general_write_gfsatm.f90 -> src/gsi/general_write_gfsatm.f90 -# renamed: src/genex_mod.f90 -> src/gsi/genex_mod.f90 -# renamed: src/gengrid_vars.f90 -> src/gsi/gengrid_vars.f90 -# renamed: src/genqsat.f90 -> src/gsi/genqsat.f90 -# renamed: src/genstats_gps.f90 -> src/gsi/genstats_gps.f90 -# renamed: src/gesinfo.f90 -> src/gsi/gesinfo.f90 -# renamed: src/get_derivatives.f90 -> src/gsi/get_derivatives.f90 -# renamed: src/get_derivatives2.f90 -> src/gsi/get_derivatives2.f90 -# renamed: src/get_gefs_ensperts_dualres.f90 -> src/gsi/get_gefs_ensperts_dualres.f90 -# new file: src/gsi/get_gefs_for_regional.f90 -# renamed: src/get_nmmb_ensperts.f90 -> src/gsi/get_nmmb_ensperts.f90 -# renamed: src/get_semimp_mats.f90 -> src/gsi/get_semimp_mats.f90 -# renamed: src/getcount_bufr.f90 -> src/gsi/getcount_bufr.f90 -# renamed: src/getprs.f90 -> src/gsi/getprs.f90 -# renamed: src/getsiga.f90 -> src/gsi/getsiga.f90 -# renamed: src/getuv.f90 -> src/gsi/getuv.f90 -# renamed: src/getvvel.f90 -> src/gsi/getvvel.f90 -# renamed: src/gfs_stratosphere.f90 -> src/gsi/gfs_stratosphere.f90 -# renamed: src/glbsoi.f90 -> src/gsi/glbsoi.f90 -# renamed: src/grdcrd.f90 -> src/gsi/grdcrd.f90 -# renamed: src/gridmod.F90 -> src/gsi/gridmod.F90 -# renamed: src/grtest.f90 -> src/gsi/grtest.f90 -# renamed: src/gscond_ad.f90 -> src/gsi/gscond_ad.f90 -# renamed: src/gsd_terrain_match_surfTobs.f90 -> src/gsi/gsd_terrain_match_surfTobs.f90 -# renamed: src/gsd_update_mod.f90 -> src/gsi/gsd_update_mod.f90 -# new file: src/gsi/gsdcloudanalysis.F90 -# renamed: src/gsdcloudanalysis4NMMB.F90 -> src/gsi/gsdcloudanalysis4NMMB.F90 -# renamed: src/gsdcloudanalysis4gfs.F90 -> src/gsi/gsdcloudanalysis4gfs.F90 -# renamed: src/gsi_4dcouplermod.f90 -> src/gsi/gsi_4dcouplermod.f90 -# renamed: src/gsi_4dvar.f90 -> src/gsi/gsi_4dvar.f90 -# renamed: src/gsi_bias.f90 -> src/gsi/gsi_bias.f90 -# renamed: src/gsi_bundlemod.F90 -> src/gsi/gsi_bundlemod.F90 -# renamed: src/gsi_chemguess_mod.F90 -> src/gsi/gsi_chemguess_mod.F90 -# renamed: src/gsi_enscouplermod.f90 -> src/gsi/gsi_enscouplermod.f90 -# renamed: src/gsi_io.f90 -> src/gsi/gsi_io.f90 -# renamed: src/gsi_metguess_mod.F90 -> src/gsi/gsi_metguess_mod.F90 -# renamed: src/gsi_nemsio_mod.f90 -> src/gsi/gsi_nemsio_mod.f90 -# renamed: src/gsi_nstcouplermod.f90 -> src/gsi/gsi_nstcouplermod.f90 -# renamed: src/gsi_rfv3io_mod.f90 -> src/gsi/gsi_rfv3io_mod.f90 -# renamed: src/gsi_unformatted.F90 -> src/gsi/gsi_unformatted.F90 -# new file: src/gsi/gsimain.f90 -# new file: src/gsi/gsimod.F90 -# new file: src/gsi/gsisub.F90 -# renamed: src/guess_grids.F90 -> src/gsi/guess_grids.F90 -# renamed: src/half_nmm_grid2.f90 -> src/gsi/half_nmm_grid2.f90 -# renamed: src/hilbert_curve.f90 -> src/gsi/hilbert_curve.f90 -# new file: src/gsi/hybrid_ensemble_isotropic.F90 -# renamed: src/hybrid_ensemble_parameters.f90 -> src/gsi/hybrid_ensemble_parameters.f90 -# renamed: src/inc2guess.f90 -> src/gsi/inc2guess.f90 -# renamed: src/init_jcdfi.f90 -> src/gsi/init_jcdfi.f90 -# renamed: src/insitu_info.f90 -> src/gsi/insitu_info.f90 -# renamed: src/intall.f90 -> src/gsi/intall.f90 -# renamed: src/intaod.f90 -> src/gsi/intaod.f90 -# renamed: src/intcldch.f90 -> src/gsi/intcldch.f90 -# renamed: src/intco.f90 -> src/gsi/intco.f90 -# renamed: src/intdw.f90 -> src/gsi/intdw.f90 -# renamed: src/intgps.f90 -> src/gsi/intgps.f90 -# renamed: src/intgust.f90 -> src/gsi/intgust.f90 -# renamed: src/inthowv.f90 -> src/gsi/inthowv.f90 -# renamed: src/intjcmod.f90 -> src/gsi/intjcmod.f90 -# renamed: src/intjo.f90 -> src/gsi/intjo.f90 -# renamed: src/intlag.f90 -> src/gsi/intlag.f90 -# renamed: src/intlcbas.f90 -> src/gsi/intlcbas.f90 -# new file: src/gsi/intlight.f90 -# renamed: src/intlwcp.f90 -> src/gsi/intlwcp.f90 -# renamed: src/intmitm.f90 -> src/gsi/intmitm.f90 -# renamed: src/intmxtm.f90 -> src/gsi/intmxtm.f90 -# renamed: src/intoz.f90 -> src/gsi/intoz.f90 -# renamed: src/intpblh.f90 -> src/gsi/intpblh.f90 -# renamed: src/intpcp.f90 -> src/gsi/intpcp.f90 -# renamed: src/intpm10.f90 -> src/gsi/intpm10.f90 -# renamed: src/intpm2_5.f90 -> src/gsi/intpm2_5.f90 -# renamed: src/intpmsl.f90 -> src/gsi/intpmsl.f90 -# renamed: src/intps.f90 -> src/gsi/intps.f90 -# renamed: src/intpw.f90 -> src/gsi/intpw.f90 -# renamed: src/intq.f90 -> src/gsi/intq.f90 -# renamed: src/intrad.f90 -> src/gsi/intrad.f90 -# renamed: src/intrp2a.f90 -> src/gsi/intrp2a.f90 -# renamed: src/intrp3oz.f90 -> src/gsi/intrp3oz.f90 -# renamed: src/intrp_msk.f90 -> src/gsi/intrp_msk.f90 -# renamed: src/intrw.f90 -> src/gsi/intrw.f90 -# renamed: src/intspd.f90 -> src/gsi/intspd.f90 -# renamed: src/intsst.f90 -> src/gsi/intsst.f90 -# renamed: src/intswcp.f90 -> src/gsi/intswcp.f90 -# renamed: src/intt.f90 -> src/gsi/intt.f90 -# renamed: src/inttcamt.f90 -> src/gsi/inttcamt.f90 -# renamed: src/inttcp.f90 -> src/gsi/inttcp.f90 -# renamed: src/inttd2m.f90 -> src/gsi/inttd2m.f90 -# renamed: src/intuwnd10m.f90 -> src/gsi/intuwnd10m.f90 -# renamed: src/intvis.f90 -> src/gsi/intvis.f90 -# renamed: src/intvwnd10m.f90 -> src/gsi/intvwnd10m.f90 -# renamed: src/intw.f90 -> src/gsi/intw.f90 -# renamed: src/intwspd10m.f90 -> src/gsi/intwspd10m.f90 -# renamed: src/jcmod.f90 -> src/gsi/jcmod.f90 -# renamed: src/jfunc.f90 -> src/gsi/jfunc.f90 -# renamed: src/jgrad.f90 -> src/gsi/jgrad.f90 -# renamed: src/kinds.F90 -> src/gsi/kinds.F90 -# renamed: src/lag_fields.f90 -> src/gsi/lag_fields.f90 -# renamed: src/lag_interp.f90 -> src/gsi/lag_interp.f90 -# renamed: src/lag_traj.f90 -> src/gsi/lag_traj.f90 -# renamed: src/lagmod.f90 -> src/gsi/lagmod.f90 -# renamed: src/lanczos.F90 -> src/gsi/lanczos.F90 -# new file: src/gsi/lightinfo.f90 -# renamed: src/logcldch_to_cldch.f90 -> src/gsi/logcldch_to_cldch.f90 -# renamed: src/loglcbas_to_lcbas.f90 -> src/gsi/loglcbas_to_lcbas.f90 -# renamed: src/logvis_to_vis.f90 -> src/gsi/logvis_to_vis.f90 -# renamed: src/looplimits.f90 -> src/gsi/looplimits.f90 -# renamed: src/m_aeroNode.F90 -> src/gsi/m_aeroNode.F90 -# renamed: src/m_aerolNode.F90 -> src/gsi/m_aerolNode.F90 -# renamed: src/m_berror_stats.f90 -> src/gsi/m_berror_stats.f90 -# new file: src/gsi/m_berror_stats_reg.f90 -# renamed: src/m_cldchNode.F90 -> src/gsi/m_cldchNode.F90 -# renamed: src/m_colvkNode.F90 -> src/gsi/m_colvkNode.F90 -# renamed: src/m_cvgridLookup.F90 -> src/gsi/m_cvgridLookup.F90 -# renamed: src/m_dgeevx.F90 -> src/gsi/m_dgeevx.F90 -# renamed: src/m_distance.f90 -> src/gsi/m_distance.f90 -# renamed: src/m_dtime.F90 -> src/gsi/m_dtime.F90 -# renamed: src/m_dwNode.F90 -> src/gsi/m_dwNode.F90 -# renamed: src/m_extOzone.F90 -> src/gsi/m_extOzone.F90 -# renamed: src/m_find.f90 -> src/gsi/m_find.f90 -# renamed: src/m_gpsNode.F90 -> src/gsi/m_gpsNode.F90 -# renamed: src/m_gpsrhs.F90 -> src/gsi/m_gpsrhs.F90 -# renamed: src/m_gsiBiases.f90 -> src/gsi/m_gsiBiases.f90 -# renamed: src/m_gustNode.F90 -> src/gsi/m_gustNode.F90 -# renamed: src/m_howvNode.F90 -> src/gsi/m_howvNode.F90 -# renamed: src/m_lagNode.F90 -> src/gsi/m_lagNode.F90 -# renamed: src/m_latlonRange.F90 -> src/gsi/m_latlonRange.F90 -# renamed: src/m_lcbasNode.F90 -> src/gsi/m_lcbasNode.F90 -# new file: src/gsi/m_lightNode.F90 -# renamed: src/m_lwcpNode.F90 -> src/gsi/m_lwcpNode.F90 -# renamed: src/m_mitmNode.F90 -> src/gsi/m_mitmNode.F90 -# renamed: src/m_mxtmNode.F90 -> src/gsi/m_mxtmNode.F90 -# renamed: src/m_o3lNode.F90 -> src/gsi/m_o3lNode.F90 -# new file: src/gsi/m_obsHeadBundle.F90 -# new file: src/gsi/m_obsLList.F90 -# renamed: src/m_obsNode.F90 -> src/gsi/m_obsNode.F90 -# new file: src/gsi/m_obsNodeTypeManager.F90 -# renamed: src/m_obsdiagNode.F90 -> src/gsi/m_obsdiagNode.F90 -# new file: src/gsi/m_obsdiags.F90 -# renamed: src/m_ozNode.F90 -> src/gsi/m_ozNode.F90 -# renamed: src/m_pblhNode.F90 -> src/gsi/m_pblhNode.F90 -# renamed: src/m_pcpNode.F90 -> src/gsi/m_pcpNode.F90 -# renamed: src/m_pm10Node.F90 -> src/gsi/m_pm10Node.F90 -# renamed: src/m_pm2_5Node.F90 -> src/gsi/m_pm2_5Node.F90 -# renamed: src/m_pmslNode.F90 -> src/gsi/m_pmslNode.F90 -# renamed: src/m_psNode.F90 -> src/gsi/m_psNode.F90 -# renamed: src/m_pwNode.F90 -> src/gsi/m_pwNode.F90 -# renamed: src/m_qNode.F90 -> src/gsi/m_qNode.F90 -# renamed: src/m_radNode.F90 -> src/gsi/m_radNode.F90 -# renamed: src/m_rerank.f90 -> src/gsi/m_rerank.f90 -# renamed: src/m_rhs.F90 -> src/gsi/m_rhs.F90 -# renamed: src/m_rwNode.F90 -> src/gsi/m_rwNode.F90 -# renamed: src/m_sortind.f90 -> src/gsi/m_sortind.f90 -# renamed: src/m_spdNode.F90 -> src/gsi/m_spdNode.F90 -# renamed: src/m_sstNode.F90 -> src/gsi/m_sstNode.F90 -# renamed: src/m_stats.f90 -> src/gsi/m_stats.f90 -# renamed: src/m_swcpNode.F90 -> src/gsi/m_swcpNode.F90 -# renamed: src/m_tNode.F90 -> src/gsi/m_tNode.F90 -# renamed: src/m_tcamtNode.F90 -> src/gsi/m_tcamtNode.F90 -# renamed: src/m_tcpNode.F90 -> src/gsi/m_tcpNode.F90 -# renamed: src/m_td2mNode.F90 -> src/gsi/m_td2mNode.F90 -# renamed: src/m_tick.F90 -> src/gsi/m_tick.F90 -# renamed: src/m_uniq.f90 -> src/gsi/m_uniq.f90 -# renamed: src/m_uwnd10mNode.F90 -> src/gsi/m_uwnd10mNode.F90 -# renamed: src/m_visNode.F90 -> src/gsi/m_visNode.F90 -# renamed: src/m_vwnd10mNode.F90 -> src/gsi/m_vwnd10mNode.F90 -# renamed: src/m_wNode.F90 -> src/gsi/m_wNode.F90 -# renamed: src/m_wspd10mNode.F90 -> src/gsi/m_wspd10mNode.F90 -# renamed: src/make_depend.bash -> src/gsi/make_depend.bash -# new file: src/gsi/mod_fv3_lola.f90 -# renamed: src/mod_nmmb_to_a.f90 -> src/gsi/mod_nmmb_to_a.f90 -# renamed: src/mod_strong.f90 -> src/gsi/mod_strong.f90 -# renamed: src/mod_vtrans.f90 -> src/gsi/mod_vtrans.f90 -# renamed: src/mod_wrfmass_to_a.f90 -> src/gsi/mod_wrfmass_to_a.f90 -# renamed: src/model_ad.F90 -> src/gsi/model_ad.F90 -# renamed: src/model_tl.F90 -> src/gsi/model_tl.F90 -# renamed: src/mp_compact_diffs_mod1.f90 -> src/gsi/mp_compact_diffs_mod1.f90 -# renamed: src/mp_compact_diffs_support.f90 -> src/gsi/mp_compact_diffs_support.f90 -# renamed: src/mpeu_mpif.F90 -> src/gsi/mpeu_mpif.F90 -# renamed: src/mpeu_util.F90 -> src/gsi/mpeu_util.F90 -# renamed: src/mpimod.F90 -> src/gsi/mpimod.F90 -# renamed: src/mpl_allreduce.F90 -> src/gsi/mpl_allreduce.F90 -# renamed: src/mpl_bcast.f90 -> src/gsi/mpl_bcast.f90 -# renamed: src/myassert.H -> src/gsi/myassert.H -# renamed: src/mytrace.H -> src/gsi/mytrace.H -# renamed: src/native_endianness.f90 -> src/gsi/native_endianness.f90 -# renamed: src/nc_diag_read_mod.f90 -> src/gsi/nc_diag_read_mod.f90 -# renamed: src/nc_diag_write_mod.f90 -> src/gsi/nc_diag_write_mod.f90 -# renamed: src/ncepgfs_ghg.f90 -> src/gsi/ncepgfs_ghg.f90 -# renamed: src/ncepgfs_io.f90 -> src/gsi/ncepgfs_io.f90 -# new file: src/gsi/ncepnems_io.f90 -# renamed: src/netcdf_mod.f90 -> src/gsi/netcdf_mod.f90 -# renamed: src/nlmsas_ad.f90 -> src/gsi/nlmsas_ad.f90 -# new file: src/gsi/nltransf.f90 -# renamed: src/normal_rh_to_q.f90 -> src/gsi/normal_rh_to_q.f90 -# renamed: src/nstio_module.f90 -> src/gsi/nstio_module.f90 -# renamed: src/obs_ferrscale.F90 -> src/gsi/obs_ferrscale.F90 -# renamed: src/obs_para.f90 -> src/gsi/obs_para.f90 -# new file: src/gsi/obs_sensitivity.f90 -# renamed: src/obserr_allsky_mw.f90 -> src/gsi/obserr_allsky_mw.f90 -# renamed: src/observer.F90 -> src/gsi/observer.F90 -# new file: src/gsi/obsmod.F90 -# renamed: src/omegas_ad.f90 -> src/gsi/omegas_ad.f90 -# renamed: src/oneobmod.F90 -> src/gsi/oneobmod.F90 -# renamed: src/ozinfo.f90 -> src/gsi/ozinfo.f90 -# renamed: src/patch2grid_mod.f90 -> src/gsi/patch2grid_mod.f90 -# renamed: src/pcgsoi.f90 -> src/gsi/pcgsoi.f90 -# renamed: src/pcgsqrt.f90 -> src/gsi/pcgsqrt.f90 -# renamed: src/pcp_k.f90 -> src/gsi/pcp_k.f90 -# renamed: src/pcpinfo.f90 -> src/gsi/pcpinfo.f90 -# new file: src/gsi/penal.f90 -# renamed: src/phil.f90 -> src/gsi/phil.f90 -# renamed: src/phil1.f90 -> src/gsi/phil1.f90 -# renamed: src/plib8.f90 -> src/gsi/plib8.f90 -# renamed: src/polcarf.f90 -> src/gsi/polcarf.f90 -# renamed: src/prad_bias.f90 -> src/gsi/prad_bias.f90 -# renamed: src/precond.f90 -> src/gsi/precond.f90 -# renamed: src/precpd_ad.f90 -> src/gsi/precpd_ad.f90 -# renamed: src/prewgt.f90 -> src/gsi/prewgt.f90 -# renamed: src/prewgt_reg.f90 -> src/gsi/prewgt_reg.f90 -# renamed: src/projmethod_support.f90 -> src/gsi/projmethod_support.f90 -# renamed: src/prt_guess.f90 -> src/gsi/prt_guess.f90 -# renamed: src/psichi2uv_reg.f90 -> src/gsi/psichi2uv_reg.f90 -# renamed: src/psichi2uvt_reg.f90 -> src/gsi/psichi2uvt_reg.f90 -# renamed: src/q_diag.f90 -> src/gsi/q_diag.f90 -# new file: src/gsi/qcmod.f90 -# renamed: src/qnewton3.f90 -> src/gsi/qnewton3.f90 -# new file: src/gsi/radiance_mod.f90 -# new file: src/gsi/radinfo.f90 -# renamed: src/raflib.f90 -> src/gsi/raflib.f90 -# renamed: src/rapidrefresh_cldsurf_mod.f90 -> src/gsi/rapidrefresh_cldsurf_mod.f90 -# renamed: src/rdgrbsst.f90 -> src/gsi/rdgrbsst.f90 -# renamed: src/read_Lightning.f90 -> src/gsi/read_Lightning.f90 -# renamed: src/read_NASA_LaRC_cloud.f90 -> src/gsi/read_NASA_LaRC_cloud.f90 -# renamed: src/read_aerosol.f90 -> src/gsi/read_aerosol.f90 -# renamed: src/read_ahi.f90 -> src/gsi/read_ahi.f90 -# renamed: src/read_airs.f90 -> src/gsi/read_airs.f90 -# renamed: src/read_amsr2.f90 -> src/gsi/read_amsr2.f90 -# renamed: src/read_amsre.f90 -> src/gsi/read_amsre.f90 -# renamed: src/read_anowbufr.f90 -> src/gsi/read_anowbufr.f90 -# renamed: src/read_atms.f90 -> src/gsi/read_atms.f90 -# renamed: src/read_avhrr.f90 -> src/gsi/read_avhrr.f90 -# renamed: src/read_avhrr_navy.f90 -> src/gsi/read_avhrr_navy.f90 -# renamed: src/read_bufrtovs.f90 -> src/gsi/read_bufrtovs.f90 -# renamed: src/read_co.f90 -> src/gsi/read_co.f90 -# renamed: src/read_cris.f90 -> src/gsi/read_cris.f90 -# new file: src/gsi/read_diag.f90 -# new file: src/gsi/read_files.f90 -# renamed: src/read_fl_hdob.f90 -> src/gsi/read_fl_hdob.f90 -# renamed: src/read_gfs_ozone_for_regional.f90 -> src/gsi/read_gfs_ozone_for_regional.f90 -# renamed: src/read_gmi.f90 -> src/gsi/read_gmi.f90 -# new file: src/gsi/read_goesglm.f90 -# renamed: src/read_goesimg.f90 -> src/gsi/read_goesimg.f90 -# renamed: src/read_goesimgr_skycover.f90 -> src/gsi/read_goesimgr_skycover.f90 -# renamed: src/read_goesndr.f90 -> src/gsi/read_goesndr.f90 -# renamed: src/read_gps.f90 -> src/gsi/read_gps.f90 -# renamed: src/read_guess.F90 -> src/gsi/read_guess.F90 -# renamed: src/read_iasi.f90 -> src/gsi/read_iasi.f90 -# renamed: src/read_l2bufr_mod.f90 -> src/gsi/read_l2bufr_mod.f90 -# renamed: src/read_lag.f90 -> src/gsi/read_lag.f90 -# renamed: src/read_lidar.f90 -> src/gsi/read_lidar.f90 -# renamed: src/read_mitm_mxtm.f90 -> src/gsi/read_mitm_mxtm.f90 -# renamed: src/read_modsbufr.f90 -> src/gsi/read_modsbufr.f90 -# renamed: src/read_nasa_larc.f90 -> src/gsi/read_nasa_larc.f90 -# renamed: src/read_nsstbufr.f90 -> src/gsi/read_nsstbufr.f90 -# new file: src/gsi/read_obs.F90 -# new file: src/gsi/read_ozone.f90 -# renamed: src/read_pblh.f90 -> src/gsi/read_pblh.f90 -# renamed: src/read_pcp.f90 -> src/gsi/read_pcp.f90 -# new file: src/gsi/read_prepbufr.f90 -# renamed: src/read_radar.f90 -> src/gsi/read_radar.f90 -# renamed: src/read_radarref_mosaic.f90 -> src/gsi/read_radarref_mosaic.f90 -# renamed: src/read_rapidscat.f90 -> src/gsi/read_rapidscat.f90 -# renamed: src/read_saphir.f90 -> src/gsi/read_saphir.f90 -# new file: src/gsi/read_satmar.f90 -# new file: src/gsi/read_satwnd.f90 -# renamed: src/read_seviri.f90 -> src/gsi/read_seviri.f90 -# renamed: src/read_sfcwnd.f90 -> src/gsi/read_sfcwnd.f90 -# renamed: src/read_ssmi.f90 -> src/gsi/read_ssmi.f90 -# renamed: src/read_ssmis.f90 -> src/gsi/read_ssmis.f90 -# renamed: src/read_tcps.f90 -> src/gsi/read_tcps.f90 -# renamed: src/read_wcpbufr.f90 -> src/gsi/read_wcpbufr.f90 -# renamed: src/reorg_metar_cloud.f90 -> src/gsi/reorg_metar_cloud.f90 -# renamed: src/rfdpar.f90 -> src/gsi/rfdpar.f90 -# renamed: src/rsearch.F90 -> src/gsi/rsearch.F90 -# renamed: src/rtlnmc_version3.f90 -> src/gsi/rtlnmc_version3.f90 -# renamed: src/satthin.F90 -> src/gsi/satthin.F90 -# renamed: src/set_crtm_aerosolmod.f90 -> src/gsi/set_crtm_aerosolmod.f90 -# renamed: src/set_crtm_cloudmod.f90 -> src/gsi/set_crtm_cloudmod.f90 -# new file: src/gsi/setupaod.f90 -# renamed: src/setupbend.f90 -> src/gsi/setupbend.f90 -# new file: src/gsi/setupcldch.f90 -# renamed: src/setupco.f90 -> src/gsi/setupco.f90 -# renamed: src/setupdw.f90 -> src/gsi/setupdw.f90 -# new file: src/gsi/setupgust.f90 -# new file: src/gsi/setuphowv.f90 -# renamed: src/setuplag.f90 -> src/gsi/setuplag.f90 -# renamed: src/setuplcbas.f90 -> src/gsi/setuplcbas.f90 -# new file: src/gsi/setuplight.f90 -# renamed: src/setuplwcp.f90 -> src/gsi/setuplwcp.f90 -# new file: src/gsi/setupmitm.f90 -# new file: src/gsi/setupmxtm.f90 -# new file: src/gsi/setupoz.f90 -# renamed: src/setuppblh.f90 -> src/gsi/setuppblh.f90 -# renamed: src/setuppcp.f90 -> src/gsi/setuppcp.f90 -# renamed: src/setuppm10.f90 -> src/gsi/setuppm10.f90 -# renamed: src/setuppm2_5.f90 -> src/gsi/setuppm2_5.f90 -# renamed: src/setuppmsl.f90 -> src/gsi/setuppmsl.f90 -# renamed: src/setupps.f90 -> src/gsi/setupps.f90 -# renamed: src/setuppw.f90 -> src/gsi/setuppw.f90 -# new file: src/gsi/setupq.f90 -# renamed: src/setuprad.f90 -> src/gsi/setuprad.f90 -# renamed: src/setupref.f90 -> src/gsi/setupref.f90 -# new file: src/gsi/setuprhsall.f90 -# renamed: src/setuprw.f90 -> src/gsi/setuprw.f90 -# renamed: src/setupspd.f90 -> src/gsi/setupspd.f90 -# renamed: src/setupsst.f90 -> src/gsi/setupsst.f90 -# renamed: src/setupswcp.f90 -> src/gsi/setupswcp.f90 -# new file: src/gsi/setupt.f90 -# new file: src/gsi/setuptcamt.f90 -# renamed: src/setuptcp.f90 -> src/gsi/setuptcp.f90 -# renamed: src/setuptd2m.f90 -> src/gsi/setuptd2m.f90 -# new file: src/gsi/setupuwnd10m.f90 -# new file: src/gsi/setupvis.f90 -# new file: src/gsi/setupvwnd10m.f90 -# new file: src/gsi/setupw.f90 -# new file: src/gsi/setupwspd10m.f90 -# renamed: src/sfc_model.f90 -> src/gsi/sfc_model.f90 -# new file: src/gsi/sfcobsqc.f90 -# renamed: src/simpin1.f90 -> src/gsi/simpin1.f90 -# renamed: src/simpin1_init.f90 -> src/gsi/simpin1_init.f90 -# renamed: src/smooth_polcarf.f90 -> src/gsi/smooth_polcarf.f90 -# renamed: src/smoothrf.f90 -> src/gsi/smoothrf.f90 -# renamed: src/smoothwwrf.f90 -> src/gsi/smoothwwrf.f90 -# renamed: src/smoothzrf.f90 -> src/gsi/smoothzrf.f90 -# renamed: src/sparsearr.f90 -> src/gsi/sparsearr.f90 -# renamed: src/sqrtmin.f90 -> src/gsi/sqrtmin.f90 -# renamed: src/ssmis_spatial_average_mod.f90 -> src/gsi/ssmis_spatial_average_mod.f90 -# renamed: src/sst_retrieval.f90 -> src/gsi/sst_retrieval.f90 -# renamed: src/state_vectors.f90 -> src/gsi/state_vectors.f90 -# renamed: src/statsco.f90 -> src/gsi/statsco.f90 -# renamed: src/statsconv.f90 -> src/gsi/statsconv.f90 -# new file: src/gsi/statslight.f90 -# renamed: src/statsoz.f90 -> src/gsi/statsoz.f90 -# renamed: src/statspcp.f90 -> src/gsi/statspcp.f90 -# renamed: src/statsrad.f90 -> src/gsi/statsrad.f90 -# renamed: src/stop1.f90 -> src/gsi/stop1.f90 -# renamed: src/stpaod.f90 -> src/gsi/stpaod.f90 -# renamed: src/stpcalc.f90 -> src/gsi/stpcalc.f90 -# renamed: src/stpcldch.f90 -> src/gsi/stpcldch.f90 -# renamed: src/stpco.f90 -> src/gsi/stpco.f90 -# renamed: src/stpdw.f90 -> src/gsi/stpdw.f90 -# renamed: src/stpgps.f90 -> src/gsi/stpgps.f90 -# renamed: src/stpgust.f90 -> src/gsi/stpgust.f90 -# renamed: src/stphowv.f90 -> src/gsi/stphowv.f90 -# renamed: src/stpjcmod.f90 -> src/gsi/stpjcmod.f90 -# new file: src/gsi/stpjo.f90 -# renamed: src/stplcbas.f90 -> src/gsi/stplcbas.f90 -# new file: src/gsi/stplight.f90 -# renamed: src/stplwcp.f90 -> src/gsi/stplwcp.f90 -# renamed: src/stpmitm.f90 -> src/gsi/stpmitm.f90 -# renamed: src/stpmxtm.f90 -> src/gsi/stpmxtm.f90 -# renamed: src/stpoz.f90 -> src/gsi/stpoz.f90 -# renamed: src/stppblh.f90 -> src/gsi/stppblh.f90 -# renamed: src/stppcp.f90 -> src/gsi/stppcp.f90 -# renamed: src/stppm10.f90 -> src/gsi/stppm10.f90 -# renamed: src/stppm2_5.f90 -> src/gsi/stppm2_5.f90 -# renamed: src/stppmsl.f90 -> src/gsi/stppmsl.f90 -# renamed: src/stpps.f90 -> src/gsi/stpps.f90 -# renamed: src/stppw.f90 -> src/gsi/stppw.f90 -# renamed: src/stpq.f90 -> src/gsi/stpq.f90 -# renamed: src/stprad.f90 -> src/gsi/stprad.f90 -# renamed: src/stprw.f90 -> src/gsi/stprw.f90 -# renamed: src/stpspd.f90 -> src/gsi/stpspd.f90 -# renamed: src/stpsst.f90 -> src/gsi/stpsst.f90 -# renamed: src/stpswcp.f90 -> src/gsi/stpswcp.f90 -# renamed: src/stpt.f90 -> src/gsi/stpt.f90 -# renamed: src/stptcamt.f90 -> src/gsi/stptcamt.f90 -# renamed: src/stptcp.f90 -> src/gsi/stptcp.f90 -# renamed: src/stptd2m.f90 -> src/gsi/stptd2m.f90 -# renamed: src/stpuwnd10m.f90 -> src/gsi/stpuwnd10m.f90 -# renamed: src/stpvis.f90 -> src/gsi/stpvis.f90 -# renamed: src/stpvwnd10m.f90 -> src/gsi/stpvwnd10m.f90 -# renamed: src/stpw.f90 -> src/gsi/stpw.f90 -# renamed: src/stpwspd10m.f90 -> src/gsi/stpwspd10m.f90 -# renamed: src/strong_bal_correction.f90 -> src/gsi/strong_bal_correction.f90 -# renamed: src/strong_baldiag_inc.f90 -> src/gsi/strong_baldiag_inc.f90 -# renamed: src/strong_fast_global_mod.f90 -> src/gsi/strong_fast_global_mod.f90 -# renamed: src/stub_ensmod.f90 -> src/gsi/stub_ensmod.f90 -# renamed: src/stub_get_pseudo_ensperts.f90 -> src/gsi/stub_get_pseudo_ensperts.f90 -# renamed: src/stub_get_wrf_mass_ensperts.f90 -> src/gsi/stub_get_wrf_mass_ensperts.f90 -# renamed: src/stub_get_wrf_nmm_ensperts.f90 -> src/gsi/stub_get_wrf_nmm_ensperts.f90 -# renamed: src/stub_gfs_ensmod.f90 -> src/gsi/stub_gfs_ensmod.f90 -# renamed: src/stub_nstmod.f90 -> src/gsi/stub_nstmod.f90 -# renamed: src/stub_pertmod.F90 -> src/gsi/stub_pertmod.F90 -# renamed: src/stub_read_wrf_mass_files.f90 -> src/gsi/stub_read_wrf_mass_files.f90 -# renamed: src/stub_read_wrf_mass_guess.f90 -> src/gsi/stub_read_wrf_mass_guess.f90 -# renamed: src/stub_read_wrf_nmm_files.f90 -> src/gsi/stub_read_wrf_nmm_files.f90 -# renamed: src/stub_read_wrf_nmm_guess.f90 -> src/gsi/stub_read_wrf_nmm_guess.f90 -# renamed: src/stub_regional_io.f90 -> src/gsi/stub_regional_io.f90 -# renamed: src/stub_set_crtm_aerosol.f90 -> src/gsi/stub_set_crtm_aerosol.f90 -# renamed: src/stub_timermod.f90 -> src/gsi/stub_timermod.f90 -# renamed: src/stub_wrf_binary_interface.f90 -> src/gsi/stub_wrf_binary_interface.f90 -# renamed: src/stub_wrf_netcdf_interface.f90 -> src/gsi/stub_wrf_netcdf_interface.f90 -# renamed: src/stub_wrwrfmassa.f90 -> src/gsi/stub_wrwrfmassa.f90 -# renamed: src/stub_wrwrfnmma.f90 -> src/gsi/stub_wrwrfnmma.f90 -# renamed: src/sub2fslab_mod.f90 -> src/gsi/sub2fslab_mod.f90 -# new file: src/gsi/sumslightbias.f90 -# new file: src/gsi/support_2dvar.f90 -# renamed: src/tcv_mod.f90 -> src/gsi/tcv_mod.f90 -# renamed: src/tendsmod.f90 -> src/gsi/tendsmod.f90 -# renamed: src/test_obsens.f90 -> src/gsi/test_obsens.f90 -# renamed: src/timermod.f90 -> src/gsi/timermod.f90 -# new file: src/gsi/tintrp2a.f90 -# renamed: src/tintrp3.f90 -> src/gsi/tintrp3.f90 -# renamed: src/tpause.f90 -> src/gsi/tpause.f90 -# renamed: src/tpause_t.F90 -> src/gsi/tpause_t.F90 -# renamed: src/tune_pbl_height.f90 -> src/gsi/tune_pbl_height.f90 -# renamed: src/turbl.f90 -> src/gsi/turbl.f90 -# renamed: src/turbl_ad.f90 -> src/gsi/turbl_ad.f90 -# renamed: src/turbl_tl.f90 -> src/gsi/turbl_tl.f90 -# renamed: src/turblmod.f90 -> src/gsi/turblmod.f90 -# renamed: src/tv_to_tsen.f90 -> src/gsi/tv_to_tsen.f90 -# renamed: src/unfill_mass_grid2.f90 -> src/gsi/unfill_mass_grid2.f90 -# renamed: src/unfill_nmm_grid2.f90 -> src/gsi/unfill_nmm_grid2.f90 -# renamed: src/unhalf_nmm_grid2.f90 -> src/gsi/unhalf_nmm_grid2.f90 -# new file: src/gsi/update_guess.f90 -# renamed: src/ut_gsibundle.F90 -> src/gsi/ut_gsibundle.F90 -# renamed: src/wind_fft.f90 -> src/gsi/wind_fft.f90 -# renamed: src/wrf_mass_guess_mod.f90 -> src/gsi/wrf_mass_guess_mod.f90 -# renamed: src/wrf_params_mod.f90 -> src/gsi/wrf_params_mod.f90 -# renamed: src/write_all.F90 -> src/gsi/write_all.F90 -# renamed: src/write_bkgvars_grid.f90 -> src/gsi/write_bkgvars_grid.f90 -# renamed: src/xhat_vordivmod.f90 -> src/gsi/xhat_vordivmod.f90 -# renamed: src/zrnmi_mod.f90 -> src/gsi/zrnmi_mod.f90 -# deleted: src/gsimain.f90 -# deleted: src/gsimod.F90 -# deleted: src/gsisub.F90 -# deleted: src/hybrid_ensemble_isotropic.F90 -# deleted: src/m_berror_stats_reg.f90 -# deleted: src/m_obsHeadBundle.F90 -# deleted: src/m_obsLList.F90 -# deleted: src/m_obsNodeTypeManager.F90 -# deleted: src/m_obsdiags.F90 -# deleted: src/makefile_DTC -# deleted: src/mod_fv3_lola.f90 -# new file: src/ncdiag/CMakeLists.txt -# new file: src/ncdiag/NCDIAG_SRC -# new file: src/ncdiag/nc_diag_cat.F90 -# new file: src/ncdiag/nc_diag_fson.f90 -# new file: src/ncdiag/nc_diag_read_mod.F90 -# new file: src/ncdiag/nc_diag_res.f90 -# new file: src/ncdiag/nc_diag_write_mod.F90 -# new file: src/ncdiag/ncd_kinds.F90 -# new file: src/ncdiag/ncdc_cli_process.F90 -# new file: src/ncdiag/ncdc_climsg.F90 -# new file: src/ncdiag/ncdc_data.F90 -# new file: src/ncdiag/ncdc_data_MPI.F90 -# new file: src/ncdiag/ncdc_dims.F90 -# new file: src/ncdiag/ncdc_metadata.F90 -# new file: src/ncdiag/ncdc_realloc.F90 -# new file: src/ncdiag/ncdc_state.F90 -# new file: src/ncdiag/ncdc_types.f90 -# new file: src/ncdiag/ncdc_vars.F90 -# new file: src/ncdiag/ncdf_path_m.F90 -# new file: src/ncdiag/ncdf_string_m.f90 -# new file: src/ncdiag/ncdf_value_m.f90 -# new file: src/ncdiag/ncdr_alloc_assert.f90 -# new file: src/ncdiag/ncdr_attrs.f90 -# new file: src/ncdiag/ncdr_attrs_fetch.f90 -# new file: src/ncdiag/ncdr_check.f90 -# new file: src/ncdiag/ncdr_climsg.F90 -# new file: src/ncdiag/ncdr_dims.f90 -# new file: src/ncdiag/ncdr_global_attrs.f90 -# new file: src/ncdiag/ncdr_global_attrs_fetch.f90 -# new file: src/ncdiag/ncdr_realloc_mod.F90 -# new file: src/ncdiag/ncdr_state.f90 -# new file: src/ncdiag/ncdr_types.f90 -# new file: src/ncdiag/ncdr_vars.f90 -# new file: src/ncdiag/ncdr_vars_fetch.f90 -# new file: src/ncdiag/ncdres_climsg.F90 -# new file: src/ncdiag/ncdw_chaninfo.F90 -# new file: src/ncdiag/ncdw_ciresize.F90 -# new file: src/ncdiag/ncdw_climsg.F90 -# new file: src/ncdiag/ncdw_data2d.F90 -# new file: src/ncdiag/ncdw_dresize.F90 -# new file: src/ncdiag/ncdw_lheader.F90 -# new file: src/ncdiag/ncdw_metadata.F90 -# new file: src/ncdiag/ncdw_mresize.F90 -# new file: src/ncdiag/ncdw_realloc.F90 -# new file: src/ncdiag/ncdw_state.f90 -# new file: src/ncdiag/ncdw_strarrutils.F90 -# new file: src/ncdiag/ncdw_types.F90 -# new file: src/ncdiag/ncdw_varattr.F90 -# new file: src/ncdiag/netcdf_unlimdims.F90 -# new file: src/ncdiag/serial/CMakeLists.txt -# new file: src/ncdiag/test_nc_unlimdims.F90 -# deleted: src/ncepnems_io.f90 -# deleted: src/obs_sensitivity.f90 -# deleted: src/obsmod.F90 -# deleted: src/penal.f90 -# deleted: src/qcmod.f90 -# deleted: src/radiance_mod.f90 -# deleted: src/radinfo.f90 -# deleted: src/read_diag.f90 -# deleted: src/read_files.f90 -# deleted: src/read_obs.F90 -# deleted: src/read_ozone.f90 -# deleted: src/read_prepbufr.f90 -# deleted: src/read_satmar.f90 -# deleted: src/read_satwnd.f90 -# deleted: src/setupaod.f90 -# deleted: src/setupcldch.f90 -# deleted: src/setupgust.f90 -# deleted: src/setuphowv.f90 -# deleted: src/setupmitm.f90 -# deleted: src/setupmxtm.f90 -# deleted: src/setupoz.f90 -# deleted: src/setupq.f90 -# deleted: src/setuprhsall.f90 -# deleted: src/setupt.f90 -# deleted: src/setuptcamt.f90 -# deleted: src/setupuwnd10m.f90 -# deleted: src/setupvis.f90 -# deleted: src/setupvwnd10m.f90 -# deleted: src/setupw.f90 -# deleted: src/setupwspd10m.f90 -# deleted: src/sfcobsqc.f90 -# deleted: src/stpjo.f90 -# deleted: src/support_2dvar.f90 -# deleted: src/tintrp2a.f90 -# deleted: src/update_guess.f90 -# modified: ush/EnKF/current.enkfparms -# modified: ush/EnKF/enkfa5.parms -# modified: ush/EnKF/run_enkfupdate_convonly.sh -# modified: ush/EnKF/run_enkfupdate_testcase.sh -# modified: ush/EnKF/run_gsi -# modified: ush/EnKF/runenkf_trunk.sh -# deleted: ush/build_all.sh -# modified: ush/build_all_cmake.sh -# deleted: ush/build_enkf.sh -# deleted: ush/build_enkf_utils.sh -# deleted: ush/build_gsi.sh -# new file: ush/comenkf_namelist.sh -# new file: ush/comenkf_namelist_gfs.sh -# new file: ush/comenkf_run_gfs.ksh -# new file: ush/comenkf_run_regional.ksh -# new file: ush/comgsi_namelist.sh -# new file: ush/comgsi_namelist_chem.sh -# new file: ush/comgsi_namelist_gfs.sh -# new file: ush/comgsi_run_chem.ksh -# new file: ush/comgsi_run_gfs.ksh -# new file: ush/comgsi_run_regional.ksh -# modified: ush/rungsi_globalprod.sh -# modified: ush/rungsi_nmmprod.sh -# new file: ush/sub_theia -# modified: ush/sub_wcoss -# modified: ush/sub_wcoss_c -# modified: ush/sub_wcoss_d -# deleted: ush/sub_zeus -# new file: util/Analysis_Utilities/read_diag/CMakeLists.txt -# new file: util/Baseline/check_build.pl -# new file: util/DTC/GEN_BE.comgsi -# new file: util/DTC/MPMC/.deinitMPMC.py -# new file: util/DTC/MPMC/.gitignore -# new file: util/DTC/MPMC/.initMPMC.py -# new file: util/DTC/MPMC/.rocoto.template -# new file: util/DTC/MPMC/CASE_config.py -# new file: util/DTC/MPMC/MPMC_config.py -# new file: util/DTC/MPMC/README.mpmc -# new file: util/DTC/MPMC/deinitmpmc -# new file: util/DTC/MPMC/docker.runMPMCtest -# new file: util/DTC/MPMC/generate.py -# new file: util/DTC/MPMC/initmpmc -# new file: util/DTC/MPMC/option.full/optionlist.Cheyenne -# new file: util/DTC/MPMC/option.full/optionlist.GSI_Docker -# new file: util/DTC/MPMC/option.full/optionlist.Jet -# new file: util/DTC/MPMC/option.full/optionlist.Theia -# new file: util/DTC/MPMC/option.standard/optionlist.Cheyenne -# new file: util/DTC/MPMC/option.standard/optionlist.GSI_Docker -# new file: util/DTC/MPMC/option.standard/optionlist.Jet -# new file: util/DTC/MPMC/option.standard/optionlist.Theia -# new file: util/DTC/MPMC/optionlist.Cheyenne -# new file: util/DTC/MPMC/optionlist.GSI_Docker -# new file: util/DTC/MPMC/optionlist.Jet -# new file: util/DTC/MPMC/optionlist.Theia -# new file: util/DTC/MPMC/releases/fix.check -# new file: util/DTC/MPMC/releases/fix.list -# new file: util/DTC/MPMC/releases/getGlobalFixTarball -# new file: util/DTC/MPMC/releases/makeRelease -# new file: util/DTC/MPMC/report.py -# new file: util/DTC/MPMC/run.py -# new file: util/DTC/MPMC/stopcronMPMC.py -# new file: util/DTC/README.GSI_Docker -# new file: util/DTC/README.comgsi -# new file: util/EnKF/arw/run/anavinfo -# new file: util/EnKF/arw/run/namelist.input -# new file: util/EnKF/arw/run/run_init.ksh -# new file: util/EnKF/arw/run/run_pro.ksh -# new file: util/EnKF/arw/src/CMakeLists.txt -# new file: util/EnKF/arw/src/enspreproc_regional.fd/CMakeLists.txt -# new file: util/EnKF/arw/src/enspreproc_regional.fd/get_gefs_for_regional_enspro.f90 -# new file: util/EnKF/arw/src/enspreproc_regional.fd/gfsp2wrfg.f90 -# new file: util/EnKF/arw/src/enspreproc_regional.fd/guess_grids_enspro.f90 -# new file: util/EnKF/arw/src/enspreproc_regional.fd/read_wrf_mass_guess4ens.F90 -# new file: util/EnKF/arw/src/enspreproc_regional.fd/wrf_netcdf_interface4ens.F90 -# new file: util/EnKF/arw/src/initialens_regional.fd/CMakeLists.txt -# new file: util/EnKF/arw/src/initialens_regional.fd/initial_arw_ens.f90 -# new file: util/EnKF/arw/src/initialens_regional.fd/namelist.input -# new file: util/EnKF/arw/src/initialens_regional.fd/read_netcdf_mass.f90 -# new file: util/EnKF/arw/src/initialens_regional.fd/update_netcdf_mass.f90 -# new file: util/EnKF/gfs/src/adderrspec.fd/CMakeLists.txt -# renamed: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/adderrspec_nmcmeth_ncep_spec.f90 -> util/EnKF/gfs/src/adderrspec.fd/adderrspec_nmcmeth_ncep_spec.f90 -# renamed: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/configure -> util/EnKF/gfs/src/adderrspec.fd/configure -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/adderrspec_nmcmeth_spec.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/calc_increment_ens.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/calc_increment_interface.f90 -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/constants.f90 -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/fv3_interface.f90 -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/main.f90 -# modified: util/EnKF/gfs/src/calc_increment_ens.fd/pmain.f90 -# modified: util/EnKF/gfs/src/getnstensmeanp.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/getnstensmeanp.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/getsfcensmeanp.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/getsfcensmeanp.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/getsfcensmeanp.fd/getsfcensmeanp.f90 -# modified: util/EnKF/gfs/src/getsfcnstensupdp.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/getsfcnstensupdp.fd/Makefile.dependency -# new file: util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt -# renamed: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/configure -> util/EnKF/gfs/src/getsigensmeanp_smooth.fd/configure -# renamed: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/getsigensmeanp_smooth_ncep.f90 -> util/EnKF/gfs/src/getsigensmeanp_smooth.fd/getsigensmeanp_smooth_ncep.f90 -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/getsigensmeanp_smooth_ncep.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/getsigensstatp.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/getsigensstatp.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/getsigensstatp.fd/getsigensstatp.f90 -# modified: util/EnKF/gfs/src/gribmean.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/gribmean.fd/Makefile.dependency -# modified: util/EnKF/gfs/src/preproc/CMakeLists.txt -# modified: util/EnKF/gfs/src/recentersigp.fd/CMakeLists.txt -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.AIX -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.cray -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.nco -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.theia -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.wcoss -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.conf.zeus -# deleted: util/EnKF/gfs/src/recentersigp.fd/Makefile.dependency -# new file: util/Minimization_Monitor/README -# modified: util/Minimization_Monitor/data_xtrct/ush/MinMon_DE.sh -# modified: util/Minimization_Monitor/data_xtrct/ush/RunMM_DE.sh -# modified: util/Minimization_Monitor/data_xtrct/ush/find_cycle.pl -# new file: util/Minimization_Monitor/data_xtrct/ush/run_fv3rt1_DE.sh -# new file: util/Minimization_Monitor/data_xtrct/ush/run_gdas_DE.sh -# new file: util/Minimization_Monitor/data_xtrct/ush/run_gfs_DE.sh -# modified: util/Minimization_Monitor/image_gen/parm/plot_minmon_conf -# modified: util/Minimization_Monitor/image_gen/ush/MinMon_Plt.sh -# typechange: util/Minimization_Monitor/image_gen/ush/find_cycle.pl -# new file: util/Minimization_Monitor/image_gen/ush/run_fv3rt1_IG.sh -# new file: util/Minimization_Monitor/image_gen/ush/run_gdas_IG.sh -# new file: util/Minimization_Monitor/image_gen/ush/run_gfs_IG.sh -# modified: util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON -# modified: util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_vrfminmon.sh.ecf -# modified: util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon.sh -# modified: util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_VMINMON -# modified: util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_vrfminmon.sh.ecf -# modified: util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_gnorms.pl -# modified: util/Minimization_Monitor/parm/MinMon_config -# modified: util/Minimization_Monitor/parm/MinMon_user_settings -# modified: util/Ozone_Monitor/data_xtrct/sorc/make_base.fd/make_base.f90 -# modified: util/Ozone_Monitor/data_xtrct/ush/OznMon_DE.sh -# modified: util/Ozone_Monitor/data_xtrct/ush/OznMon_MkBase.sh -# modified: util/Ozone_Monitor/data_xtrct/ush/find_cycle.pl -# modified: util/Ozone_Monitor/data_xtrct/ush/run_fv3rt1.sh -# new file: util/Ozone_Monitor/data_xtrct/ush/run_gfs_gdas.sh -# modified: util/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh -# modified: util/Ozone_Monitor/image_gen/ush/OznMon_Transfer.sh -# modified: util/Ozone_Monitor/image_gen/ush/mk_err_rpt.sh -# modified: util/Ozone_Monitor/image_gen/ush/mk_horiz.sh -# modified: util/Ozone_Monitor/image_gen/ush/mk_time.sh -# modified: util/Ozone_Monitor/image_gen/ush/plot_horiz.sh -# modified: util/Ozone_Monitor/image_gen/ush/plot_summary.sh -# modified: util/Ozone_Monitor/image_gen/ush/plot_time.sh -# modified: util/Ozone_Monitor/image_gen/ush/run_plot_fv3rt1.sh -# modified: util/Ozone_Monitor/image_gen/ush/run_plot_gdas.sh -# new file: util/Ozone_Monitor/image_gen/ush/run_transfer_fv3rt1.sh -# modified: util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_VERFOZN -# modified: util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/scripts/exgdas_vrfyozn.sh.ecf -# new file: util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/CMakeLists.txt -# modified: util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/makefile -# new file: util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/CMakeLists.txt -# modified: util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh -# modified: util/Ozone_Monitor/parm/OznMon_config -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad.sh -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_theia.sh -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_base.tar -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_satype.txt -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_scaninfo.txt -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/jobs/JGDAS_VERFRAD -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/parm/gdas_radmon.parm -# modified: util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/scripts/exgdas_vrfyrad.sh.ecf -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/dell/RadMonBuild -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/angle_bias.f90 -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/bcoef.f90 -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/bcor.f90 -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/makefile -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/time.f90 -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_angle.sh -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcoef.sh -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcor.sh -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_time.sh -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/dell/RadMonBuild -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/makefile -# new file: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/CMakeLists.txt -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/makefile -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_angle.sh -# modified: util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_time.sh -# new file: util/bufr_tools/CMakeLists.txt -# modified: util/bufr_tools/bufr_append_sample.f90 -# modified: util/bufr_tools/bufr_encode_sample.f90 -# deleted: util/bufr_tools/makefile -# new file: util/bufr_tools/prepbufr.table -# deleted: util/bufr_tools/prepobs_prep.bufrtable -# new file: util/gsienvreport.sh -# modified: util/ndate/CMakeLists.txt -# new file: util/radar_process/radialwind/CMakeLists.txt -# deleted: util/radar_process/radialwind/makefile -# new file: util/radar_process/reflectivity/CMakeLists.txt -# deleted: util/radar_process/reflectivity/makefile -# -# Unmerged paths: -# (use "git add/rm ..." as appropriate to mark resolution) -# -# deleted by them: src/enkf/Makefile -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# 1 diff --git a/cmake/Modules/FindBACIO.cmake b/cmake/Modules/FindBACIO.cmake new file mode 100644 index 0000000000..04410f631e --- /dev/null +++ b/cmake/Modules/FindBACIO.cmake @@ -0,0 +1,55 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{BACIO_VER}) + set(BACIO_VER $ENV{BACIO_VER}) + STRING(REGEX REPLACE "v" "" BACIO_VER ${BACIO_VER}) +endif() +if(NOT BUILD_BACIO ) + if(DEFINED ENV{BACIO_LIB4}) + set(BACIO_LIBRARY $ENV{BACIO_LIB4} ) + else() + find_library( BACIO_LIBRARY + NAMES libbacio.a libbacio_4.a libbacio_v${BACIO_VER}_4.a + HINTS $ENV{COREPATH}/lib /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/bacio/v${BACIO_VER} + ${COREPATH}/bacio/v${BACIO_VER}/intel + ${COREPATH}/bacio/v${BACIO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH} + ) + message("Found BACIO library ${BACIO_LIBRARY}") + endif() +endif() +if( NOT BACIO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find BACIO library, so building from libsrc") + if( DEFINED ENV{BACIO_SRC} ) + set( BACIO_DIR $ENV{BACIO_SRC} CACHE STRING "BACIO Source Directory" ) + else() + findSrc( "bacio" BACIO_VER BACIO_DIR ) + set(BACIOINC "${CMAKE_BINARY_DIR}/include") + endif() + set( libsuffix "_v${BACIO_VER}${debug_suffix}" ) + set( bacio "bacio${libsuffix}") + set( BUILD_BACIO "ON" CACHE INTERNAL "Build Bacio library" ) + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/bacio) + set( BACIO_LIBRARY ${bacio} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) + else() + set( CORE_BUILT ${BACIO_LIBRARY} ) + endif() +else( NOT BACIO_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${BACIO_LIBRARY} ) + else() + set( CORE_LIBRARIES ${BACIO_LIBRARY} ) + endif() +endif( NOT BACIO_LIBRARY ) + +set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) + diff --git a/cmake/Modules/FindBUFR.cmake b/cmake/Modules/FindBUFR.cmake new file mode 100644 index 0000000000..58527743bc --- /dev/null +++ b/cmake/Modules/FindBUFR.cmake @@ -0,0 +1,60 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{BUFR_VER}) + set(BUFR_VER $ENV{BUFR_VER}) + STRING(REGEX REPLACE "v" "" BUFR_VER ${BUFR_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_BUFR ) + if(DEFINED ENV{BUFR_LIBd} ) + set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) + message("BUFR library ${BUFR_LIBRARY} set via Environment variable") + else() + find_library( BUFR_LIBRARY + NAMES libbufr.a libbufr_d_64.a libbufr_i4r8.a libbufr_v${BUFR_VER}_d_64.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/bufr/v${BUFR_VER} + ${COREPATH}/bufr/v${BUFR_VER}/intel + ${COREPATH}/bufr/v${BUFR_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( bufr "bufr_v${BUFR_VER}") + message("Found BUFR library ${BUFR_LIBRARY}") + endif() +endif() +if( NOT BUFR_LIBRARY ) # didn't find the library, so build it from source + message("Could not find BUFR library, so building from libsrc") + if( NOT DEFINED ENV{BUFR_SRC} ) + findSrc( "bufr" BUFR_VER BUFR_DIR ) + else() + set( BUFR_DIR "$ENV{BUFR_SRC}/libsrc" CACHE STRING "BUFR Source Location") + endif() + set( libsuffix "_v${BUFR_VER}${debug_suffix}" ) + set( BUFR_LIBRARY "${LIBRARY_OUTPUT_PATH}/libbufr${libsuffix}.a" CACHE STRING "BUFR Library" ) + set( bufr "bufr${libsuffix}") + set( BUILD_BUFR "ON" CACHE INTERNAL "Build the BUFR library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/bufr) + set( BUFR_LIBRARY ${bufr} ) + + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${BUFR_LIBRARY} ) + else() + set( CORE_BUILT ${BUFR_LIBRARY} ) + endif() +else( NOT BUFR_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${BUFR_LIBRARY} ) + else() + set( CORE_LIBRARIES ${BUFR_LIBRARY} ) + endif() +endif() +set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) + diff --git a/cmake/Modules/FindBaselibs.cmake b/cmake/Modules/FindBaselibs.cmake new file mode 100644 index 0000000000..793cb9a5d4 --- /dev/null +++ b/cmake/Modules/FindBaselibs.cmake @@ -0,0 +1,68 @@ +if (NOT BASEDIR) + if(${COMPILER_TYPE} STREQUAL "intel" ) + string(REGEX MATCH "mpt" MPT ${MPI_Fortran_INCLUDE_PATH}) + string(REGEX MATCH "impi" IMPI ${MPI_Fortran_INCLUDE_PATH}) + message("REGEX returns ${MPT} ") + if( MPT MATCHES "mpt" ) + message("setting mpt paths ") + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_15.0.2.164-mpt_2.14/Linux") + elseif( IMPI MATCHES "impi" ) + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_16.0.3.210-intelmpi_5.1.3.210/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() + if(${COMPILER_TYPE} STREQUAL "gnu" ) + string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) + message("REGEX returns ${OPENMPI} ") + if( OPENMPI MATCHES "openmpi" ) + message("setting openmpi paths ") + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-4_0_8/x86_64-unknown-linux-gnu/gfortran_7.2.0-openmpi_3.0.0/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() + if(${COMPILER_TYPE} STREQUAL "pgi" ) + string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) + if( OPENMPI MATCHES "openmpi" ) + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_1/x86_64-unknown-linux-gnu/pgfortran_16.5-openmpi_1.10.3/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() +endif () +if (ESMA_SDF) + message (FATAL_ERROR "ERROR: -hdf option was thought to be obsolete when CMake was crafted.") +endif () + +link_directories (${BASEDIR}/lib) + +#------------------------------------------------------------------ +# netcdf +# The following command provides the list of libraries that netcdf +# uses. Unfortunately it also includes the library path and "-l" +# prefixes, which CMake handles in a different manner. So we need so +# strip off that item from the list +execute_process ( + COMMAND ${BASEDIR}/bin/nf-config --flibs + OUTPUT_VARIABLE LIB_NETCDF + ) + +string(REGEX MATCHALL " -l[^ ]*" _full_libs "${LIB_NETCDF}") +set (NETCDF_LIBRARIES) +foreach (lib ${_full_libs}) + string (REPLACE "-l" "" _tmp ${lib}) + string (STRIP ${_tmp} _tmp) + list (APPEND NETCDF_LIBRARIES ${_tmp}) +endforeach() +#------------------------------------------------------------------ + +list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/netcdf) +list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/hdf5) + +message(STATUS "NETCDF_INCLUDES: ${NETCDF_INCLUDES}") +message(STATUS "NETCDF_LIBRARIES: ${NETCDF_LIBRARIES}") + diff --git a/cmake/Modules/FindCORELIBS.cmake b/cmake/Modules/FindCORELIBS.cmake new file mode 100644 index 0000000000..711864ebce --- /dev/null +++ b/cmake/Modules/FindCORELIBS.cmake @@ -0,0 +1,287 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{BUFR_VER}) + set(BUFR_VER $ENV{BUFR_VER}) + STRING(REGEX REPLACE "v" "" BUFR_VER ${BUFR_VER}) +endif() +if(DEFINED ENV{NEMSIO_VER}) + set(NEMSIO_VER $ENV{NEMSIO_VER}) + STRING(REGEX REPLACE "v" "" NEMSIO_VER ${NEMSIO_VER}) +endif() +if(DEFINED ENV{SFCIO_VER}) + set(SFCIO_VER $ENV{SFCIO_VER}) + STRING(REGEX REPLACE "v" "" SFCIO_VER ${SFCIO_VER}) +endif() +if(DEFINED ENV{SIGIO_VER}) + set(SIGIO_VER $ENV{SIGIO_VER}) + STRING(REGEX REPLACE "v" "" SIGIO_VER ${SIGIO_VER}) +endif() +if(DEFINED ENV{SP_VER}) + set(SP_VER $ENV{SP_VER}) + STRING(REGEX REPLACE "v" "" SP_VER ${SP_VER}) +endif() +if(DEFINED ENV{W3EMC_VER}) + set(W3EMC_VER $ENV{W3EMC_VER}) + STRING(REGEX REPLACE "v" "" W3EMC_VER ${W3EMC_VER}) +endif() +if(DEFINED ENV{W3NCO_VER}) + set(W3NCO_VER $ENV{W3NCO_VER}) + STRING(REGEX REPLACE "v" "" W3NCO_VER ${W3NCO_VER}) +endif() + +set (CORE_DEPS " ") +set( NO_DEFAULT_PATH ) +if(NOT BUILD_EMC ) + if(DEFINED ENV{W3EMC_LIBd} ) + set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} ) + set(W3EMCINC $ENV{W3EMC_INCd} ) + else() + find_path( W3EMCINC + NAMES mersenne_twister.mod + HINTS + $ENV{COREPATH}/lib/incmod/w3emc_4 + $ENV{COREPATH}/include + /usr/local/jcsda/nwprod_gdas_2014/lib/lib/incmod/w3emc_4 + ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_d + ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_d + ) + find_library( W3EMC_LIBRARY + NAMES libw3emc_4.a libw3emc_i4r8.a libw3emc_v${W3EMC_VER}_d.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/w3emc/v${W3EMC_VER} + ${COREPATH}/w3emc/v${W3EMC_VER}/intel + PATH_SUFFIXES + lib + ) + message("Found W3EMC library ${W3EMC_LIBRARY}") + endif() +else() + set( libsuffix "_v${W3EMC_VER}${debug_suffix}" ) + set( W3EMC_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3emc${libsuffix}.a" CACHE STRING "W3EMC Library" ) + set( w3emc "w3emc${libsuffix}") + if( DEFINED ENV{W3EMC_SRC} ) + set( W3EMC_DIR $ENV{W3EMC_SRC} CACHE STRING "W3EMC Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "w3emc" W3EMC_VER W3EMC_DIR ) + endif() + endif() +endif() +if(NOT BUILD_NCO ) + if(DEFINED ENV{W3NCO_LIBd} ) + set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} ) + else() + find_library( W3NCO_LIBRARY + NAMES libw3nco_v${W3NCO_VER}_d.a libw3nco_d.a libw3nco_i4r8.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/w3nco/v${W3NCO_VER} + ${COREPATH}/w3nco/v${W3NCO_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + message("Found W3NCO library ${W3NCO_LIBRARY}") + endif() +else() + if( DEFINED ENV{W3NCO_SRC} ) + set( W3NCO_DIR $ENV{W3NCO_SRC} CACHE STRING "W3NCO Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "w3nco" W3NCO_VER W3NCO_DIR ) + endif() + endif() + set( libsuffix "_v${W3NCO_VER}${debug_suffix}" ) + set( W3NCO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3nco${libsuffix}.a" CACHE STRING "W3NCO Library" ) + set( w3nco "w3nco${libsuffix}") +endif() +if(NOT BUILD_BUFR ) + if(DEFINED ENV{BUFR_LIBd} ) + set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) + else() + find_library( BUFR_LIBRARY + NAMES libbufr.a libbufr_d_64.a libbufr_i4r8.a libbufr_v${BUFR_VER}_d_64.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/bufr/v${BUFR_VER} + ${COREPATH}/bufr/v${BUFR_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( bufr "bufr_v${BUFR_VER}") + message("Found BUFR library ${BUFR_LIBRARY}") + endif() +else() + if( DEFINED ENV{BUFR_SRC} ) + set( BUFR_DIR $ENV{BUFR_SRC} CACHE STRING "BUFR Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "bufr" BUFR_VER BUFR_DIR ) + endif() + endif() + set( libsuffix "_v${BUFR_VER}${debug_suffix}" ) + set( BUFR_LIBRARY "${LIBRARY_OUTPUT_PATH}/libbufr${libsuffix}.a" CACHE STRING "BUFR Library" ) + set( bufr "bufr${libsuffix}") +endif() +if(NOT BUILD_SFCIO ) + if(DEFINED ENV{SFCIO_LIB4} ) + set(SFCIO_LIBRARY $ENV{SFCIO_LIB4} ) + set(SFCIOINC $ENV{SFCIO_INC4} ) + else() + findInc( sfcio SFCIO_VER SFCIOINC ) + find_library( SFCIO_LIBRARY + NAMES libsfcio.a libsfcio_4.a libsfcio_i4r4.a libsfcio_v${SFCIO_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sfcio/v${SFCIO_VER} + ${COREPATH}/sfcio/v${SFCIO_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sfcio "sfcio_v${SFCIO_VER}_4") + message("Found SFCIO library ${SFCIO_LIBRARY}") + endif() +else() + if( DEFINED ENV{SFCIO_SRC} ) + set( SFCIO_DIR $ENV{SFCIO_SRC} CACHE STRING "SFCIO Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "sfcio" SFCIO_VER SFCIO_DIR ) + endif() + endif() + set( libsuffix "_v${SFCIO_VER}${debug_suffix}" ) + set( SFCIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsfcio${libsuffix}.a" CACHE STRING "SFCIO Library" ) + set( sfcio "sfcio${libsuffix}") +endif() +if(NOT BUILD_SIGIO ) + if(DEFINED ENV{SIGIO_LIB4} ) + set(SIGIO_LIBRARY $ENV{SIGIO_LIB4} ) + set(SIGIOINC $ENV{SIGIO_INC4} ) + else() + findInc( sigio SIGIO_VER SIGIOINC ) + message("SIGIOINC is ${SIGIOINC}") + find_library( SIGIO_LIBRARY + NAMES libsigio.a libsigio_4.a libsigio_i4r4.a libsigio_v${SIGIO_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sigio/v${SIGIO_VER} + ${COREPATH}/sigio/v${SIGIO_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sigio "sigio_v${SIGIO_VER}_4") + message("Found SIGIO library ${SIGIO_LIBRARY}") + endif() +else() + if( DEFINED ENV{SIGIO_SRC} ) + set( SIGIO_DIR $ENV{SIGIO_SRC} CACHE STRING "SIGIO Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "sigio" SIGIO_VER SIGIO_DIR ) + endif() + endif() + set( libsuffix "_v${SIGIO_VER}${debug_suffix}" ) + set( SIGIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsigio${libsuffix}.a" CACHE STRING "SIGIO Library" ) + set( sigio "sigio${libsuffix}") + set( CORE_DEPS "${CORE_DEPS} ${baseName}" ) +endif() +if(NOT BUILD_NEMSIO ) + if(DEFINED ENV{NEMSIO_LIB} ) + set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} ) + set(NEMSIOINC $ENV{NEMSIO_INC} ) + else() + findInc( nemsio NEMSIO_VER NEMSIOINC ) + find_library( NEMSIO_LIBRARY + NAMES libnemsio.a libnemsio_v${NEMSIO_VER}.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/nemsio/v${NEMSIO_VER} + ${COREPATH}/nemsio/v${NEMSIO_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( nemsio "nemsio_v${NEMSIO_VER}") + message("Found NEMSIO library ${NEMSIO_LIBRARY}") + endif() +else() + if( DEFINED ENV{NEMSIO_SRC} ) + set( NEMSIO_DIR $ENV{NEMSIO_SRC} CACHE STRING "NEMSIO Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "nemsio" NEMSIO_VER NEMSIO_DIR ) + endif() + endif() + set( libsuffix "_v${NEMSIO_VER}${debug_suffix}" ) + set( NEMSIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libnemsio${libsuffix}.a" CACHE STRING "NEMSIO Library" ) + set( nemsio "nemsio${libsuffix}") +endif() +if(NOT BUILD_SP ) + if(DEFINED ENV{SP_LIBd} ) + set(SP_LIBRARY $ENV{SP_LIBd} ) + else() + find_library( SP_LIBRARY + NAMES libsp_d.a libsp_i4r8.a libsp_v${SP_VER}_d.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sp/v${SP_VER} + ${COREPATH}/sp/v${SP_VER}/intel + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sp "sp_v${SP_VER}_d") + message("Found SP library ${SP_LIBRARY}") + endif() +else() + if( DEFINED ENV{SP_SRC} ) + set( SP_DIR $ENV{SP_SRC} CACHE STRING "SP Source Directory" ) + else() + if( FIND_SRC ) + findSrc( "sp" SP_VER SP_DIR ) + endif() + endif() + set( libsuffix "_v${SP_VER}${debug_suffix}" ) + set( SP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp${libsuffix}.a" CACHE STRING "SP Library" ) + set( sp "sp${libsuffix}") +endif() + +if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${SFCIO_LIBRARY} ${SIGIO_LIBRARY} + ${NEMSIO_LIBRARY} ${SP_LIBRARY} ${W3NCO_LIBRARY} ${BUFR_LIBRARY} + ${W3EMC_LIBRARY} CACHE INTERNAL "List of Core libs" ) + list( APPEND CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ${SIGIOINC} ${NEMSIOINC} ${W3EMCINC} ) +else() + set( CORE_LIBRARIES ${SFCIO_LIBRARY} ${SIGIO_LIBRARY} + ${NEMSIO_LIBRARY} ${SP_LIBRARY} ${W3NCO_LIBRARY} ${BUFR_LIBRARY} + ${W3EMC_LIBRARY} CACHE INTERNAL "List of Core libs" ) + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ${SIGIOINC} ${NEMSIOINC} ${W3EMCINC} ) +endif() + +set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) + +set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) +set( SFCIO_INCLUDE_PATH ${SFCIOINC} CACHE STRING "SFCIO Include Location" ) + +set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) +set( SIGIO_INCLUDE_PATH ${SIGIOINC} CACHE STRING "SIGIO Include Location" ) + +set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) + +set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) +set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) + +set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) +set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) + +set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) + diff --git a/cmake/Modules/FindCRTM.cmake b/cmake/Modules/FindCRTM.cmake new file mode 100644 index 0000000000..ee982c1499 --- /dev/null +++ b/cmake/Modules/FindCRTM.cmake @@ -0,0 +1,81 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{CRTM_VER}) + set(CRTM_VER $ENV{CRTM_VER}) + STRING(REGEX REPLACE "v" "" CRTM_VER ${CRTM_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_CRTM ) + if(DEFINED ENV{CRTM_LIB} ) + set(CRTM_LIBRARY $ENV{CRTM_LIB} ) + set(CRTMINC $ENV{CRTM_INC} ) + message("CRTM library ${CRTM_LIBRARY} set via Environment variable") + else() + findInc( crtm CRTM_VER CRTMINC ) + find_library( CRTM_LIBRARY + NAMES libcrtm_v${CRTM_VER}.a libcrtm.a libCRTM.a + HINTS + /usr/local/jcsda/nwprod_gdas_2014/lib + ${CRTM_BASE} + ${CRTM_BASE}/lib + ${CRTM_BASE}/${CRTM_VER} + ${CRTM_BASE}/${CRTM_VER}/lib + ${CRTM_BASE}/v${CRTM_VER}/intel + ${CRTM_BASE}/v${CRTM_VER}/ips/${COMPILER_VERSION} + ${COREPATH}/v${CRTM_VER}/ips/${COMPILER_VERSION} + ${COREPATH} + ${COREPATH}/lib + $ENV{COREPATH} + $ENV{COREPATH}/lib + $ENV{COREPATH}/include + ${CORECRTM}/crtm/${CRTM_VER} + /nwprod2/lib/crtm/v${CRTM_VER} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( crtm "crtm_v${CRTM_VER}") + message("Found CRTM library ${CRTM_LIBRARY}") + endif() +endif() +if( NOT CRTM_LIBRARY ) # didn't find the library, so build it from source + message("Could not find CRTM library, so building from libsrc") + if( NOT DEFINED ENV{CRTM_SRC} ) + findSrc( "crtm" CRTM_VER CRTM_DIR ) + set(CRTMINC "${CMAKE_BINARY_DIR}/include") + else() + set( CRTM_DIR "$ENV{CRTM_SRC}/libsrc" CACHE STRING "CRTM Source Location") + set(CRTMINC "${CORECRTM}/crtm/${CRTM_VER}/incmod/crtm_v${CRTM_VER}") + endif() + set( libsuffix "_v${CRTM_VER}${debug_suffix}" ) + set( CRTM_LIBRARY "${LIBRARY_OUTPUT_PATH}/libcrtm${libsuffix}.a" CACHE STRING "CRTM Library" ) + set( crtm "crtm${libsuffix}") + set( BUILD_CRTM "ON" CACHE INTERNAL "Build the CRTM library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/crtm) + set( CRTM_LIBRARY ${crtm} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${CRTM_LIBRARY} ) + else() + set( CORE_BUILT ${CRTM_LIBRARY} ) + endif() +else( NOT CRTM_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${CRTM_LIBRARY} ) + else() + set( CORE_LIBRARIES ${CRTM_LIBRARY} ) + endif() +endif( NOT CRTM_LIBRARY ) + +if( CORE_INCS ) + list( APPEND CORE_INCS ${CRTMINC} ) +else() + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${CRTMINC} ) +endif() + +set( CRTM_LIBRARY_PATH ${CRTM_LIBRARY} CACHE STRING "CRTM Library Location" ) +set( CRTM_INCLUDE_PATH ${CRTMINC} CACHE STRING "CRTM Include Location" ) + diff --git a/cmake/Modules/FindGSICONTROL.cmake b/cmake/Modules/FindGSICONTROL.cmake new file mode 100644 index 0000000000..5b2e12280a --- /dev/null +++ b/cmake/Modules/FindGSICONTROL.cmake @@ -0,0 +1,52 @@ +# - Find the Control version of GSI to use for regression testing + +set( NO_DEFAULT_PATH ) +message("Control path is ${CONTROLPATH}") +find_file( CONTROL_EXE + NAMES gsi.x global_gsi ${GSIEXEC} + HINTS + ${CONTROLPATH} + ${CONTROLPATH}/bin + ${CONTROLPATH}/exec + $ENV{CONTROLPATH} + $ENV{CONTROLPATH}/bin + $ENV{CONTROLPATH}/exec + $ENV{CONTROLPATH}/src + ${CMAKE_SOURCE_DIR}/../trunk/src + ${CMAKE_SOURCE_DIR}/../../trunk/src + ${PROJECT_BINARY_DIR}/../build-trunk/bin + /da/save/Michael.Lueken/svn1/build/bin + /da/save/Michael.Lueken/svn1/src + /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src + /scratch1/NCEPDEV/da/Michael.Lueken/svn1/build/bin + + ${NO_DEFAULT_PATH}) + +set( GSICONTROL ${CONTROL_EXE} CACHE STRING "GSI control executable for regression testing" FORCE ) + +find_file( ENKF_CONTROL_EXE + NAMES enkf_gfs.x global_enkf ${ENKFEXEC} + HINTS + ${CONTROLPATH} + ${CONTROLPATH}/bin + ${CONTROLPATH}/exec + $ENV{CONTROLPATH} + $ENV{CONTROLPATH}/bin + $ENV{CONTROLPATH}/exec + ${CMAKE_SOURCE_DIR}/../trunk/src/enkf + ${PROJECT_BINARY_DIR}/../build-trunk/bin + $ENV{CONTROLPATH}/enkf + $ENV{CONTROLPATH}/src/enkf + /da/save/Michael.Lueken/svn1/build/bin + /da/save/Michael.Lueken/svn1/src/enkf + /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src/enkf + /scratch1/NCEPDEV/da/Michael.Lueken/svn1/build/bin + + ${NO_DEFAULT_PATH}) + +set( ENKFCONTROL ${ENKF_CONTROL_EXE} CACHE STRING "ENKF control executable for regression testing" FORCE ) + diff --git a/cmake/Modules/FindHDF5.cmake b/cmake/Modules/FindHDF5.cmake new file mode 100644 index 0000000000..78e3db3678 --- /dev/null +++ b/cmake/Modules/FindHDF5.cmake @@ -0,0 +1,24 @@ +# This extends CMake's FindHDF5.cmake to add support to include MPI include +# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON +# (BUG #0014363). + +# include the default FindHDF5.cmake. +#if(CMAKE_VERSION VERSION_LESS 3.6.1) +if(CMAKE_VERSION VERSION_GREATER 3.0 ) + include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) +else() + include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) +endif() +#endif() + +if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) + if(MPI_C_INCLUDE_PATH) + list(APPEND HDF5_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) + endif() + if(MPI_C_LIBRARIES) + list(APPEND HDF5_LIBRARIES ${MPI_C_LIBRARIES}) + endif() + if(MPI_CXX_LIBRARIES) + list(APPEND HDF5_LIBRARIES ${MPI_CXX_LIBRARIES}) + endif() +endif() diff --git a/cmake/Modules/FindIP.cmake b/cmake/Modules/FindIP.cmake new file mode 100644 index 0000000000..26ec21704e --- /dev/null +++ b/cmake/Modules/FindIP.cmake @@ -0,0 +1,83 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{IP_VER}) + set(IP_VER $ENV{IP_VER}) + STRING(REGEX REPLACE "v" "" IP_VER ${IP_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_IP ) + if(DEFINED ENV{IP_LIBd} ) + set(IP_LIBRARY $ENV{IP_LIBd} ) + message("IP library ${IP_LIBRARY} set via Environment variable") + else() + find_library( IP_LIBRARY + NAMES libip_d.a libip_i4r8.a libip_v${IP_VER}_d.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/ip/v${IP_VER} + ${COREPATH}/ip/v${IP_VER}/intel + ${COREPATH}/ip/v${IP_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( ip "ip_v${IP_VER}_d") + message("Found IP library ${IP_LIBRARY}") + endif() + if(DEFINED ENV{IP_LIB4} ) + set(IP_4_LIBRARY $ENV{IP_LIB4} ) + message("IP 4 library ${IP_4_LIBRARY} set via Environment variable") + else() + find_library( IP_4_LIBRARY + NAMES libip_4.a libip_i4r4.a libip_v${IP_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/ip/v${IP_VER} + ${COREPATH}/ip/v${IP_VER}/intel + ${COREPATH}/ip/v${IP_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( ip "ip_v${IP_VER}_4") + message("Found IP_4 library ${IP_4_LIBRARY}") + endif() +endif() +if( NOT IP_LIBRARY ) # didn't find the library, so build it from source + message("Could not find IP library, so building from libsrc") + if( NOT DEFINED ENV{IP_SRC} ) + findSrc( "ip" IP_VER IP_DIR ) + else() + set( IP_DIR "$ENV{IP_SRC}/libsrc" CACHE STRING "IP Source Location") + endif() + set( libsuffix "_v${IP_VER}${debug_suffix}" ) + set( IP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libip${libsuffix}.a" CACHE STRING "IP Library" ) + set( IP_4_LIBRARY "${LIBRARY_OUTPUT_PATH}/libip_4${libsuffix}.a" CACHE STRING "IP_4 Library" ) + set( ip "ip${libsuffix}") + set( ip4 "ip_4${libsuffix}") + set( BUILD_IP "ON" CACHE INTERNAL "Build the IP library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/ip) + set( IP_LIBRARY ${ip} ) + set( IP_4_LIBRARY ${ip4} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${IP_LIBRARY} ) + else() + set( CORE_BUILT ${IP_LIBRARY} ) + endif() +else( NOT IP_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${IP_LIBRARY} ) + else() + set( CORE_LIBRARIES ${IP_LIBRARY} ) + endif() +endif( NOT IP_LIBRARY ) + + +set( IP_LIBRARY_PATH ${IP_LIBRARY} CACHE STRING "IP Library Location" ) +set( IP_4_LIBRARY_PATH ${IP_4_LIBRARY} CACHE STRING "IP_4 Library Location" ) + diff --git a/cmake/Modules/FindMPI.cmake b/cmake/Modules/FindMPI.cmake new file mode 100644 index 0000000000..8e0a0c95ba --- /dev/null +++ b/cmake/Modules/FindMPI.cmake @@ -0,0 +1,18 @@ +# This extends CMake's FindHDF5.cmake to add support to include MPI include +# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON +# (BUG #0014363). + +# include the default FindMPI.cmake. +if(CMAKE_VERSION VERSION_LESS 3.1) + include(${CMAKE_ROOT}/Modules/FindMPI.cmake) +elseif(CMAKE_VERSION VERSION_LESS 3.6) + message("Using new FindMPI") + include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindMPI.cmake) +# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") +else() + message("Using installed FindMPI") + include(${CMAKE_ROOT}/Modules/FindMPI.cmake) +# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") + message("include dirs are ${MPI_Fortran_INCLUDE_DIRS}") + message("include PATH ${MPI_Fortran_INCLUDE_PATH}") +endif() diff --git a/cmake/Modules/FindNDATE.cmake b/cmake/Modules/FindNDATE.cmake new file mode 100644 index 0000000000..44bf4f1cd5 --- /dev/null +++ b/cmake/Modules/FindNDATE.cmake @@ -0,0 +1,13 @@ +# - Find the NDATE utility or build it + +set( NO_DEFAULT_PATH ) +if(DEFINED ENV{NDATE}) + set(NDATE $ENV{NDATE} ) +else() + find_file( NDATE + NAMES ndate.x ndate + HINTS + /nwprod/util/exec + $ENV{NWPROD}/util/exec + ${NO_DEFAULT_PATH}) +endif() diff --git a/cmake/Modules/FindNEMSIO.cmake b/cmake/Modules/FindNEMSIO.cmake new file mode 100644 index 0000000000..1263fc516a --- /dev/null +++ b/cmake/Modules/FindNEMSIO.cmake @@ -0,0 +1,72 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{NEMSIO_VER}) + set(NEMSIO_VER $ENV{NEMSIO_VER}) + STRING(REGEX REPLACE "v" "" NEMSIO_VER ${NEMSIO_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_NEMSIO ) + if(DEFINED ENV{NEMSIO_LIB} ) + set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} ) + set(NEMSIOINC $ENV{NEMSIO_INC} ) + message("NEMSIO library ${NEMSIO_LIBRARY} set via Environment variable") + else() + findInc( nemsio NEMSIO_VER NEMSIOINC ) + find_library( NEMSIO_LIBRARY + NAMES libnemsio_v${NEMSIO_VER}.a libnemsio.a libNEMSIO.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/nemsio/v${NEMSIO_VER} + ${COREPATH}/nemsio/v${NEMSIO_VER}/intel + ${COREPATH}/nemsio/v${NEMSIO_VER}//ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} + ${COREPATH}/nemsio/v${NEMSIO_VER}//ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( nemsio "nemsio_v${NEMSIO_VER}") + message("Found NEMSIO library ${NEMSIO_LIBRARY}") + endif() +endif() +if( NOT NEMSIO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find NEMSIO library, so building from libsrc") + if( NOT DEFINED ENV{NEMSIO_SRC} ) + findSrc( "nemsio" NEMSIO_VER NEMSIO_DIR ) + set(NEMSIOINC "${CMAKE_BINARY_DIR}/include") + else() + set( NEMSIO_DIR "$ENV{NEMSIO_SRC}/libsrc" CACHE STRING "NEMSIO Source Location") + set(NEMSIOINC "${CORENEMSIO}/nemsio/${NEMSIO_VER}/incmod/nemsio_v${NEMSIO_VER}") + endif() + set( libsuffix "_v${NEMSIO_VER}${debug_suffix}" ) + set( NEMSIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libnemsio${libsuffix}.a" CACHE STRING "NEMSIO Library" ) + set( nemsio "nemsio${libsuffix}") + set( BUILD_NEMSIO "ON" CACHE INTERNAL "Build the NEMSIO library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/nemsio) + set( NEMSIO_LIBRARY ${nemsio} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${NEMSIO_LIBRARY} ) + else() + set( CORE_BUILT ${NEMSIO_LIBRARY} ) + endif() +else( NOT NEMSIO_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${NEMSIO_LIBRARY} ) + else() + set( CORE_LIBRARIES ${NEMSIO_LIBRARY} ) + endif() +endif( NOT NEMSIO_LIBRARY ) + +if( CORE_INCS ) + list( APPEND CORE_INCS ${NEMSIOINC} ) +else() + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${NEMSIOINC} ) +endif() + +set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) +set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) + diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake new file mode 100644 index 0000000000..f114c8df86 --- /dev/null +++ b/cmake/Modules/FindNetCDF.cmake @@ -0,0 +1,147 @@ +# - Find NetCDF +# Find the native NetCDF includes and library +# +# NETCDF_INCLUDES - where to find netcdf.h, etc +# NETCDF_LIBRARIES - Link these libraries when using NetCDF +# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) +# +# Your package can require certain interfaces to be FOUND by setting these +# +# NETCDF_CXX - require the C++ interface and link the C++ library +# NETCDF_F77 - require the F77 interface and link the fortran library +# NETCDF_F90 - require the F90 interface and link the fortran library +# +# The following are not for general use and are included in +# NETCDF_LIBRARIES if the corresponding option above is set. +# +# NETCDF_LIBRARIES_C - Just the C interface +# NETCDF_LIBRARIES_CXX - C++ interface, if available +# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available +# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available +# +# Normal usage would be: +# set (NETCDF_F90 "YES") +# find_package (NetCDF REQUIRED) +# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES}) +# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C}) + + +set(NETCDF_DIR $ENV{NETCDF}) +message("Enviroment NETCDF is ${NetCDF}") + +if (NETCDF_INCLUDES AND NETCDF_LIBRARIES) + # Already in cache, be silent + set (NETCDF_FIND_QUIETLY TRUE) +endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES) + +if(DEFINED ENV{NETCDF4}) + message("Enviroment NETCDF4 is ${NetCDF4}") + set(NETCDF_DIR $ENV{NETCDF4}) +elseif(DEFINED ENV{NETCDF_DIR}) + set(NETCDF_DIR $ENV{NETCDF_DIR}) +elseif(DEFINED ENV{NETCDF_HOME}) + set(NETCDF_DIR $ENV{NETCDF_HOME}) +elseif( DEFINED ENV{NETCDF} ) + set(NETCDF_DIR $ENV{NETCDF}) +elseif(DEFINED ENV{SSEC_NETCDF4_DIR}) + set(NETCDF_DIR $ENV{SSEC_NETCDF4_DIR}) +elseif(DEFINED ENV{SSEC_NETCDF_DIR}) + set(NETCDF_DIR $ENV{SSEC_NETCDF_DIR}) +endif() +if(DEFINED ENV{NETCDF_FORTRAN}) + set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN}) +elseif(DEFINED ENV{NETCDF_FORTRAN_DIR}) + set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN_DIR}) +endif() +find_path (NETCDF_INCLUDES netcdf.h + HINTS ${NETCDF_DIR}/include $ENV{SSEC_NETCDF_DIR}/include ) + +find_program (NETCDF_META netcdf_meta.h + HINTS ${NETCDF_INCLUDES} ${CMAKE_INSTALL_PREFIX} + ) +if (NETCDF_META) + file (STRINGS ${NETCDF_META} NETCDF_VERSION REGEX "define NC_VERSION_MAJOR") + string (REGEX REPLACE "#define NC_VERSION_MAJOR " "" NETCDF_VERSION ${NETCDF_VERSION}) + string (REGEX REPLACE "\\/\\*\\!< netcdf-c major version. \\*\\/" "" NETCDF_VERSION ${NETCDF_VERSION}) + string (REGEX REPLACE " " "" NETCDF_VERSION ${NETCDF_VERSION} ) + if(${NETCDF_VERSION} GREATER "3") + set(NETCDF_F90 "YES") + endif() +endif (NETCDF_META) + +find_library (NETCDF_flib + names libnetcdff.a netcdff.a libnetcdff.so netcdff.so + HINTS + ${NETCDF_DIR}/lib + ${NETCDF_FORTRAN_DIR}/lib + ${NETCDF_FORTRAN}/lib + ${NETCDF_FORTRAN_ROOT}/lib +) + +if (NETCDF_flib) + set(NETCDF_F90 "YES") + +endif() +find_library (NETCDF_LIBRARIES_C + NAMES netcdf + HINTS ${NETCDF_DIR}/lib ) +mark_as_advanced(NETCDF_LIBRARIES_C) + +if("${NETCDF_DIR}" STREQUAL "") + message(FATAL_ERROR " + Cannot find NETCDF!!!! + + ") +endif() +find_file (NETCDF_NCDUMP + NAMES ncdump + HINTS ${NETCDF_DIR}/bin ) +mark_as_advanced(NETCDF_NCDUMP) +execute_process(COMMAND ${NETCDF_NCDUMP} + ERROR_VARIABLE NCDUMP_INFO) +string(FIND "${NCDUMP_INFO}" "version" VERSION_LOC REVERSE) +math(EXPR VERSION_LOC "${VERSION_LOC} + 9") +string(SUBSTRING "${NCDUMP_INFO}" ${VERSION_LOC} 1 NETCDF_MAJOR_VERSION) +if (${NETCDF_MAJOR_VERSION} LESS 4) + message(FATAL_ERROR " + Current NETCDF is ${NETCDF_DIR} + !!!! NETCDF version 4.0 and above is required !!!! + + ") +endif() + +set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces +set (NetCDF_libs ${NETCDF_LIBRARIES_C} ${NETCDF_LIBRARIES_Fortran}) +message("netcdf_libs is ${NetCDF_libs}") +get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH) + +macro (NetCDF_check_interface lang header libs) + if (NETCDF_${lang}) + find_path (NETCDF_INCLUDES_${lang} NAMES ${header} + HINTS ${NETCDF_INCLUDES} ${NETCDF_FORTRAN}/include NO_DEFAULT_PATH) + find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs} + HINTS ${NetCDF_lib_dirs} ${NETCDF_FORTRAN}/lib NO_DEFAULT_PATH) + mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang}) + if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last + else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + set (NetCDF_has_interfaces "NO") + message (STATUS "Failed to find NetCDF interface for ${lang}") + endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + endif (NETCDF_${lang}) +endmacro (NetCDF_check_interface) + +NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) +NetCDF_check_interface (F77 netcdf.inc netcdff) +NetCDF_check_interface (F90 netcdf.mod netcdff) +if( NETCDF_LIBRARIES_F90 ) + set( NETCDF4 "YES" ) +endif() + +set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level") +# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces) + +mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES) diff --git a/cmake/Modules/FindSFCIO.cmake b/cmake/Modules/FindSFCIO.cmake new file mode 100644 index 0000000000..d8928bc210 --- /dev/null +++ b/cmake/Modules/FindSFCIO.cmake @@ -0,0 +1,71 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{SFCIO_VER}) + set(SFCIO_VER $ENV{SFCIO_VER}) + STRING(REGEX REPLACE "v" "" SFCIO_VER ${SFCIO_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_SFCIO ) + if(DEFINED ENV{SFCIO_LIB4} ) + set(SFCIO_LIBRARY $ENV{SFCIO_LIB4} ) + set(SFCIOINC $ENV{SFCIO_INC4} ) + message("SFCIO library ${SFCIO_LIBRARY} set via Environment variable") + else() + findInc( sfcio SFCIO_VER SFCIOINC ) + find_library( SFCIO_LIBRARY + NAMES libsfcio.a libsfcio_4.a libsfcio_i4r4.a libsfcio_v${SFCIO_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sfcio/v${SFCIO_VER} + ${COREPATH}/sfcio/v${SFCIO_VER}/intel + ${COREPATH}/sfcio/v${SFCIO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sfcio "sfcio_v${SFCIO_VER}") + message("Found SFCIO library ${SFCIO_LIBRARY}") + endif() +endif() +if( NOT SFCIO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find SFCIO library, so building from libsrc") + if( NOT DEFINED ENV{SFCIO_SRC} ) + findSrc( "sfcio" SFCIO_VER SFCIO_DIR ) + set(SFCIOINC "${CMAKE_BINARY_DIR}/include") + else() + set( SFCIO_DIR "$ENV{SFCIO_SRC}/libsrc" CACHE STRING "SFCIO Source Location") + set(SFCIOINC "${CORESFCIO}/sfcio/${SFCIO_VER}/incmod/sfcio_v${SFCIO_VER}") + endif() + set( libsuffix "_v${SFCIO_VER}${debug_suffix}" ) + set( SFCIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsfcio${libsuffix}.a" CACHE STRING "SFCIO Library" ) + set( sfcio "sfcio${libsuffix}") + set( BUILD_SFCIO "ON" CACHE INTERNAL "Build the SFCIO library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sfcio) + set( SFCIO_LIBRARY ${sfcio} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SFCIO_LIBRARY} ) + else() + set( CORE_BUILT ${SFCIO_LIBRARY} ) + endif() +else( NOT SFCIO_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${SFCIO_LIBRARY} ) + else() + set( CORE_LIBRARIES ${SFCIO_LIBRARY} ) + endif() +endif( NOT SFCIO_LIBRARY ) + +if( CORE_INCS ) + list( APPEND CORE_INCS ${SFCIOINC} ) +else() + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SFCIOINC} ) +endif() + +set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) +set( SFCIO_INCLUDE_PATH ${SFCIOINC} CACHE STRING "SFCIO Include Location" ) + diff --git a/cmake/Modules/FindSIGIO.cmake b/cmake/Modules/FindSIGIO.cmake new file mode 100644 index 0000000000..173328c45f --- /dev/null +++ b/cmake/Modules/FindSIGIO.cmake @@ -0,0 +1,72 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{SIGIO_VER}) + set(SIGIO_VER $ENV{SIGIO_VER}) + STRING(REGEX REPLACE "v" "" SIGIO_VER ${SIGIO_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_SIGIO ) + if(DEFINED ENV{SIGIO_LIB4} ) + set(SIGIO_LIBRARY $ENV{SIGIO_LIB4} ) + set(SIGIOINC $ENV{SIGIO_INC4} ) + message("SIGIO library ${SIGIO_LIBRARY} set via Environment variable") + else() + findInc( sigio SIGIO_VER SIGIOINC ) + find_library( SIGIO_LIBRARY + NAMES libsigio.a libsigio_4.a libsigio_i4r4.a libsigio_v${SIGIO_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sigio/v${SIGIO_VER} + ${COREPATH}/sigio/v${SIGIO_VER}/intel + ${COREPATH}/sigio/v${SIGIO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sigio "sigio_v${SIGIO_VER}") + message("Found SIGIO library ${SIGIO_LIBRARY}") + endif() +endif() +if( NOT SIGIO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find SIGIO library, so building from libsrc") + if( NOT DEFINED ENV{SIGIO_SRC} ) + findSrc( "sigio" SIGIO_VER SIGIO_DIR ) + set(SIGIOINC "${CMAKE_BINARY_DIR}/include") + else() + set( SIGIO_DIR "$ENV{SIGIO_SRC}/libsrc" CACHE STRING "SIGIO Source Location") + set(SIGIOINC "${CORESIGIO}/sigio/${SIGIO_VER}/incmod/sigio_v${SIGIO_VER}") + endif() + set( libsuffix "_v${SIGIO_VER}${debug_suffix}" ) + set( SIGIO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsigio${libsuffix}.a" CACHE STRING "SIGIO Library" ) + set( sigio "sigio${libsuffix}") + set( BUILD_SIGIO "ON" CACHE INTERNAL "Build the SIGIO library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sigio) + set( SIGIO_LIBRARY ${sigio} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SIGIO_LIBRARY} ) + else() + set( CORE_BUILT ${SIGIO_LIBRARY} ) + endif() +else( NOT SIGIO_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${SIGIO_LIBRARY} ) + else() + set( CORE_LIBRARIES ${SIGIO_LIBRARY} ) + endif() +endif( NOT SIGIO_LIBRARY ) + +if( CORE_INCS ) + list( APPEND CORE_INCS ${SIGIOINC} ) +else() + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${SIGIOINC} ) +endif() + + +set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) +set( SIGIO_INCLUDE_PATH ${SIGIOINC} CACHE STRING "SIGIO Include Location" ) + diff --git a/cmake/Modules/FindSP.cmake b/cmake/Modules/FindSP.cmake new file mode 100644 index 0000000000..b5fba97341 --- /dev/null +++ b/cmake/Modules/FindSP.cmake @@ -0,0 +1,83 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{SP_VER}) + set(SP_VER $ENV{SP_VER}) + STRING(REGEX REPLACE "v" "" SP_VER ${SP_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_SP ) + if(DEFINED ENV{SP_LIBd} ) + set(SP_LIBRARY $ENV{SP_LIBd} ) + message("SP library ${SP_LIBRARY} set via Environment variable") + else() + find_library( SP_LIBRARY + NAMES libsp_d.a libsp_i4r8.a libsp_v${SP_VER}_d.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sp/v${SP_VER} + ${COREPATH}/sp/v${SP_VER}/intel + ${COREPATH}/sp/v${SP_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sp "sp_v${SP_VER}_d") + message("Found SP library ${SP_LIBRARY}") + endif() + if(DEFINED ENV{SP_LIB4} ) + set(SP_4_LIBRARY $ENV{SP_LIB4} ) + message("SP library ${SP_4_LIBRARY} set via Environment variable") + else() + find_library( SP_4_LIBRARY + NAMES libsp_4.a libsp_i4r4.a libsp_v${SP_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/sp/v${SP_VER} + ${COREPATH}/sp/v${SP_VER}/intel + ${COREPATH}/sp/v${SP_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + set( sp "sp_v${SP_VER}_4") + message("Found SP_4 library ${SP_4_LIBRARY}") + endif() +endif() +if( NOT SP_LIBRARY ) # didn't find the library, so build it from source + message("Could not find SP library, so building from libsrc") + if( NOT DEFINED ENV{SP_SRC} ) + findSrc( "sp" SP_VER SP_DIR ) + else() + set( SP_DIR "$ENV{SP_SRC}/libsrc" CACHE STRING "SP Source Location") + endif() + set( libsuffix "_v${SP_VER}${debug_suffix}" ) + set( SP_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp${libsuffix}.a" CACHE STRING "SP Library" ) + set( SP_4_LIBRARY "${LIBRARY_OUTPUT_PATH}/libsp_4${libsuffix}.a" CACHE STRING "SP_4 Library" ) + set( sp "sp${libsuffix}") + set( sp4 "sp_4${libsuffix}") + set( BUILD_SP "ON" CACHE INTERNAL "Build the SP library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/sp) + set( SP_LIBRARY ${sp} ) + set( SP_4_LIBRARY ${sp4} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SP_LIBRARY} ) + else() + set( CORE_BUILT ${SP_LIBRARY} ) + endif() +else( NOT SP_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${SP_LIBRARY} ) + else() + set( CORE_LIBRARIES ${SP_LIBRARY} ) + endif() +endif( NOT SP_LIBRARY ) + + +set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) +set( SP_4_LIBRARY_PATH ${SP_4_LIBRARY} CACHE STRING "SP_4 Library Location" ) + diff --git a/cmake/Modules/FindW3EMC.cmake b/cmake/Modules/FindW3EMC.cmake new file mode 100644 index 0000000000..3cbce42a6d --- /dev/null +++ b/cmake/Modules/FindW3EMC.cmake @@ -0,0 +1,124 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{W3EMC_VER}) + set(W3EMC_VER $ENV{W3EMC_VER}) + set(W3EMCINC $ENV{W3EMC_INCd} ) + set(W3EMC4INC $ENV{W3EMC_INC4} ) + STRING(REGEX REPLACE "v" "" W3EMC_VER ${W3EMC_VER}) +endif() +if(DEFINED ENV{W3EMC_LIBd}) + set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} ) + set(W3EMCINC $ENV{W3EMC_INCd} ) + set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} ) + set(W3EMC4INC $ENV{W3EMC_INC4} ) + message("Setting W3EMC library via environment variable ${W3EMC_LIBRARY}") +endif() + +set( NO_DEFAULT_PATH ) +if((NOT BUILD_W3EMC ) AND ( NOT DEFINED W3EMC_LIBRARY )) + if(DEFINED ENV{W3EMC_LIB} ) + set(W3EMC_LIBRARY $ENV{W3EMC_LIB} ) + set(W3EMCINC $ENV{W3EMC_INC} ) + set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} ) + set(W3EMC4INC $ENV{W3EMC_INC4} ) + message("W3EMC library ${W3EMC_LIBRARY} set via Environment variable") + message("W3EMC_4 library ${W3EMC_4_LIBRARY} set via Environment variable") + else() + find_path( W3EMCINC + NAMES mersenne_twister.mod + HINTS + $ENV{COREPATH}/lib/incmod/w3emc_d + $ENV{COREPATH}/include + /usr/local/jcsda/nwprod_gdas_2014/lib/incmod/w3emc_d + ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_d + ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_d + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_d + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_d + ) + find_path( W3EMC4INC + NAMES mersenne_twister.mod + HINTS + $ENV{COREPATH}/lib/incmod/w3emc_4 + $ENV{COREPATH}/include + /usr/local/jcsda/nwprod_gdas_2014/lib/incmod/w3emc_4 + ${COREPATH}/w3emc/v${W3EMC_VER}/incmod/w3emc_v${W3EMC_VER}_4 + ${COREPATH}/w3emc/v${W3EMC_VER}/intel/w3emc_v${W3EMC_VER}_4 + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_4 + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION}/include/w3emc_v${W3EMC_VER}_4 + ) + find_library( W3EMC_LIBRARY + NAMES libw3emc_d.a libw3emc_v${W3EMC_VER}_d.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014 + ${COREPATH}/w3emc/v${W3EMC_VER} + ${COREPATH}/w3emc/v${W3EMC_VER}/intel + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + find_library( W3EMC_4_LIBRARY + NAMES libw3emc_4.a libw3emc_i4r4.a libw3emc_v${W3EMC_VER}_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014 + ${COREPATH}/w3emc/v${W3EMC_VER} + ${COREPATH}/w3emc/v${W3EMC_VER}/intel + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/impi/${COMPILER_VERSION} + ${COREPATH}/w3emc/v${W3EMC_VER}/ips/${COMPILER_VERSION}/smpi/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + message("Found W3EMC_4 library ${W3EMC_4_LIBRARY}") + endif() +endif() +if( NOT W3EMC_LIBRARY ) # didn't find the library, so build it from source + message("Could not find W3EMC library, so building from libsrc") + if( NOT DEFINED ENV{W3EMC_SRC} ) + findSrc( "w3emc" W3EMC_VER W3EMC_DIR ) + set(W3EMCINC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC Include Directory") + set(W3EMC4INC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC4 Include Directory") + else() + set( W3EMC_DIR "$ENV{W3EMC_SRC}/libsrc" CACHE STRING "W3EMC Source Location") + endif() + set( libsuffix "_v${W3EMC_VER}${debug_suffix}" ) + set( W3EMC_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3emc${libsuffix}.a" CACHE STRING "W3EMC Library" ) + set( w3emc "w3emc${libsuffix}") + set( w3emc4 "w3emc_4${libsuffix}") + set( BUILD_W3EMC "ON" CACHE INTERNAL "Build the W3EMC library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/w3emc) + set( W3EMC_LIBRARY ${w3emc} ) + set( W3EMC_4_LIBRARY ${w3emc} ) + set(W3EMCINC "${CMAKE_BINARY_DIR}/include" CACHE STRING "W3EMC Include Directory") + set(W3EMC4INC ${CMAKE_INCLUDE_4_OUTPUT_DIRECTORY} CACHE STRING "W3EMC4 Include Directory") + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${W3EMC_LIBRARY} ) + list( APPEND CORE_BUILT ${W3EMC_4_LIBRARY} ) + else() + set( CORE_BUILT ${W3EMC_LIBRARY} ) + set( CORE_BUILT ${W3EMC_4_LIBRARY} ) + endif() +else( NOT W3EMC_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${W3EMC_LIBRARY} ) + else() + set( CORE_LIBRARIES ${W3EMC_LIBRARY} ) + endif() +endif( NOT W3EMC_LIBRARY ) + +if( CORE_INCS ) + list( APPEND CORE_INCS ${W3EMCINC} ) +else() + set( CORE_INCS ${INCLUDE_OUTPUT_PATH} ${W3EMCINC} ) +endif() + +set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) +set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) +set( W3EMC_4_LIBRARY_PATH ${W3EMC_4_LIBRARY} CACHE STRING "W3EMC_4 Library Location" ) +set( W3EMC_INCLUDE_4_PATH ${W3EMC4INC} CACHE STRING "W3EMC_4 Include Location" ) + diff --git a/cmake/Modules/FindW3NCO.cmake b/cmake/Modules/FindW3NCO.cmake new file mode 100644 index 0000000000..aef2126c8f --- /dev/null +++ b/cmake/Modules/FindW3NCO.cmake @@ -0,0 +1,81 @@ +# This module defines +# CORE_INCS +# List of include file paths for all required modules for GSI +# CORE_LIBRARIES +# Full list of libraries required to link GSI executable +include(findHelpers) +if(DEFINED ENV{W3NCO_VER}) + set(W3NCO_VER $ENV{W3NCO_VER}) + STRING(REGEX REPLACE "v" "" W3NCO_VER ${W3NCO_VER}) +endif() + +set( NO_DEFAULT_PATH ) +if(NOT BUILD_W3NCO ) + if(DEFINED ENV{W3NCO_LIBd} ) + set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} ) + set(W3NCO_4_LIBRARY $ENV{W3NCO_LIB4} ) + message("W3NCO library ${W3NCO_LIBRARY} set via Environment variable") + message("W3NCO_4 library ${W3NCO_4_LIBRARY} set via Environment variable") + else() + find_library( W3NCO_LIBRARY + NAMES libw3nco_v${W3NCO_VER}_d.a libw3nco_d.a libw3nco_i4r8.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/w3nco/v${W3NCO_VER} + ${COREPATH}/w3nco/v${W3NCO_VER}/intel + ${COREPATH}/w3nco/v${W3NCO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + message("Found W3NCO library ${W3NCO_LIBRARY}") + set( w3nco ${W3NCO_LIBRARY}) + + find_library( W3NCO_4_LIBRARY + NAMES libw3nco_v${W3NCO_VER}_4.a libw3nco_4.a + HINTS + $ENV{COREPATH}/lib + /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/w3nco/v${W3NCO_VER} + ${COREPATH}/w3nco/v${W3NCO_VER}/intel + ${COREPATH}/w3nco/v${W3NCO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH}) + message("Found W3NCO_4 library ${W3NCO_4_LIBRARY}") + set( w3nco4 ${W3NCO_4_LIBRARY}) + endif() +endif() +if( NOT W3NCO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find W3NCO library, so building from libsrc") + if( NOT DEFINED ENV{W3NCO_SRC} ) + findSrc( "w3nco" W3NCO_VER W3NCO_DIR ) + else() + set( W3NCO_DIR "$ENV{W3NCO_SRC}/libsrc" CACHE STRING "W3NCO Source Location") + endif() + set( libsuffix "_v${W3NCO_VER}${debug_suffix}" ) + set( W3NCO_LIBRARY "${LIBRARY_OUTPUT_PATH}/libw3nco${libsuffix}.a" CACHE STRING "W3NCO Library" ) + set( w3nco "w3nco${libsuffix}") + set( w3nco4 "w3nco_4${libsuffix}") + set( BUILD_W3NCO "ON" CACHE INTERNAL "Build the W3NCO library") + add_subdirectory(${CMAKE_SOURCE_DIR}/libsrc/w3nco) + set( W3NCO_LIBRARY ${w3nco} ) + set( W3NCO_4_LIBRARY ${w3nco4} ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${W3NCO_LIBRARY} ) + list( APPEND CORE_BUILT ${W3NCO_4_LIBRARY} ) + else() + set( CORE_BUILT ${W3NCO_LIBRARY} ) + set( CORE_BUILT ${W3NCO_4_LIBRARY} ) + endif() +else( NOT W3NCO_LIBRARY ) + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${W3NCO_LIBRARY} ) + else() + set( CORE_LIBRARIES ${W3NCO_LIBRARY} ) + endif() +endif( NOT W3NCO_LIBRARY ) + +set( W3NCO_DIR ${CMAKE_SOURCE_DIR}/libsrc/w3nco CACHE STRING "W3NCO Source Location") +set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) + diff --git a/cmake/Modules/FindWRF.cmake b/cmake/Modules/FindWRF.cmake new file mode 100644 index 0000000000..43faf46643 --- /dev/null +++ b/cmake/Modules/FindWRF.cmake @@ -0,0 +1,36 @@ +# - Find the WRF modules + +set( NO_DEFAULT_PATH ) +find_library( IOINT_LIB + NAMES libwrfio_int.a + HINTS + ${WRFPATH}/external/io_int + $ENV{WRFPATH}/external/io_int + /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_int + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_int + ${NO_DEFAULT_PATH}) + +find_library( WRFNETCDF_LIB + NAMES libwrfio_nf.a + HINTS + ${WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf + $ENV{WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_netcdf + ${NO_DEFAULT_PATH}) +find_file( FRAMEPACK + NAMES pack_utils.o + HINTS + ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame + ${NO_DEFAULT_PATH}) +find_file( FRAMEMODULE + NAMES module_machine.o + HINTS + ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame + ${NO_DEFAULT_PATH}) + +set( WRF_LIBRARIES ${IOINT_LIB} ${WRFNETCDF_LIB} ${FRAMEPACK} ${FRAMEMODULE} ) + diff --git a/cmake/Modules/NewCMake/CMakeParseArguments.cmake b/cmake/Modules/NewCMake/CMakeParseArguments.cmake new file mode 100644 index 0000000000..7ee2bbacef --- /dev/null +++ b/cmake/Modules/NewCMake/CMakeParseArguments.cmake @@ -0,0 +1,11 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CMakeParseArguments +# ------------------- +# +# This module once implemented the :command:`cmake_parse_arguments` command +# that is now implemented natively by CMake. It is now an empty placeholder +# for compatibility with projects that include it to get the command from +# CMake 3.4 and lower. diff --git a/cmake/Modules/NewCMake/FindHDF5.cmake b/cmake/Modules/NewCMake/FindHDF5.cmake new file mode 100644 index 0000000000..fd8891cf20 --- /dev/null +++ b/cmake/Modules/NewCMake/FindHDF5.cmake @@ -0,0 +1,934 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindHDF5 +# -------- +# +# Find HDF5, a library for reading and writing self describing array data. +# +# +# +# This module invokes the HDF5 wrapper compiler that should be installed +# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper +# compiler is called either h5cc or h5pcc. If this succeeds, the module +# will then call the compiler with the -show argument to see what flags +# are used when compiling an HDF5 client application. +# +# The module will optionally accept the COMPONENTS argument. If no +# COMPONENTS are specified, then the find module will default to finding +# only the HDF5 C library. If one or more COMPONENTS are specified, the +# module will attempt to find the language bindings for the specified +# components. The only valid components are C, CXX, Fortran, HL, and +# Fortran_HL. If the COMPONENTS argument is not given, the module will +# attempt to find only the C bindings. +# +# This module will read the variable +# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a +# static link to a dynamic link for HDF5 and all of it's dependencies. +# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES +# variable is set before the call to find_package. +# +# To provide the module with a hint about where to find your HDF5 +# installation, you can set the environment variable HDF5_ROOT. The +# Find module will then look in this path when searching for HDF5 +# executables, paths, and libraries. +# +# Both the serial and parallel HDF5 wrappers are considered and the first +# directory to contain either one will be used. In the event that both appear +# in the same directory the serial version is preferentially selected. This +# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to +# true. +# +# In addition to finding the includes and libraries required to compile +# an HDF5 client application, this module also makes an effort to find +# tools that come with the HDF5 distribution that may be useful for +# regression testing. +# +# This module will define the following variables: +# +# :: +# +# HDF5_FOUND - true if HDF5 was found on the system +# HDF5_VERSION - HDF5 version in format Major.Minor.Release +# HDF5_INCLUDE_DIRS - Location of the hdf5 includes +# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) +# HDF5_DEFINITIONS - Required compiler definitions for HDF5 +# HDF5_LIBRARIES - Required libraries for all requested bindings +# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all +# bindings, if the HL component is enabled +# +# Available components are: C CXX Fortran and HL. For each enabled language +# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially +# HDF5_${LANG}_DEFINITIONS, will be defined. +# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will +# also be defined. With all components enabled, the following variables will be defined: +# +# :: +# +# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings +# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings +# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings +# HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings +# HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings +# HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings +# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings +# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings +# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings +# HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings +# HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings +# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran +# bindings. +# +# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support +# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler +# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler +# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler +# HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler +# which is also the HDF5 wrapper +# HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++ +# compiler which is also +# the HDF5 wrapper +# HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary +# Fortran compiler which +# is also the HDF5 wrapper +# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool +# +# The following variable can be set to guide the search for HDF5 libraries and includes: +# +# ``HDF5_ROOT`` +# Specify the path to the HDF5 installation to use. +# +# ``HDF5_FIND_DEBUG`` +# Set to a true value to get some extra debugging output. +# +# ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE`` +# Set to a true value to skip trying to find ``hdf5-config.cmake``. + +# This module is maintained by Will Dicharry . + +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# List of the valid HDF5 components +set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran) + +# Validate the list of find components. +if(NOT HDF5_FIND_COMPONENTS) + set(HDF5_LANGUAGE_BINDINGS "C") +else() + set(HDF5_LANGUAGE_BINDINGS) + # add the extra specified components, ensuring that they are valid. + set(FIND_HL OFF) + foreach(component IN LISTS HDF5_FIND_COMPONENTS) + list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location) + if(NOT component_location EQUAL -1) + list(APPEND HDF5_LANGUAGE_BINDINGS ${component}) + elseif(component STREQUAL "HL") + set(FIND_HL ON) + elseif(component STREQUAL "Fortran_HL") # only for compatibility + list(APPEND HDF5_LANGUAGE_BINDINGS Fortran) + set(FIND_HL ON) + set(HDF5_FIND_REQUIRED_Fortran_HL False) + set(HDF5_FIND_REQUIRED_Fortran True) + set(HDF5_FIND_REQUIRED_HL True) + else() + message(FATAL_ERROR "${component} is not a valid HDF5 component.") + endif() + endforeach() + if(NOT HDF5_LANGUAGE_BINDINGS) + get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) + foreach(__lang IN LISTS __langs) + if(__lang MATCHES "^(C|CXX|Fortran)$") + list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang}) + endif() + endforeach() + endif() + list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL + list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS) +endif() + +# Determine whether to search for serial or parallel executable first +if(HDF5_PREFER_PARALLEL) + set(HDF5_C_COMPILER_NAMES h5pcc h5cc) + set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++) + set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc) +else() + set(HDF5_C_COMPILER_NAMES h5cc h5pcc) + set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++) + set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) +endif() + +# We may have picked up some duplicates in various lists during the above +# process for the language bindings (both the C and C++ bindings depend on +# libz for example). Remove the duplicates. It appears that the default +# CMake behavior is to remove duplicates from the end of a list. However, +# for link lines, this is incorrect since unresolved symbols are searched +# for down the link line. Therefore, we reverse the list, remove the +# duplicates, and then reverse it again to get the duplicates removed from +# the beginning. +macro(_HDF5_remove_duplicates_from_beginning _list_name) + if(${_list_name}) + list(REVERSE ${_list_name}) + list(REMOVE_DUPLICATES ${_list_name}) + list(REVERSE ${_list_name}) + endif() +endmacro() + + +# Test first if the current compilers automatically wrap HDF5 + +function(_HDF5_test_regular_compiler_C success version is_parallel) + set(scratch_directory + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if(NOT ${success} OR + NOT EXISTS ${scratch_directory}/compiler_has_h5_c) + set(test_file ${scratch_directory}/cmake_hdf5_test.c) + file(WRITE ${test_file} + "#include \n" + "#include \n" + "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" + "#ifdef H5_HAVE_PARALLEL\n" + "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" + "#endif\n" + "int main(int argc, char **argv) {\n" + " int require = 0;\n" + " require += info_ver[argc];\n" + "#ifdef H5_HAVE_PARALLEL\n" + " require += info_parallel[argc];\n" + "#endif\n" + " hid_t fid;\n" + " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n" + " return 0;\n" + "}") + try_compile(${success} ${scratch_directory} ${test_file} + COPY_FILE ${scratch_directory}/compiler_has_h5_c + ) + endif() + if(${success}) + file(STRINGS ${scratch_directory}/compiler_has_h5_c INFO_STRINGS + REGEX "^INFO:" + ) + string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" + INFO_VER "${INFO_STRINGS}" + ) + set(${version} ${CMAKE_MATCH_1}) + if(CMAKE_MATCH_3) + set(${version} ${HDF5_C_VERSION}.${CMAKE_MATCH_3}) + endif() + set(${version} ${${version}} PARENT_SCOPE) + + if(INFO_STRINGS MATCHES "INFO:PARALLEL") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() +endfunction() + +function(_HDF5_test_regular_compiler_CXX success version is_parallel) + set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if(NOT ${success} OR + NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx) + set(test_file ${scratch_directory}/cmake_hdf5_test.cxx) + file(WRITE ${test_file} + "#include \n" + "#ifndef H5_NO_NAMESPACE\n" + "using namespace H5;\n" + "#endif\n" + "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" + "#ifdef H5_HAVE_PARALLEL\n" + "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" + "#endif\n" + "int main(int argc, char **argv) {\n" + " int require = 0;\n" + " require += info_ver[argc];\n" + "#ifdef H5_HAVE_PARALLEL\n" + " require += info_parallel[argc];\n" + "#endif\n" + " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n" + " return 0;\n" + "}") + try_compile(${success} ${scratch_directory} ${test_file} + COPY_FILE ${scratch_directory}/compiler_has_h5_cxx + ) + endif() + if(${success}) + file(STRINGS ${scratch_directory}/compiler_has_h5_cxx INFO_STRINGS + REGEX "^INFO:" + ) + string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" + INFO_VER "${INFO_STRINGS}" + ) + set(${version} ${CMAKE_MATCH_1}) + if(CMAKE_MATCH_3) + set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) + endif() + set(${version} ${${version}} PARENT_SCOPE) + + if(INFO_STRINGS MATCHES "INFO:PARALLEL") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() +endfunction() + +function(_HDF5_test_regular_compiler_Fortran success is_parallel) + if(NOT ${success}) + set(scratch_directory + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + set(test_file ${scratch_directory}/cmake_hdf5_test.f90) + file(WRITE ${test_file} + "program hdf5_hello\n" + " use hdf5\n" + " use h5lt\n" + " use h5ds\n" + " integer error\n" + " call h5open_f(error)\n" + " call h5close_f(error)\n" + "end\n") + try_compile(${success} ${scratch_directory} ${test_file}) + if(${success}) + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig + OUTPUT_VARIABLE config_output + ERROR_VARIABLE config_error + RESULT_VARIABLE config_result + ) + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() + endif() +endfunction() + +# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the +# return_value argument, the text output is stored to the output variable. +macro( _HDF5_invoke_compiler language output return_value version is_parallel) + set(${version}) + if(HDF5_USE_STATIC_LIBRARIES) + set(lib_type_args -noshlib) + else() + set(lib_type_args -shlib) + endif() + set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if("${language}" STREQUAL "C") + set(test_file ${scratch_dir}/cmake_hdf5_test.c) + elseif("${language}" STREQUAL "CXX") + set(test_file ${scratch_dir}/cmake_hdf5_test.cxx) + elseif("${language}" STREQUAL "Fortran") + set(test_file ${scratch_dir}/cmake_hdf5_test.f90) + endif() + exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} + ARGS -show ${lib_type_args} ${test_file} + OUTPUT_VARIABLE ${output} + RETURN_VALUE ${return_value} + ) + if(NOT ${${return_value}} EQUAL 0) + message(STATUS + "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") + endif() + exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} + ARGS -showconfig + OUTPUT_VARIABLE config_output + RETURN_VALUE config_return + ) + if(NOT ${return_value} EQUAL 0) + message( STATUS + "Unable to determine HDF5 ${language} version from HDF5 wrapper.") + endif() + string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}") + if(version_match) + string(REPLACE "HDF5 Version: " "" ${version} "${version_match}") + string(REPLACE "-patch" "." ${version} "${${version}}") + endif() + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE) + else() + set(${is_parallel} FALSE) + endif() +endmacro() + +# Parse a compile line for definitions, includes, library paths, and libraries. +macro( _HDF5_parse_compile_line + compile_line_var + include_paths + definitions + library_paths + libraries + libraries_hl) + + separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}") + + foreach(arg IN LISTS _HDF5_COMPILE_ARGS) + if("${arg}" MATCHES "^-I(.*)$") + # include directory + list(APPEND ${include_paths} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-D(.*)$") + # compile definition + list(APPEND ${definitions} "-D${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-L(.*)$") + # library search path + list(APPEND ${library_paths} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$") + # library name (hl) + list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(.*)$") + # library name + list(APPEND ${libraries} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$") + # library file + if(NOT EXISTS "${arg}") + continue() + endif() + get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY) + get_filename_component(_HDF5_LNAME "${arg}" NAME_WE) + string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}") + list(APPEND ${library_paths} "${_HDF5_LPATH}") + if(_HDF5_LNAME MATCHES "hdf5.*hl") + list(APPEND ${libraries_hl} "${_HDF5_LNAME}") + else() + list(APPEND ${libraries} "${_HDF5_LNAME}") + endif() + endif() + endforeach() +endmacro() + +# Select a preferred imported configuration from a target +function(_HDF5_select_imported_config target imported_conf) + # We will first assign the value to a local variable _imported_conf, then assign + # it to the function argument at the end. + get_target_property(_imported_conf ${target} MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE}) + if (NOT _imported_conf) + # Get available imported configurations by examining target properties + get_target_property(_imported_conf ${target} IMPORTED_CONFIGURATIONS) + if(HDF5_FIND_DEBUG) + message(STATUS "Found imported configurations: ${_imported_conf}") + endif() + # Find the imported configuration that we prefer. + # We do this by making list of configurations in order of preference, + # starting with ${CMAKE_BUILD_TYPE} and ending with the first imported_conf + set(_preferred_confs ${CMAKE_BUILD_TYPE}) + list(GET _imported_conf 0 _fallback_conf) + list(APPEND _preferred_confs RELWITHDEBINFO RELEASE DEBUG ${_fallback_conf}) + if(HDF5_FIND_DEBUG) + message(STATUS "Start search through imported configurations in the following order: ${_preferred_confs}") + endif() + # Now find the first of these that is present in imported_conf + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) # support IN_LISTS + foreach (_conf IN LISTS _preferred_confs) + if (${_conf} IN_LIST _imported_conf) + set(_imported_conf ${_conf}) + break() + endif() + endforeach() + cmake_policy(POP) + endif() + if(HDF5_FIND_DEBUG) + message(STATUS "Selected imported configuration: ${_imported_conf}") + endif() + # assign value to function argument + set(${imported_conf} ${_imported_conf} PARENT_SCOPE) +endfunction() + + +if(NOT HDF5_ROOT) + set(HDF5_ROOT $ENV{HDF5_ROOT}) +endif() +if(HDF5_ROOT) + set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH) +else() + set(_HDF5_SEARCH_OPTS) +endif() + +# Try to find HDF5 using an installed hdf5-config.cmake +if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE) + find_package(HDF5 QUIET NO_MODULE + HINTS ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS} + ) + if( HDF5_FOUND) + if(HDF5_FIND_DEBUG) + message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.") + endif() + set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL}) + set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) + set(HDF5_LIBRARIES) + if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared) + # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc + set(_target_prefix "hdf5::") + endif() + set(HDF5_C_TARGET ${_target_prefix}hdf5) + set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl) + set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp) + set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp) + set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran) + set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran) + set(HDF5_DEFINITIONS "") + if(HDF5_USE_STATIC_LIBRARIES) + set(_suffix "-static") + else() + set(_suffix "-shared") + endif() + foreach(_lang ${HDF5_LANGUAGE_BINDINGS}) + + #Older versions of hdf5 don't have a static/shared suffix so + #if we detect that occurrence clear the suffix + if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix}) + if(NOT TARGET ${HDF5_${_lang}_TARGET}) + #cant find this component with or without the suffix + #so bail out, and let the following locate HDF5 + set(HDF5_FOUND FALSE) + break() + endif() + set(_suffix "") + endif() + + if(HDF5_FIND_DEBUG) + message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}") + endif() + # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib. + _HDF5_select_imported_config(${HDF5_${_lang}_TARGET}${_suffix} _hdf5_imported_conf) + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) + if (NOT _hdf5_lang_location) + # no import lib, just try LOCATION + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) + if (NOT _hdf5_lang_location) + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION) + endif() + endif() + if( _hdf5_lang_location ) + set(HDF5_${_lang}_LIBRARY ${_hdf5_lang_location}) + list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) + set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) + set(HDF5_${_lang}_FOUND True) + endif() + if(FIND_HL) + get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) + if (NOT _hdf5_lang_hl_location) + get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) + if (NOT _hdf5_hl_lang_location) + get_target_property(_hdf5_hl_lang_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION) + endif() + endif() + if( _hdf5_lang_hl_location ) + set(HDF5_${_lang}_HL_LIBRARY ${_hdf5_lang_hl_location}) + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) + set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) + set(HDF5_HL_FOUND True) + endif() + unset(_hdf5_lang_hl_location) + endif() + unset(_hdf5_imported_conf) + unset(_hdf5_lang_location) + endforeach() + endif() +endif() + +if(NOT HDF5_FOUND) + set(_HDF5_NEED_TO_SEARCH False) + set(HDF5_COMPILER_NO_INTERROGATE True) + # Only search for languages we've enabled + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + # First check to see if our regular compiler is one of wrappers + if(__lang STREQUAL "C") + _HDF5_test_regular_compiler_C( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) + elseif(__lang STREQUAL "CXX") + _HDF5_test_regular_compiler_CXX( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) + elseif(__lang STREQUAL "Fortran") + _HDF5_test_regular_compiler_Fortran( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_IS_PARALLEL) + else() + continue() + endif() + if(HDF5_${__lang}_COMPILER_NO_INTERROGATE) + message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling") + set(HDF5_${__lang}_FOUND True) + set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE + "${CMAKE_${__lang}_COMPILER}" + CACHE FILEPATH "HDF5 ${__lang} compiler wrapper") + set(HDF5_${__lang}_DEFINITIONS) + set(HDF5_${__lang}_INCLUDE_DIRS) + set(HDF5_${__lang}_LIBRARIES) + set(HDF5_${__lang}_HL_LIBRARIES) + + mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE) + + set(HDF5_${__lang}_FOUND True) + set(HDF5_HL_FOUND True) + else() + set(HDF5_COMPILER_NO_INTERROGATE False) + # If this language isn't using the wrapper, then try to seed the + # search options with the wrapper + find_program(HDF5_${__lang}_COMPILER_EXECUTABLE + NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR + HINTS ${HDF5_ROOT} + PATH_SUFFIXES bin Bin + DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags." + ${_HDF5_SEARCH_OPTS} + ) + mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE ) + unset(HDF5_${__lang}_COMPILER_NAMES) + + if(HDF5_${__lang}_COMPILER_EXECUTABLE) + _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE + HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL) + if(HDF5_${__lang}_RETURN_VALUE EQUAL 0) + message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration") + _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE + HDF5_${__lang}_INCLUDE_DIRS + HDF5_${__lang}_DEFINITIONS + HDF5_${__lang}_LIBRARY_DIRS + HDF5_${__lang}_LIBRARY_NAMES + HDF5_${__lang}_HL_LIBRARY_NAMES + ) + set(HDF5_${__lang}_LIBRARIES) + + foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) + if("x${L}" MATCHES "hdf5") + # hdf5 library + set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(HDF5_USE_STATIC_LIBRARIES) + if(WIN32) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) + else() + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() + endif() + else() + # external library + set(_HDF5_SEARCH_OPTS_LOCAL) + endif() + find_library(HDF5_${__lang}_LIBRARY_${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR + HINTS ${HDF5_${__lang}_LIBRARY_DIRS} + ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS_LOCAL} + ) + unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) + if(HDF5_${__lang}_LIBRARY_${L}) + list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) + else() + list(APPEND HDF5_${__lang}_LIBRARIES ${L}) + endif() + endforeach() + if(FIND_HL) + set(HDF5_${__lang}_HL_LIBRARIES) + foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) + if("x${L}" MATCHES "hdf5") + # hdf5 library + set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(HDF5_USE_STATIC_LIBRARIES) + if(WIN32) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) + else() + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() + endif() + else() + # external library + set(_HDF5_SEARCH_OPTS_LOCAL) + endif() + find_library(HDF5_${__lang}_LIBRARY_${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR + HINTS ${HDF5_${__lang}_LIBRARY_DIRS} + ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS_LOCAL} + ) + unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) + if(HDF5_${__lang}_LIBRARY_${L}) + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) + else() + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L}) + endif() + endforeach() + set(HDF5_HL_FOUND True) + endif() + + set(HDF5_${__lang}_FOUND True) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES) + else() + set(_HDF5_NEED_TO_SEARCH True) + endif() + else() + set(_HDF5_NEED_TO_SEARCH True) + endif() + endif() + if(HDF5_${__lang}_VERSION) + if(NOT HDF5_VERSION) + set(HDF5_VERSION ${HDF5_${__lang}_VERSION}) + elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION) + message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}") + endif() + endif() + if(DEFINED HDF5_${__lang}_IS_PARALLEL) + if(NOT DEFINED HDF5_IS_PARALLEL) + set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL}) + elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.") + elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.") + endif() + endif() + endforeach() +else() + set(_HDF5_NEED_TO_SEARCH True) +endif() + +if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE) + # No arguments necessary, all languages can use the compiler wrappers + set(HDF5_FOUND True) + set(HDF5_METHOD "Included by compiler wrappers") + set(HDF5_REQUIRED_VARS HDF5_METHOD) +elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH) + # Compiler wrappers aren't being used by the build but were found and used + # to determine necessary include and library flags + set(HDF5_INCLUDE_DIRS) + set(HDF5_LIBRARIES) + set(HDF5_HL_LIBRARIES) + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + if(HDF5_${__lang}_FOUND) + if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE) + list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS}) + list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS}) + list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) + if(FIND_HL) + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) + endif() + endif() + endif() + endforeach() + _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) + set(HDF5_FOUND True) + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES) + if(FIND_HL) + list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) + endif() +endif() + +find_program( HDF5_DIFF_EXECUTABLE + NAMES h5diff + HINTS ${HDF5_ROOT} + PATH_SUFFIXES bin Bin + ${_HDF5_SEARCH_OPTS} + DOC "HDF5 file differencing tool." ) +mark_as_advanced( HDF5_DIFF_EXECUTABLE ) + +if( NOT HDF5_FOUND ) + # seed the initial lists of libraries to find with items we know we need + set(HDF5_C_LIBRARY_NAMES hdf5) + set(HDF5_C_HL_LIBRARY_NAMES hdf5_hl) + + set(HDF5_CXX_LIBRARY_NAMES hdf5_cpp ${HDF5_C_LIBRARY_NAMES}) + set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES}) + + set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES}) + set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES}) + + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + # find the HDF5 include directories + if("${__lang}" STREQUAL "Fortran") + set(HDF5_INCLUDE_FILENAME hdf5.mod) + elseif("${__lang}" STREQUAL "CXX") + set(HDF5_INCLUDE_FILENAME H5Cpp.h) + else() + set(HDF5_INCLUDE_FILENAME hdf5.h) + endif() + + find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} + HINTS ${HDF5_ROOT} + PATHS $ENV{HOME}/.local/include + PATH_SUFFIXES include Include + ${_HDF5_SEARCH_OPTS} + ) + mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR) + # set the _DIRS variable as this is what the user will normally use + set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) + list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) + + # find the HDF5 libraries + foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES) + if(HDF5_USE_STATIC_LIBRARIES) + # According to bug 1643 on the CMake bug tracker, this is the + # preferred method for searching for a static library. + # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search + # first for the full static library name, but fall back to a + # generic search on the name if the static search fails. + set( THIS_LIBRARY_SEARCH_DEBUG + lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug + lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_D-static ${LIB}_debug-static ) + set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a ${LIB}-static) + else() + set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) + set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) + if(WIN32) + list(APPEND HDF5_DEFINITIONS "-DH5_BUILT_AS_DYNAMIC_LIB") + endif() + endif() + find_library(HDF5_${LIB}_LIBRARY_DEBUG + NAMES ${THIS_LIBRARY_SEARCH_DEBUG} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + find_library( HDF5_${LIB}_LIBRARY_RELEASE + NAMES ${THIS_LIBRARY_SEARCH_RELEASE} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + select_library_configurations( HDF5_${LIB} ) + list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) + endforeach() + if(HDF5_${__lang}_LIBRARIES) + set(HDF5_${__lang}_FOUND True) + endif() + + # Append the libraries for this language binding to the list of all + # required libraries. + list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) + + if(FIND_HL) + foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) + if(HDF5_USE_STATIC_LIBRARIES) + # According to bug 1643 on the CMake bug tracker, this is the + # preferred method for searching for a static library. + # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search + # first for the full static library name, but fall back to a + # generic search on the name if the static search fails. + set( THIS_LIBRARY_SEARCH_DEBUG + lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug + lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static ) + set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static) + else() + set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) + set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) + endif() + find_library(HDF5_${LIB}_LIBRARY_DEBUG + NAMES ${THIS_LIBRARY_SEARCH_DEBUG} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + find_library( HDF5_${LIB}_LIBRARY_RELEASE + NAMES ${THIS_LIBRARY_SEARCH_RELEASE} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + select_library_configurations( HDF5_${LIB} ) + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY}) + endforeach() + + # Append the libraries for this language binding to the list of all + # required libraries. + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) + endif() + endforeach() + if(FIND_HL AND HDF5_HL_LIBRARIES) + set(HDF5_HL_FOUND True) + endif() + + _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) + + # If the HDF5 include directory was found, open H5pubconf.h to determine if + # HDF5 was compiled with parallel IO support + set( HDF5_IS_PARALLEL FALSE ) + set( HDF5_VERSION "" ) + foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) + foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h") + if( EXISTS "${_hdr}" ) + file( STRINGS "${_hdr}" + HDF5_HAVE_PARALLEL_DEFINE + REGEX "HAVE_PARALLEL 1" ) + if( HDF5_HAVE_PARALLEL_DEFINE ) + set( HDF5_IS_PARALLEL TRUE ) + endif() + unset(HDF5_HAVE_PARALLEL_DEFINE) + + file( STRINGS "${_hdr}" + HDF5_VERSION_DEFINE + REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" ) + if( "${HDF5_VERSION_DEFINE}" MATCHES + "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?\"" ) + set( HDF5_VERSION "${CMAKE_MATCH_1}" ) + if( CMAKE_MATCH_3 ) + set( HDF5_VERSION ${HDF5_VERSION}.${CMAKE_MATCH_3}) + endif() + endif() + unset(HDF5_VERSION_DEFINE) + endif() + endforeach() + endforeach() + set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL + "HDF5 library compiled with parallel IO support" ) + mark_as_advanced( HDF5_IS_PARALLEL ) + + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) + if(FIND_HL) + list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) + endif() +endif() + +# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of +# HDF5_INCLUDE_DIRS +if( HDF5_INCLUDE_DIRS ) + set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) +endif() + +# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that +# something external is trying to explicitly pass already found +# locations +if(NOT HDF5_REQUIRED_VARS) + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) +endif() + +find_package_handle_standard_args(HDF5 + REQUIRED_VARS ${HDF5_REQUIRED_VARS} + VERSION_VAR HDF5_VERSION + HANDLE_COMPONENTS +) + +unset(_HDF5_SEARCH_OPTS) + +if( HDF5_FOUND AND NOT HDF5_DIR) + # hide HDF5_DIR for the non-advanced user to avoid confusion with + # HDF5_DIR-NOT_FOUND while HDF5 was found. + mark_as_advanced(HDF5_DIR) +endif() + +if (HDF5_FIND_DEBUG) + message(STATUS "HDF5_DIR: ${HDF5_DIR}") + message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}") + message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}") + message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}") + message(STATUS "HDF5_HL_LIBRARIES: ${HDF5_HL_LIBRARIES}") + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}") + message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}") + message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}") + message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}") + message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}") + message(STATUS "HDF5_${__lang}_HL_LIBRARY: ${HDF5_${__lang}_HL_LIBRARY}") + message(STATUS "HDF5_${__lang}_HL_LIBRARIES: ${HDF5_${__lang}_HL_LIBRARIES}") + endforeach() +endif() diff --git a/cmake/Modules/NewCMake/FindMPI.cmake b/cmake/Modules/NewCMake/FindMPI.cmake new file mode 100644 index 0000000000..5cd2a2afe7 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI.cmake @@ -0,0 +1,1514 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindMPI +# ------- +# +# Find a Message Passing Interface (MPI) implementation. +# +# The Message Passing Interface (MPI) is a library used to write +# high-performance distributed-memory parallel applications, and is +# typically deployed on a cluster. MPI is a standard interface (defined +# by the MPI forum) for which many implementations are available. +# +# Variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``. +# Each of these controls the various MPI languages to search for. +# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the +# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API +# that was removed again in MPI-3. +# +# Depending on the enabled components the following variables will be set: +# +# ``MPI_FOUND`` +# Variable indicating that MPI settings for all requested languages have been found. +# If no components are specified, this is true if MPI settings for all enabled languages +# were detected. Note that the ``MPICXX`` component does not affect this variable. +# ``MPI_VERSION`` +# Minimal version of MPI detected among the requested languages, or all enabled languages +# if no components were specified. +# +# This module will set the following variables per language in your +# project, where ```` is one of C, CXX, or Fortran: +# +# ``MPI__FOUND`` +# Variable indicating the MPI settings for ```` were found and that +# simple MPI test programs compile with the provided settings. +# ``MPI__COMPILER`` +# MPI compiler for ```` if such a program exists. +# ``MPI__COMPILE_OPTIONS`` +# Compilation options for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__COMPILE_DEFINITIONS`` +# Compilation definitions for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__INCLUDE_DIRS`` +# Include path(s) for MPI header. +# ``MPI__LINK_FLAGS`` +# Linker flags for MPI programs. +# ``MPI__LIBRARIES`` +# All libraries to link MPI programs against. +# +# Additionally, the following :prop_tgt:`IMPORTED` targets are defined: +# +# ``MPI::MPI_`` +# Target for using MPI from ````. +# +# The following variables indicating which bindings are present will be defined: +# +# ``MPI_MPICXX_FOUND`` +# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3). +# ``MPI_Fortran_HAVE_F77_HEADER`` +# True if the Fortran 77 header ``mpif.h`` is available. +# ``MPI_Fortran_HAVE_F90_MODULE`` +# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only). +# ``MPI_Fortran_HAVE_F08_MODULE`` +# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only). +# +# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version +# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions. +# +# ``MPI__VERSION_MAJOR`` +# Major version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION_MINOR`` +# Minor version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION`` +# MPI version implemented for ```` by the MPI distribution. +# +# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards +# always have required this binding to work in both C and C++ code. +# +# For running MPI programs, the module sets the following variables +# +# ``MPIEXEC_EXECUTABLE`` +# Executable for running MPI programs, if such exists. +# ``MPIEXEC_NUMPROC_FLAG`` +# Flag to pass to ``mpiexec`` before giving it the number of processors to run on. +# ``MPIEXEC_MAX_NUMPROCS`` +# Number of MPI processors to utilize. Defaults to the number +# of processors detected on the host system. +# ``MPIEXEC_PREFLAGS`` +# Flags to pass to ``mpiexec`` directly before the executable to run. +# ``MPIEXEC_POSTFLAGS`` +# Flags to pass to ``mpiexec`` after other flags. +# +# Variables for locating MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# This module performs a three step search for an MPI implementation: +# +# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a +# compiler wrapper as ``CMAKE__COMPILER`` or if they're on a Cray system. +# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. +# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. +# Currently, only Microsoft MPI and MPICH2 on Windows are supported. +# +# For controlling the second step, the following variables may be set: +# +# ``MPI__COMPILER`` +# Search for the specified compiler wrapper and use it. +# ``MPI__COMPILER_FLAGS`` +# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers +# support linking debug or tracing libraries if a specific flag is passed and this variable +# may be used to obtain them. +# ``MPI_COMPILER_FLAGS`` +# Used to initialize ``MPI__COMPILER_FLAGS`` if no language specific flag has been given. +# Empty by default. +# ``MPI_EXECUTABLE_SUFFIX`` +# A suffix which is appended to all names that are being looked for. For instance you may set this +# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives. +# +# In order to control the guessing step, the following variable may be set: +# +# ``MPI_GUESS_LIBRARY_NAME`` +# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for. +# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available. +# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden. +# +# Each of the search steps may be skipped with the following control variables: +# +# ``MPI_ASSUME_NO_BUILTIN_MPI`` +# If true, the module assumes that the compiler itself does not provide an MPI implementation and +# skips to step 2. +# ``MPI_SKIP_COMPILER_WRAPPER`` +# If true, no compiler wrapper will be searched for. +# ``MPI_SKIP_GUESSING`` +# If true, the guessing step will be skipped. +# +# Additionally, the following control variable is available to change search behavior: +# +# ``MPI_CXX_SKIP_MPICXX`` +# Add some definitions that will disable the MPI-2 C++ bindings. +# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, +# for example MVAPICH or Intel MPI. +# +# If the find procedure fails for a variable ``MPI__WORKS``, then the settings detected by or passed to +# the module did not work and even a simple MPI test program failed to compile. +# +# If all of these parameters were not sufficient to find the right MPI implementation, a user may +# disable the entire autodetection process by specifying both a list of libraries in ``MPI__LIBRARIES`` +# and a list of include directories in ``MPI__ADDITIONAL_INCLUDE_DIRS``. +# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the +# settings in the cache. +# +# Cache variables for MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The variable ``MPI__INCLUDE_DIRS`` will be assembled from the following variables. +# For C and CXX: +# +# ``MPI__HEADER_DIR`` +# Location of the ``mpi.h`` header on disk. +# +# For Fortran: +# +# ``MPI_Fortran_F77_HEADER_DIR`` +# Location of the Fortran 77 header ``mpif.h``, if it exists. +# ``MPI_Fortran_MODULE_DIR`` +# Location of the ``mpi`` or ``mpi_f08`` modules, if available. +# +# For all languages the following variables are additionally considered: +# +# ``MPI__ADDITIONAL_INCLUDE_DIRS`` +# A :ref:`;-list ` of paths needed in addition to the normal include directories. +# ``MPI__INCLUDE_DIR`` +# Path variables for include folders referred to by ````. +# ``MPI__ADDITIONAL_INCLUDE_VARS`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# The variable ``MPI__LIBRARIES`` will be assembled from the following variables: +# +# ``MPI__LIBRARY`` +# The location of a library called ```` for use with MPI. +# ``MPI__LIB_NAMES`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# Usage of mpiexec +# ^^^^^^^^^^^^^^^^ +# +# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically +# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows: +# +# :: +# +# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} +# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS +# +# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to +# pass to the MPI program. +# +# Advanced variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module can perform some advanced feature detections upon explicit request. +# +# **Important notice:** The following checks cannot be performed without *executing* an MPI test program. +# Consider the special considerations for the behavior of :command:`try_run` during cross compilation. +# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. +# You should only enable these detections if you absolutely need the information. +# +# If the following variables are set to true, the respective search will be performed: +# +# ``MPI_DETERMINE_Fortran_CAPABILITIES`` +# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and +# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran__SUBARRAYS`` +# and ``MPI_Fortran__ASYNCPROT``, where ```` is one of ``F77_HEADER``, ``F90_MODULE`` and +# ``F08_MODULE``. +# ``MPI_DETERMINE_LIBRARY_VERSION`` +# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI__LIBRARY_VERSION``. +# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ````. +# Note that the return value is entirely implementation defined. This information might be used to identify +# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor. +# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ +# +# For backward compatibility with older versions of FindMPI, these +# variables are set, but deprecated: +# +# :: +# +# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY +# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS +# MPI_LIBRARIES +# +# In new projects, please use the ``MPI__XXX`` equivalents. +# Additionally, the following variables are deprecated: +# +# ``MPI__COMPILE_FLAGS`` +# Use ``MPI__COMPILE_OPTIONS`` and ``MPI__COMPILE_DEFINITIONS`` instead. +# ``MPI__INCLUDE_PATH`` +# For consumption use ``MPI__INCLUDE_DIRS`` and for specifying folders use ``MPI__ADDITIONAL_INCLUDE_DIRS`` instead. +# ``MPIEXEC`` +# Use ``MPIEXEC_EXECUTABLE`` instead. + +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# Generic compiler names +set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) +set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ + mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) +set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r + mpif90 mpif90_r mpf90 mpf90_r + mpif77 mpif77_r mpf77 mpf77_r + mpifc) + +# GNU compiler names +set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) +set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) +set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r + mpig77 mpig77_r mpg77 mpg77_r) + +# Intel MPI compiler names on Windows +if(WIN32) + list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat) + list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat) + list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat) + + # Intel MPI compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat) + + # Intel MPI compiler names for MSMPI + set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat) + set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat) +else() + # Intel compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) +endif() + +# PGI compiler names +set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) +set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) +set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) + +# XLC MPI Compiler names +set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) +set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC + mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) +set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r + mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r + mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r + mpixlf mpixlf_r mpxlf mpxlf_r) + +# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, +# attempt all of them. +# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper +# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI +# controls its settings via the I_MPI_CC environment variables if the generic name is being used. +# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to +# pick up the right settings for it. +foreach (LANG IN ITEMS C CXX Fortran) + set(_MPI_${LANG}_COMPILER_NAMES "") + foreach (id IN ITEMS GNU Intel MSVC PGI XL) + if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + endif() + unset(_MPI_${id}_${LANG}_COMPILER_NAMES) + endforeach() + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) +endforeach() + +# Names to try for mpiexec +# Only mpiexec commands are guaranteed to behave as described in the standard, +# mpirun commands are not covered by the standard in any way whatsoever. +# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. +# srun -n X is however a valid command, so it behaves 'like' mpiexec. +set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) + +unset(_MPIEXEC_NAMES) +foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) + list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") +endforeach() +unset(_MPIEXEC_NAMES_BASE) + +function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) + if(DEFINED MPI_${LANG}_COMPILER_FLAGS) +# separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS "${MPI_${LANG}_COMPILER_FLAGS}") + else() + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") + endif() + execute_process( + COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} + OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE WRAPPER_RETURN) + # Some compiler wrappers will yield spurious zero return values, for example + # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared + # library that has invalid or missing version information there would be warning + # messages emitted by ld.so in the compiler output. In either case, we'll treat + # the output as invalid. + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + set(WRAPPER_RETURN 255) + endif() + # Ensure that no error output might be passed upwards. + if(NOT WRAPPER_RETURN EQUAL 0) + unset(WRAPPER_OUTPUT) + endif() + set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) + set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) +endfunction() + +function (_MPI_interrogate_compiler lang) + unset(MPI_COMPILE_CMDLINE) + unset(MPI_LINK_CMDLINE) + + unset(MPI_COMPILE_OPTIONS_WORK) + unset(MPI_COMPILE_DEFINITIONS_WORK) + unset(MPI_INCLUDE_DIRS_WORK) + unset(MPI_LINK_FLAGS_WORK) + unset(MPI_LIB_NAMES_WORK) + unset(MPI_LIB_FULLPATHS_WORK) + + # Check whether the -showme:compile option works. This indicates that we have either Open MPI + # or a newer version of LAM/MPI, and implies that -showme:link will also work. + # Open MPI also supports -show, but separates linker and compiler information + _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + + # MPICH and MVAPICH offer -compile-info and -link-info. + # For modern versions, both do the same as -show. However, for old versions, they do differ + # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the + # removed MPI C++ bindings. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + endif() + + # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the + # -showme commands are more specialized. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + # Older versions of LAM/MPI have "-showme". Open MPI also supports this. + # Unknown to MPICH, MVAPICH and Intel MPI. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) + # Cannot interrogate this compiler, so exit. + set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) + return() + endif() + unset(MPI_COMPILER_RETURN) + + # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE + # into MPI_LINK_CMDLINE, if we didn't find the link line. + if (NOT DEFINED MPI_LINK_CMDLINE) + set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") + endif() + + # At this point, we obtained some output from a compiler wrapper that works. + # We'll now try to parse it into variables with meaning to us. + if("${LANG}" STREQUAL "Fortran") + # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting + # out of a symlink command for mpif.h, the actual compiler command and a deletion of the + # created symlink. We need to detect that case, remember the include path and drop the + # symlink/deletion operation to obtain the link/compile lines we'd usually expect. + if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") + get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + endif() + + # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command + # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. + if(UNIX) + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + + # Extract compile options from the compile command line. + string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) + string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") + # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries + # themselves were built with this flag. However, this flag is unrelated to using MPI, and + # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore + # produce inconsistent results with the regularly flags. + # Similarly, aliasing flags do not belong into our flag array. + if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") + list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") + endif() + endforeach() + + # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. + string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) + string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") + endif() + endforeach() + + # Extract include paths from compile command line + string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:incdirs. + if (NOT MPI_ALL_INCLUDE_PATHS) + _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) + if(MPI_INCDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) + string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) + list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") + endforeach() + + # Extract linker paths from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:libdirs. + if (NOT MPI_ALL_LINK_PATHS) + _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) + if(MPI_LIBDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) + string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") + string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") + get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") + endforeach() + + # Extract linker flags from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) + string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) + # MPI might be marked to build with non-executable stacks but this should not propagate. + if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") + if (MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") + else() + set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") + endif() + endif() + endforeach() + + # Extract the set of libraries to link against from the link command + # line + string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + + if(WIN32) + # A compiler wrapper on Windows will just have the name of the + # library to link on its link line, potentially with a full path + string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + else() + # On UNIX platforms, archive libraries can be given with full path. + string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + endif() + + # An MPI compiler wrapper could have its MPI libraries in the implictly + # linked directories of the compiler itself. + if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") + endif() + + # Determine full path names for all of the libraries that one needs + # to link against in an MPI program + unset(MPI_PLAIN_LIB_NAMES_WORK) + foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${MPI_LINK_DIRECTORIES_WORK} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + + # Deal with the libraries given with full path next + unset(MPI_DIRECT_LIB_NAMES_WORK) + foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) + list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_PATH} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + if(MPI_DIRECT_LIB_NAMES_WORK) + set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") + endif() + + # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to + # link it in that case. -lpthread is covered by the normal library treatment on the other hand. + if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") + list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") + if(MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " -pthread") + else() + set(MPI_LINK_FLAGS_WORK "-pthread") + endif() + endif() + + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + + # If we found MPI, set up all of the appropriate cache entries + if(NOT MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) + endif() + if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) + endif() + if(NOT MPI_${LANG}_LINK_FLAGS) + set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) + endif() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) +endfunction() + +function(_MPI_guess_settings LANG) + set(MPI_GUESS_FOUND FALSE) + # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. + if(WIN32) + # MSMPI + + # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, + # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers + # or import libraries and vice versa. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") + # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed + # Microsoft MPI. + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") + else() + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") + endif() + + find_library(MPI_msmpi_LIBRARY + NAMES msmpi + HINTS ${MPI_MSMPI_LIB_PATH} + DOC "Location of the msmpi library for Microsoft MPI") + mark_as_advanced(MPI_msmpi_LIBRARY) + + if(MPI_msmpi_LIBRARY) + # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way + # MSMPI can be used and therefore that header has to be present. + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) + unset(MPI_MSMPI_INC_DIR) + endif() + + # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, + # thus it might be present or provided by the user. Figuring out which is supported is done later on. + # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. + # Should a user be employing PGI or have built its own set and provided it via cache variables, the + # splitting routine would have located the module files. + + # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran + # we need some extra library to glue Fortran support together: + # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names + # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran + # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit + # has both variants available. + # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is + # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), + # it's passed immediately after the string address. + + # To summarize: + # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention + # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention + # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention + # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention + # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. + + # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas + # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran + # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - + # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). + + # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. + # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and + # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. + if ("${LANG}" STREQUAL "Fortran") + set(MPI_MSMPI_CALLINGCONVS c) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) + list(APPEND MPI_MSMPI_CALLINGCONVS s) + endif() + foreach(mpistrlenpos IN ITEMS e m) + foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) + find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY + NAMES msmpif${mpistrlenpos}${mpicallingconv} + HINTS "${MPI_MSMPI_LIB_PATH}" + DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") + mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) + endforeach() + endforeach() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + + # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value + # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. + find_path(MPI_mpifptr_INCLUDE_DIR + NAMES "mpifptr.h" + HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" + DOC "Location of the mpifptr.h extra header for Microsoft MPI") + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) + else() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + endif() + mark_as_advanced(MPI_${LANG}_LIB_NAMES) + set(MPI_GUESS_FOUND TRUE) + endif() + endif() + + # At this point there's not many MPIs that we could still consider. + # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. + # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") + set(MPI_MPICH_PREFIX_PATHS + "$ENV{ProgramW6432}/MPICH2/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" + ) + + # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first + find_library(MPI_mpi_LIBRARY + NAMES mpi + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_mpi_LIBRARY) + # If we found mpi.lib, we detect the rest of MPICH2 + if(MPI_mpi_LIBRARY) + set(MPI_MPICH_LIB_NAMES "mpi") + # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. + # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. + if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) + find_library(MPI_cxx_LIBRARY + NAMES cxx + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_cxx_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "cxx") + # For Fortran, MPICH2 provides three different libraries: + # fmpich2.lib which uses uppercase symbols and cdecl, + # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), + # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. + # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also + # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one + # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation + elseif("${LANG}" STREQUAL "Fortran") + find_library(MPI_fmpich2_LIBRARY + NAMES fmpich2 + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2s_LIBRARY + NAMES fmpich2s + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2g_LIBRARY + NAMES fmpich2g + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") + endif() + + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + unset(MPI_MPICH_LIB_NAMES) + + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + # For MPICH2, the include folder would be in ../include relative to the library folder. + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) + if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + unset(MPI_MPICH_ROOT_DIR) + endif() + set(MPI_GUESS_FOUND TRUE) + endif() + unset(MPI_MPICH_PREFIX_PATHS) + endif() + endif() + set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) +endfunction() + +function(_MPI_adjust_compile_definitions LANG) + if("${LANG}" STREQUAL "CXX") + # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ + # bindings in MPI-2. + if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") + # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI + # OMPI_SKIP_MPICXX is being used in Open MPI + # _MPICC_H is being used for IBM Platform MPI + list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") + set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + endif() +endfunction() + +macro(_MPI_assemble_libraries LANG) + set(MPI_${LANG}_LIBRARIES "") + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() +endmacro() + +macro(_MPI_assemble_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() + endif() + endif() +endmacro() + +function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() + # Backwards compatibility: Search INCLUDE_PATH if given. + if(MPI_${LANG}_INCLUDE_PATH) + list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") + endif() + + # We try to find the headers/modules among those paths (and system paths) + # For C/C++, we just need to have a look for mpi.h. + if("${LANG}" MATCHES "(C|CXX)") + find_path(MPI_${LANG}_HEADER_DIR "mpi.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + mark_as_advanced(MPI_${LANG}_HEADER_DIR) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + # Fortran is more complicated here: An implementation could provide + # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI + # only provides Fortran 77 and - if mpi.f90 is built - potentially + # a Fortran 90 module. + elseif("${LANG}" STREQUAL "Fortran") + find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + find_path(MPI_${LANG}_MODULE_DIR + NAMES "mpi.mod" "mpi_f08.mod" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS + "${MPI_${LANG}_F77_HEADER_DIR}" + "${MPI_${LANG}_MODULE_DIR}" + ) + endif() + mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) + endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) +endfunction() + +macro(_MPI_create_imported_target LANG) + if(NOT TARGET MPI::MPI_${LANG}) + add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) + endif() + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") + if(MPI_${LANG}_LINK_FLAGS) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") + endif() + # If the compiler links MPI implicitly, no libraries will be found as they're contained within + # CMAKE__IMPLICIT_LINK_LIBRARIES already. + if(MPI_${LANG}_LIBRARIES) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") + endif() + # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") +endmacro() + +function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) + set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") + set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI") + set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") + unset(MPI_TEST_COMPILE_DEFINITIONS) + if("${LANG}" STREQUAL "Fortran") + if("${MODE}" STREQUAL "F90_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") + elseif("${MODE}" STREQUAL "F08_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") + else() # F77 header + set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") + endif() + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") + elseif("${LANG}" STREQUAL "CXX") + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") + if("${MODE}" STREQUAL "TEST_MPICXX") + set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) + endif() + else() # C + set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") + endif() + if(RUN_BINARY) + try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) + set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) + else() + try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + COPY_FILE "${BIN_FILE}") + endif() +endfunction() + +macro(_MPI_check_lang_works LANG) + # For Fortran we may have by the MPI-3 standard an implementation that provides: + # - the mpi_f08 module + # - *both*, the mpi module and 'mpif.h' + # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. + if( NOT MPI_${LANG}_WORKS ) + if("${LANG}" STREQUAL "Fortran") + set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) + + set(MPI_${LANG}_WORKS FALSE) + + foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) + if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_${mpimethod} TRUE) + else() + set(MPI_${LANG}_HAVE_${mpimethod} FALSE) + endif() + endforeach() + # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. + # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. + unset(MPI_Fortran_INTEGER_LINE) + if(NOT MPI_${LANG}_WORKS) + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) + if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_F77_HEADER TRUE) + endif() + endif() + else() + _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) + # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't + # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. + set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") + endif() + endif() +endmacro() + +# Some systems install various MPI implementations in separate folders in some MPI prefix +# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. +macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) + if(EXISTS "${PREFIX_FOLDER}") + file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") + foreach(_MPI_folder_child IN LISTS _MPI_folder_children) + if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") + list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") + endif() + endforeach() + endif() +endmacro() + +set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_ROOT} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) +if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") + # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ + # We enumerate the subfolders and append each as a prefix + MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. + list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") + # FreeBSD ships mpich under the normal system paths - but available openmpi implementations + # will be found in /usr/local/mpi/ + MPI_search_mpi_prefix_folder("/usr/local/mpi") +endif() + +# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. +# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution +# ships an mpiexec program (mpirun executables are not regulated by the standard). +find_program(MPIEXEC_EXECUTABLE + NAMES ${_MPIEXEC_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${MPI_HINT_DIRS} + DOC "Executable for running MPI programs.") + +# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). +# This gives us a fairly reliable base directory to search for /bin /lib and /include from. +get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) +get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) + +# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to +# launch an MPI process using mpiexec if such a program exists. +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") +set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") +set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") + +# Set the number of processes to the physical processor count +cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) +set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") +unset(_MPIEXEC_NUMPROCS) +mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) + +#============================================================================= +# Backward compatibility input hacks. Propagate the FindMPI hints to C and +# CXX if the respective new versions are not defined. Translate the old +# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. +# +# Once we find the new variables, we translate them back into their old +# equivalents below. +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") + endif() + endforeach() + + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() +#============================================================================= + +unset(MPI_VERSION) +unset(MPI_VERSION_MAJOR) +unset(MPI_VERSION_MINOR) + +unset(_MPI_MIN_VERSION) + +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + +# This loop finds the compilers and sends them off for interrogation. +foreach(LANG IN ITEMS C CXX Fortran) + if(CMAKE_${LANG}_COMPILER_LOADED) + if(NOT MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(_MPI_FIND_${LANG} TRUE) + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + if(_MPI_FIND_${LANG}) + if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") + mark_as_advanced(MPI_CXX_SKIP_MPICXX) + endif() + if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) + # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. + # Cray PrgEnv. + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + + # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. + if(MPI_${LANG}_WORKS) + set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) + endif() + + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) + endif() + + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + DOC "MPI compiler for ${LANG}" + ) + + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # If we haven't made the implicit compiler test yet, perform it now. + if(NOT MPI_${LANG}_TRIED_IMPLICIT) + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE__COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() + endif() + + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() + endif() + endif() + endif() + + _MPI_split_include_dirs(${LANG}) + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + + _MPI_adjust_compile_definitions(${LANG}) + # We always create imported targets even if they're empty + _MPI_create_imported_target(${LANG}) + + if(NOT MPI_${LANG}_WORKS) + _MPI_check_lang_works(${LANG}) + endif() + + # Next, we'll initialize the MPI variables that have not been previously set. + set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() + mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS + MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) + + # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported + # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. + if(MPI_${LANG}_WORKS) + if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) + if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) + _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) + if(MPI_RESULT_${LANG}_test_mpi_MPICXX) + set(MPI_MPICXX_FOUND TRUE) + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + endif() + + # At this point, we know the bindings present but not the MPI version or anything else. + if(NOT DEFINED MPI_${LANG}_VERSION) + unset(MPI_${LANG}_VERSION_MAJOR) + unset(MPI_${LANG}_VERSION_MINOR) + endif() + set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) + + # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the + # Fortran parameters, since those depend on the method of consumption. + # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 + # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. + if("${LANG}" STREQUAL "Fortran") + if(MPI_${LANG}_HAVE_F08_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) + elseif(MPI_${LANG}_HAVE_F90_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) + else() + set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) + endif() + + # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION + # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not + # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. + if(NOT DEFINED MPI_${LANG}_VERSION) + _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) + if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) + file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. + # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING + # and might vary between the different methods of consumption. + if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) + foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) + if(MPI_${LANG}_HAVE_${mpimethod}) + set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) + set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) + _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) + if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND + NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") + if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES + ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") + if("${CMAKE_MATCH_1}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) + endif() + if("${CMAKE_MATCH_2}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) + endif() + endif() + endif() + endif() + endforeach() + set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) + endif() + else() + set(MPI_${LANG}_HIGHEST_METHOD normal) + + # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. + if(NOT DEFINED MPI_${LANG}_VERSION) + file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + unset(MPI_BIN_FOLDER) + + # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. + # The one remaining issue is to determine which MPI library is installed. + # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, + # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING + # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). + # It's also worth noting that the installed version string can depend on the language, or on the system the binary + # runs on if MPI is not statically linked. + if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) + _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) + if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND + "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") + string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" + MPI_${LANG}_LIBRARY_VERSION_STRING) + else() + set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") + endif() + endif() + endif() + + set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) + set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) + set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) + + unset(MPI_${LANG}_REQUIRED_VARS) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") + endforeach() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") + if("${LANG}" STREQUAL "Fortran") + # For Fortran we only need one of the module or header directories to have *some* support for MPI. + if(NOT MPI_${LANG}_MODULE_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") + endif() + if(NOT MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") + endif() + else() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") + endforeach() + endif() + # Append the works variable now. If the settings did not work, this will show up properly. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + else() + # If the compiler worked implicitly, use its path as output. + # Should the compiler variable be set, we also require it to work. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") + if(MPI_${LANG}_COMPILER) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + endif() + endif() + find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} + VERSION_VAR MPI_${LANG}_VERSION) + + if(DEFINED MPI_${LANG}_VERSION) + if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) + set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) + endif() + endif() + endif() +endforeach() + +unset(_MPI_REQ_VARS) +foreach(LANG IN ITEMS C CXX Fortran) + if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") + endif() +endforeach() + +if(MPICXX IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") +endif() + +find_package_handle_standard_args(MPI + REQUIRED_VARS ${_MPI_REQ_VARS} + VERSION_VAR ${_MPI_MIN_VERSION} + HANDLE_COMPONENTS) + +#============================================================================= +# More backward compatibility stuff + +# For compatibility reasons, we also define MPIEXEC +set(MPIEXEC "${MPIEXEC_EXECUTABLE}") + +# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. +foreach(LANG IN ITEMS C CXX Fortran) + if(MPI_${LANG}_FOUND) + set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") + unset(MPI_${LANG}_COMPILE_FLAGS) + if(MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_COMPILE_DEFINITIONS) + foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) + string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") + endforeach() + endif() + endif() +endforeach() + +# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. +# This mimics the behavior of the old language-oblivious FindMPI. +set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) +if (MPI_CXX_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_CXX_${var}}) + endforeach() +elseif (MPI_C_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_C_${var}}) + endforeach() +endif() + +# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. +if (MPI_LIBRARIES) + list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) + set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") + unset(MPI_LIBRARY_WORK) +else() + set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") +endif() + +list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) +if (MPI_NUMLIBS GREATER 1) + set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") + list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) + set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") + unset(MPI_EXTRA_LIBRARY_WORK) +else() + set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") +endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) +#============================================================================= + +# unset these vars to cleanup namespace +unset(_MPI_OLD_VARS) +unset(_MPI_PREFIX_PATH) +unset(_MPI_BASE_DIR) +foreach (lang C CXX Fortran) + unset(_MPI_${LANG}_COMPILER_NAMES) +endforeach() + +cmake_policy(POP) diff --git a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in new file mode 100644 index 0000000000..30f912c627 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in @@ -0,0 +1,4 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c new file mode 100644 index 0000000000..be9d19d435 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c @@ -0,0 +1,19 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +int main(int argc, char* argv[]) +{ + char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; + int mpilibver_len; + MPI_Get_library_version(mpilibver_str, &mpilibver_len); +#ifdef __cplusplus + std::puts(mpilibver_str); +#else + puts(mpilibver_str); +#endif +} diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in new file mode 100644 index 0000000000..7938587168 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in @@ -0,0 +1,7 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str + integer(kind=MPI_INTEGER_KIND) :: ierror, reslen + call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) + print *, mpilibver_str + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in new file mode 100644 index 0000000000..a254523853 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in @@ -0,0 +1,10 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') + character, dimension(17), parameter :: mpiver_str =& + (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & + char(zero + MPI_VERSION), & + '.', & + char(zero + MPI_SUBVERSION), ']' /) + print *, mpiver_str + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.c b/cmake/Modules/NewCMake/FindMPI/test_mpi.c new file mode 100644 index 0000000000..b8a308a4b0 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/test_mpi.c @@ -0,0 +1,37 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +const char mpiver_str[] = { 'I', 'N', + 'F', 'O', + ':', 'M', + 'P', 'I', + '-', 'V', + 'E', 'R', + '[', ('0' + MPI_VERSION), + '.', ('0' + MPI_SUBVERSION), + ']', '\0' }; +#endif + +int main(int argc, char* argv[]) +{ +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +#ifdef __cplusplus + std::puts(mpiver_str); +#else + puts(mpiver_str); +#endif +#endif +#ifdef TEST_MPI_MPICXX + MPI::MPI_Init(&argc, &argv); + MPI::MPI_Finalize(); +#else + MPI_Init(&argc, &argv); + MPI_Finalize(); +#endif +} diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in new file mode 100644 index 0000000000..4d43a04d65 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in @@ -0,0 +1,6 @@ + program hello + @MPI_Fortran_INCLUDE_LINE@ + integer@MPI_Fortran_INTEGER_LINE@ ierror + call MPI_INIT(ierror) + call MPI_FINALIZE(ierror) + end program diff --git a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 0000000000..67f6bd6f2b --- /dev/null +++ b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,386 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageHandleStandardArgs +----------------------------- + +This module provides a function intended to be used in :ref:`Find Modules` +implementing :command:`find_package()` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``_FOUND`` variable. The package is +considered found if all variables listed contain valid results, e.g. +valid filepaths. + +.. command:: find_package_handle_standard_args + + There are two signatures:: + + find_package_handle_standard_args( + (DEFAULT_MSG|) + ... + ) + + find_package_handle_standard_args( + [FOUND_VAR ] + [REQUIRED_VARS ...] + [VERSION_VAR ] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [FAIL_MESSAGE ] + ) + + The ``_FOUND`` variable will be set to ``TRUE`` if all + the variables ``...`` are valid and any optional + constraints are satisfied, and ``FALSE`` otherwise. A success or + failure message may be displayed based on the results and on + whether the ``REQUIRED`` and/or ``QUIET`` option was given to + the :command:`find_package` call. + + The options are: + + ``(DEFAULT_MSG|)`` + In the simple signature this specifies the failure message. + Use ``DEFAULT_MSG`` to ask for a default message to be computed + (recommended). Not valid in the full signature. + + ``FOUND_VAR `` + Obsolete. Specifies either ``_FOUND`` or + ``_FOUND`` as the result variable. This exists only + for compatibility with older versions of CMake and is now ignored. + Result variables of both names are always set for compatibility. + + ``REQUIRED_VARS ...`` + Specify the variables which are required for this package. + These may be named in the generated failure message asking the + user to set the missing variable values. Therefore these should + typically be cache entries such as ``FOO_LIBRARY`` and not output + variables like ``FOO_LIBRARIES``. + + ``VERSION_VAR `` + Specify the name of a variable that holds the version of the package + that has been found. This version will be checked against the + (potentially) specified required version given to the + :command:`find_package` call, including its ``EXACT`` option. + The default messages include information about the required + version and the version which has been actually found, both + if the version is ok or not. + + ``HANDLE_COMPONENTS`` + Enable handling of package components. In this case, the command + will report which components have been found and which are missing, + and the ``_FOUND`` variable will be set to ``FALSE`` + if any of the required components (i.e. not the ones listed after + the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are + missing. + + ``CONFIG_MODE`` + Specify that the calling find module is a wrapper around a + call to ``find_package( NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``FAIL_MESSAGE `` + Specify a custom failure message instead of using the default + generated message. Not recommended. + +Example for the simple signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibXml2 DEFAULT_MSG + LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) + +The ``LibXml2`` package is considered to be found if both +``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. +Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found +and ``REQUIRED`` was used, it fails with a +:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was +used or not. If it is found, success will be reported, including +the content of the first ````. On repeated CMake runs, +the same message will not be printed again. + +Example for the full signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION) + +In this case, the ``LibArchive`` package is considered to be found if +both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. +Also the version of ``LibArchive`` will be checked by using the version +contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, +the default messages will be printed. + +Another example for the full signature: + +.. code-block:: cmake + + find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) + find_package_handle_standard_args(Automoc4 CONFIG_MODE) + +In this case, a ``FindAutmoc4.cmake`` module wraps a call to +``find_package(Automoc4 NO_MODULE)`` and adds an additional search +directory for ``automoc4``. Then the call to +``find_package_handle_standard_args`` produces a proper success/failure +message. +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + string(APPEND configsText " ${filename} (version ${version})\n") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + +# Set up the arguments for `cmake_parse_arguments`. + set(options CONFIG_MODE HANDLE_COMPONENTS) + set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + +# Check whether we are in 'simple' or 'extended' mode: + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + endif() + +# now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + set(FPHSA_FOUND_${_NAME} TRUE) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(FPHSA_FOUND_${_NAME} FALSE) + string(APPEND MISSING_VARS " ${_CURRENT_VAR}") + else() + string(APPEND DETAILS "[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(FPHSA_FOUND_${_NAME}) + set(${_NAME}_FOUND TRUE) + set(${_NAME_UPPER}_FOUND TRUE) + else() + set(${_NAME}_FOUND FALSE) + set(${_NAME_UPPER}_FOUND FALSE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components: ") + endif() + string(APPEND FOUND_COMPONENTS_MSG " ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components: ") + endif() + string(APPEND MISSING_COMPONENTS_MSG " ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + string(APPEND MISSING_VARS " ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + string(APPEND DETAILS "[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) + set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + unset(_VERSION_HEAD) + else () + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + endif () + unset(_VERSION_DOTS) + + else() # minimum version specified: + if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + # Check with DEFINED as the found version may be 0. + if(DEFINED ${FPHSA_VERSION_VAR}) + set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") + endif() + endif () + + if(VERSION_OK) + string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") + else() + set(${_NAME}_FOUND FALSE) + endif() + + + # print the result: + if (${_NAME}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) +endfunction() diff --git a/cmake/Modules/NewCMake/FindPackageMessage.cmake b/cmake/Modules/NewCMake/FindPackageMessage.cmake new file mode 100644 index 0000000000..6821cee4f7 --- /dev/null +++ b/cmake/Modules/NewCMake/FindPackageMessage.cmake @@ -0,0 +1,47 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindPackageMessage +# ------------------ +# +# +# +# FIND_PACKAGE_MESSAGE( "message for user" "find result details") +# +# This macro is intended to be used in FindXXX.cmake modules files. It +# will print a message once for each unique find result. This is useful +# for telling the user where a package was found. The first argument +# specifies the name (XXX) of the package. The second argument +# specifies the message to display. The third argument lists details +# about the find result so that if they change the message will be +# displayed again. The macro also obeys the QUIET argument to the +# find_package command. +# +# Example: +# +# :: +# +# if(X11_FOUND) +# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" +# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") +# else() +# ... +# endif() + +function(FIND_PACKAGE_MESSAGE pkg msg details) + # Avoid printing a message repeatedly for the same find result. + if(NOT ${pkg}_FIND_QUIETLY) + string(REPLACE "\n" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + # The message has not yet been printed. + message(STATUS "${msg}") + + # Save the find details in the cache to avoid printing the same + # message again. + set("${DETAILS_VAR}" "${details}" + CACHE INTERNAL "Details about finding ${pkg}") + endif() + endif() +endfunction() diff --git a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake new file mode 100644 index 0000000000..dce6f99262 --- /dev/null +++ b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake @@ -0,0 +1,70 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# SelectLibraryConfigurations +# --------------------------- +# +# +# +# select_library_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose +# good values for basename_LIBRARY, basename_LIBRARIES, +# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what +# has been found and set. If only basename_LIBRARY_RELEASE is defined, +# basename_LIBRARY will be set to the release value, and +# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. +# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will +# take the debug value, and basename_LIBRARY_RELEASE will be set to +# basename_LIBRARY_RELEASE-NOTFOUND. +# +# If the generator supports configuration types, then basename_LIBRARY +# and basename_LIBRARIES will be set with debug and optimized flags +# specifying the library to be used for the given configuration. If no +# build type has been set or the generator in use does not support +# configuration types, then basename_LIBRARY and basename_LIBRARIES will +# take only the release value, or the debug value if the release one is +# not set. + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +macro( select_library_configurations basename ) + if(NOT ${basename}_LIBRARY_RELEASE) + set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + if(NOT ${basename}_LIBRARY_DEBUG) + set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND + ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + set( ${basename}_LIBRARY "" ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) + list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) + endforeach() + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) + list( APPEND ${basename}_LIBRARY debug "${_libname}" ) + endforeach() + elseif( ${basename}_LIBRARY_RELEASE ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + elseif( ${basename}_LIBRARY_DEBUG ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) + else() + set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") + endif() + + set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif() + + mark_as_advanced( ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro() diff --git a/cmake/Modules/findHelpers.cmake b/cmake/Modules/findHelpers.cmake new file mode 100644 index 0000000000..028957a0a6 --- /dev/null +++ b/cmake/Modules/findHelpers.cmake @@ -0,0 +1,173 @@ +function (findSrc varName version varDir ) + if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) + message("setting source for ${varName} to be in libsrc") + set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) + set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) + else() + set(searchName ${varName}_v${${version}}) + message("searching for source for ${searchName} in ${CRTM_BASE}") + string( TOLOWER ${varName} varNameLower ) + find_path( TMP_DIR + NAMES ${searchName} + HINTS + ${CMAKE_SOURCE_DIR}/../libs + ${CRTM_BASE}/${version} + ${CRTM_BASE}/${varName} + ${CRTM_BASE}/${varName}/${version} + ${CRTM_BASE}/${varNameLower} + ${CRTM_BASE}/${varNameLower}/${version} + ${COREPATH}/sorc + $ENV{${varDir}}/libsrc + $ENV{${varDir}}/lib/sorc + $ENV{CORPATH}/lib/sorc + ${CMAKE_SOURCE_DIR}/libsrc/${varName} + ) + if( NOT TMP_DIR ) + message("didn't find directory") + set(secondSearchName v${${version}}) + find_path( TMP2_DIR + NAMES ${secondSearchName} + HINTS + ${CRTM_BASE}/${varName} + ) + endif() + set( varCacheName "${varDir}_SRC" ) + file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/*.f*" "${TMP_DIR}/${varName}_v${${version}}/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}" PARENT_SCOPE) + set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/src/*.f*" "${TMP_DIR}/${varName}_v${${version}}/src/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/src" PARENT_SCOPE) + set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/src" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/libsrc/*.f*" "${TMP_DIR}/${varName}_v${${version}}/src/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/libsrc" PARENT_SCOPE) + set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/libsrc" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/sorc/*.f*" "${TMP_DIR}/${varName}_v${${version}}/sorc/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/sorc" PARENT_SCOPE) + set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/sorc" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc/*.f*" + "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc" PARENT_SCOPE) + set( ${varCacheName} "${TMP_DIR}/${varName}_v${${version}}/sorc/libsrc" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${TMP2_DIR}/v${${version}}/src/*.f*" + "${TMP_DIR}/v${${version}}/src/*.F*") + if( f_FILES ) + set( ${varDir} "${TMP2_DIR}/v${${version}}/src" PARENT_SCOPE) + set( ${varCacheName} "${TMP2_DIR}/v${${version}}/src" CACHE STRING "" FORCE ) + endif() + endif() + endif() + endif() + endif() + endif() + if( NOT f_FILES ) # look for source that is of a different version + message("WARNING: Did not find ${${version}} of ${varName}, looking for alternates") + findOtherVersion( TMP_DIR ${varName} srcPath ${version} ) + file(GLOB f_FILES "${srcPath}/*.f*" "${srcPath}/*.F*") + if( f_FILES ) + set( ${varDir} "${srcPath}" PARENT_SCOPE) + set( ${varCacheName} "${srcPath}" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${srcPath}/src/*.f*" "${srcPath}/src/*.F*") + if( f_FILES ) + set( ${varDir} "${srcPath}/src" PARENT_SCOPE) + set( ${varCacheName} "${srcPath}/src" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${srcPath}/libsrc/*.f*" "${srcPath}/src/*.F*") + if( f_FILES ) + set( ${varDir} "${srcPath}/libsrc" PARENT_SCOPE) + set( ${varCacheName} "${srcPath}/libsrc" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${srcPath}/sorc/*.f*" "${srcPath}/sorc/*.F*") + if( f_FILES ) + set( ${varDir} "${srcPath}/sorc" PARENT_SCOPE) + set( ${varCacheName} "${srcPath}/sorc" CACHE STRING "" FORCE ) + else() + file(GLOB f_FILES "${srcPath}/sorc/libsrc/*.f*" + "${srcPath}/sorc/libsrc/*.F*") + if( f_FILES ) + set( ${varDir} "${srcPath}/sorc/libsrc" PARENT_SCOPE) + set( ${varCacheName} "${srcPath}/sorc/libsrc" CACHE STRING "" FORCE ) + endif() + endif() + endif() + endif() + endif() + endif() + endif() +endfunction() + +function (findInc incName version incFile ) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0009 NEW) + STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) + if(( USECRTMBASE ) AND ( CRTM_BASE )) + execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) +# file(GLOB_RECURSE INCFILES ${CRTM_BASE}/*${CRTM_VER}*/*mod ) +# file(GLOB_RECURSE INCFILES2 ${CRTM_BASE}/crtm/*${CRTM_VER}*/*/*mod ) +# list(APPEND INCFILES ${INCFILES2} ) + else() + if(crayComp) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + else() + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + else() + execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + if( NOT (INCFILES) ) + execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + endif() +# message("incfiles are ${INCFILES}") + if( INCFILES ) + string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) + endif() + foreach( INC_FILE in ${INCFILES} ) + string(REGEX MATCH ${${version}} MATCHFOUND ${INC_FILE} ) +# message("matchfound is ${MATCHFOUND}, version is ${${version}} for ${INC_FILE}") + if( MATCHFOUND ) + message("found ${INC_FILE}") + string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) + set( ${incFile} ${INCPATH} PARENT_SCOPE ) + return() + endif() + endforeach() + file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) + list(LENGTH INCFILES numFiles) + if(numFiles EQUAL 1) + get_filename_component( INCPATH ${INCFILES} DIRECTORY ) + else() + foreach( INC_FILE in ${INCFILES} ) + get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) +# message("WARNING: Did not find explicit version ${${version}} of ${incName} module, using un-versioned path") +# set( ${incFile} ${INCPATH} PARENT_SCOPE ) +# return() + endforeach() + endif() + set( ${incFile} ${INCPATH} PARENT_SCOPE ) +endfunction() + +function (findOtherVersion rootPath srcName srcPath newVer ) + file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) + foreach( SRC_DIR in ${SRCDIRS} ) + string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) + if( MATCHFOUND ) + set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) + string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) + message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") + set( ${newVer} ${ALTVER} PARENT_SCOPE ) + return() + endif() + endforeach() +endfunction() diff --git a/cmake/Modules/platforms/Cheyenne.cmake b/cmake/Modules/platforms/Cheyenne.cmake new file mode 100644 index 0000000000..54477168e8 --- /dev/null +++ b/cmake/Modules/platforms/Cheyenne.cmake @@ -0,0 +1,24 @@ +macro (setCheyenne) + message("Setting paths for Cheyenne") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + + set(BUILD_CORELIBS "ON" ) + set(BUILD_UTIL "OFF" CACHE INTERNAL "" ) + set(BUILD_BUFR "ON" CACHE INTERNAL "") + set(BUILD_SFCIO "ON" CACHE INTERNAL "") + set(BUILD_SIGIO "ON" CACHE INTERNAL "") + set(BUILD_W3EMC "ON" CACHE INTERNAL "") + set(BUILD_W3NCO "ON" CACHE INTERNAL "") + set(BUILD_BACIO "ON" CACHE INTERNAL "") + set(BUILD_CRTM "ON" CACHE INTERNAL "") + set(BUILD_SP "ON" CACHE INTERNAL "") + set(BUILD_NEMSIO "ON" CACHE INTERNAL "") + set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) +endmacro() + diff --git a/cmake/Modules/platforms/Discover.cmake b/cmake/Modules/platforms/Discover.cmake new file mode 100644 index 0000000000..fe8a2dfc0e --- /dev/null +++ b/cmake/Modules/platforms/Discover.cmake @@ -0,0 +1,55 @@ +macro (setDiscover) + message("Setting paths for Discover") +# option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) +# option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HDF5_USE_STATIC_LIBRARIES "OFF") + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(host "Discover" CACHE INTERNAL "") + + set(COREPATH $ENV{COREPATH} ) + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.1.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.2.0" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() + + if( ENV{BASEDIR} ) + set(BASEDIR $ENV{BASEDIR}/Linux CACHE INTERNAL "") + endif() + set(BUILD_CORELIBS "ON" CACHE INTERNAL "") + set(USE_WRF "OFF" CACHE INTERNAL "") + set(BUILD_GLOBAL "ON" CACHE INTERNAL "") + + set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) + +endmacro() + diff --git a/cmake/Modules/platforms/Gaea.cmake b/cmake/Modules/platforms/Gaea.cmake new file mode 100644 index 0000000000..d6929b8f03 --- /dev/null +++ b/cmake/Modules/platforms/Gaea.cmake @@ -0,0 +1,14 @@ +macro (setGaea) + + message("Setting flags and paths for Cray") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) + + set(HOST_FLAG "-xCORE-AVX2" CACHE INTERNAL "Host Flag") # for Haswell (C4) + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag" ) + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") + set(GSI_LDFLAGS "${MKL_FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(BUILD_CORELIBS "OFF" ) +endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake b/cmake/Modules/platforms/Generic.cmake new file mode 100644 index 0000000000..b584cf66cf --- /dev/null +++ b/cmake/Modules/platforms/Generic.cmake @@ -0,0 +1,24 @@ +macro (setGeneric) + message("Setting paths for Generic System") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + if(EXISTS /jetmon) + set(HOST_FLAG "" CACHE INTERNAL "Host Flag") ## default, no host_flag required + else() + set(HOST_FLAG "" CACHE INTERNAL "Host Flag") ## default, no host_flag required + endif() + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + + message("setting values for corelibs") + set(BUILD_BUFR "OFF" CACHE INTERNAL "Build the BUFR library" ) + set(BUILD_BACIO "OFF" CACHE INTERNAL "Build the BACIO library" ) + set(BUILD_SFCIO "OFF" CACHE INTERNAL "Build the SFCIO library" ) + set(BUILD_SIGIO "OFF" CACHE INTERNAL "Build the SIGIO library" ) + set(BUILD_NEMSIO "OFF" CACHE INTERNAL "Build the NEMSIO library" ) + set(BUILD_SP "OFF" CACHE INTERNAL "Build the SP library" ) + set(BUILD_CRTM "OFF" CACHE INTERNAL "Build the CRTM library" ) + set(BUILD_W3EMC "OFF" CACHE INTERNAL "Build the EMC library" ) + set(BUILD_NCO "OFF" CACHE INTERNAL "Build the NCO library" ) +endmacro() diff --git a/cmake/Modules/platforms/Hera.cmake b/cmake/Modules/platforms/Hera.cmake new file mode 100644 index 0000000000..d8af27696c --- /dev/null +++ b/cmake/Modules/platforms/Hera.cmake @@ -0,0 +1,42 @@ +macro (setHERA) + message("Setting paths for HERA") + option(FIND_HDF5 "Try to Find HDF5 libraries" ON) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "ON") + + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() + diff --git a/cmake/Modules/platforms/Jet.cmake b/cmake/Modules/platforms/Jet.cmake new file mode 100644 index 0000000000..8178526d40 --- /dev/null +++ b/cmake/Modules/platforms/Jet.cmake @@ -0,0 +1,10 @@ +macro (setJet) + message("Setting paths for Jet") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") +endmacro() + diff --git a/cmake/Modules/platforms/Orion.cmake b/cmake/Modules/platforms/Orion.cmake new file mode 100644 index 0000000000..56ddd1f2c3 --- /dev/null +++ b/cmake/Modules/platforms/Orion.cmake @@ -0,0 +1,42 @@ +macro (setOrion) + message("Setting paths for Orion") + option(FIND_HDF5 "Try to Find HDF5 libraries" ON) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "ON") + + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() + diff --git a/cmake/Modules/platforms/S4.cmake b/cmake/Modules/platforms/S4.cmake new file mode 100644 index 0000000000..c727765c16 --- /dev/null +++ b/cmake/Modules/platforms/S4.cmake @@ -0,0 +1,10 @@ +macro (setS4) + message("Setting paths for S4") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "OFF") +endmacro() diff --git a/cmake/Modules/platforms/WCOSS-C.cmake b/cmake/Modules/platforms/WCOSS-C.cmake new file mode 100644 index 0000000000..1c9cf712cd --- /dev/null +++ b/cmake/Modules/platforms/WCOSS-C.cmake @@ -0,0 +1,60 @@ +macro (setWCOSS_C) + + message("Setting flags and paths for Cray") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "" CACHE INTERNAL "MKL flag" ) + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") + set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/gpfs/hps/nco/ops/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/gpfs/hps/nco/ops/nwprod/lib/crtm" ) + endif() + if( NOT DEFINED ENV{WRFPATH} ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-intel" ) + else() + set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-cray" ) + endif() + else() + set(WRFPATH $ENV{WRFPATH} ) + endif() + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "11.0.1" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.2" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.2.0" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() diff --git a/cmake/Modules/platforms/WCOSS-D.cmake b/cmake/Modules/platforms/WCOSS-D.cmake new file mode 100644 index 0000000000..e0daffa593 --- /dev/null +++ b/cmake/Modules/platforms/WCOSS-D.cmake @@ -0,0 +1,51 @@ +macro (setWCOSS_D) + message("Setting paths for Dell") + option(FIND_HDF5 "Try to Find HDF5 libraries" ON) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "GSI Fortran Flags") + set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS} ${MKL_FLAG}" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "ENKF Fortran Flags") + + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "" ) + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/gpfs/dell1/nco/ops/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/gpfs/dell1/nco/ops/nwprod/lib/crtm" ) + endif() + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "11.3.0" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.5" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.3.0" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() diff --git a/cmake/Modules/platforms/WCOSS.cmake b/cmake/Modules/platforms/WCOSS.cmake new file mode 100644 index 0000000000..81b1297392 --- /dev/null +++ b/cmake/Modules/platforms/WCOSS.cmake @@ -0,0 +1,61 @@ +macro (setWCOSS) + message("Setting paths for WCOSS") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HDF5_USE_STATIC_LIBRARIES "OFF") + + #if ibmpe module is not loaded last, CMake tries to use intel mpi. Force use of ibmhpc + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set( MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${HOST_FLAG} " CACHE INTERNAL "") + + set(MPI_Fortran_COMPILER /opt/ibmhpc/pe13010/base/bin/mpif90 CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + set(MPI_C_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicc CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + set(MPI_CXX_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicxx CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/nwprod2/lib" ) + endif() + if( NOT DEFINED ENV{WRFPATH} ) + set(WRFPATH "/nwprod/sorc/wrf_shared.fd" ) + else() + set(WRFPATH $ENV{WRFPATH} ) + endif() + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() + +endmacro() diff --git a/cmake/Modules/setGNUFlags.cmake b/cmake/Modules/setGNUFlags.cmake new file mode 100644 index 0000000000..e4ef2d9ade --- /dev/null +++ b/cmake/Modules/setGNUFlags.cmake @@ -0,0 +1,66 @@ +function (setGNU) + set(COMPILER_TYPE "gnu" CACHE INTERNAL "Compiler brand") + message("Setting GNU Compiler Flags") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") + set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -DLINUX -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) + set( FV3GFS_NCIO_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) + set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "") + set( COV_CALC_FLAGS "-c -O3 -fconvert=little-endian -ffast-math -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fopenmp" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") + else( ) #DEBUG + set(GSI_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -fbacktrace -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") + set(BUFR_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -fbacktrace -g -fbacktrace -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BACIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -fbacktrace -std=f2003 -fdollar-ok -g -fbacktrace -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -g -fbacktrace -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -DLINUX -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) + set( FV3GFS_NCIO_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "" ) + set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -fbacktrace -Wl,-noinhibit-exec" CACHE INTERNAL "") + set( COV_CALC_FLAGS "-c -O3 -fconvert=little-endian -ffast-math -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fopenmp" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") + endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) +endfunction() + diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake new file mode 100644 index 0000000000..bdf358c332 --- /dev/null +++ b/cmake/Modules/setHOST.cmake @@ -0,0 +1,97 @@ +macro( setHOST ) + site_name(HOSTNAME) + message("The hostname is ${HOSTNAME}" ) + string(REGEX MATCH "s4-" HOST-S4 ${HOSTNAME} ) + string(REGEX MATCH "gaea" HOST-Gaea ${HOSTNAME} ) + string(REGEX MATCH "hfe[0-9]" HOST-Hera ${HOSTNAME} ) + string(REGEX MATCH "Orion" HOST-Orion ${HOSTNAME} ) + if(EXISTS /jetmon) + set(HOST-Jet "True" ) + endif() + string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + if( HOST-WCOSS ) + message("host is WCOSS") + endif() + string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + if( NOT HOST-WCOSS ) # don't overwrite if we are on gyre + string(REGEX MATCH "t[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + endif() + string(REGEX MATCH "v[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus Phase 3 + string(REGEX MATCH "v[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + endif() + if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus/Phase 3.5 + string(REGEX MATCH "m[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + if( NOT HOST-WCOSS_D )# don't overwrite if we are on mars Phase 3 + string(REGEX MATCH "m[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + endif() + endif() + string(REGEX MATCH "llogin" HOST-WCOSS_C ${HOSTNAME} ) + if( NOT HOST-WCOSS_C )# don't overwrite if we are on luna + string(REGEX MATCH "slogin" HOST-WCOSS_C ${HOSTNAME} ) + endif() + string(REGEX MATCH "discover" HOST-Discover ${HOSTNAME} ) + string(REGEX MATCH "cheyenne" HOST-Cheyenne ${HOSTNAME} ) + message("done figuring out host--${HOSTNAME}") + if ( BUILD_CORELIBS ) + MESSAGE(STATUS "BUILD_CORELIBS manually-specified as ON") + set( host "GENERIC" ) + set( HOST-Generic "TRUE" ) + setGeneric() + elseif(HOST-Jet) + option(BUILD_CORELIBS "Build the Core libraries " ON) + set( host "Jet" ) + set( HOST-Jet "TRUE" ) + setJet() + elseif( HOST-S4 ) + option(BUILD_CORELIBS "Build the Core libraries " ON) + set( host "S4" ) + set( HOST-S4 "TRUE" ) + setS4() + elseif( HOST-WCOSS ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + set( host "WCOSS" ) + set( HOST-WCOSS "TRUE" ) + setWCOSS() + elseif( HOST-Hera ) + set( host "Hera" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setHERA() + set( HOST-Hera "TRUE" ) + elseif( HOST-Orion ) + set( host "Orion" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setOrion() + set( HOST-Orion "TRUE" ) + elseif( HOST-Gaea ) + set( host "Gaea" ) + option(BUILD_CORELIBS "Build the Core libraries " On) + setGaea() + set( HOST-Gaea "TRUE" ) + elseif( HOST-Cheyenne ) + option(BUILD_CORELIBS "Build the Core libraries " ON) + set( host "Cheyenne" ) + setCheyenne() + set( HOST-Cheyenne "TRUE" ) + elseif( HOST-WCOSS_C ) + set( host "WCOSS_C" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setWCOSS_C() + set( HOST-WCOSS_C "TRUE" ) + elseif( HOST-WCOSS_D ) + set( host "WCOSS_D" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setWCOSS_D() + set( HOST-WCOSS_D "TRUE" ) + elseif( HOST-Discover ) + set(host "Discover" ) + setDiscover() + set( HOST-Discover "TRUE" ) + else( ) + set( host "GENERIC" ) + option(BUILD_CORELIBS "Build the Core libraries " ON) + setGeneric() + set( HOST-Generic "TRUE" ) + endif() + message("Host is set to ${host}") +endmacro() diff --git a/cmake/Modules/setIntelFlags.cmake b/cmake/Modules/setIntelFlags.cmake new file mode 100644 index 0000000000..88e5061ffc --- /dev/null +++ b/cmake/Modules/setIntelFlags.cmake @@ -0,0 +1,94 @@ +set(intsize 4) +function(set_LIBRARY_UTIL_Intel) + set(BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp ${HOST_FLAG} " CACHE INTERNAL "" ) + set(BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -O3 ${HOST_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) + set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback ${HOST_FLAG}" CACHE INTERNAL "" ) + set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_Fortran_4_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3EMC_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) + set (NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "" ) + set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) + set(FV3GFS_NCIO_Fortran_FLAGS "-free" CACHE INTERNAL "" ) + set(UTIL_Fortran_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone" CACHE INTERNAL "") +# set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert little_endian -D_REAL8_ -openmp -fpp -auto" CACHE INTERNAL "" ) + set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert little_endian ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") +# set(COV_CALC_FLAGS ${GSI_Intel_Platform_FLAGS} CACHE INTERNAL "Full GSI Fortran FLAGS" ) +endfunction(set_LIBRARY_UTIL_Intel) + +function(set_LIBRARY_UTIL_Debug_Intel) + set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " CACHE INTERNAL "" ) + set(BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " CACHE INTERNAL "" ) + set(BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) + set(CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_Fortran_4_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3EMC_4_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_4_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) + set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) + set(FV3GFS_NCIO_Fortran_FLAGS "-free" CACHE INTERNAL "" ) + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -Wl,-noinhibit-exec" CACHE INTERNAL "" ) + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(UTIL_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS "-O0 -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian" CACHE INTERNAL "") + set(COV_CALC_FLAGS "-O3 ${HOST_FLAG} -implicitnone -traceback -fp-model strict -convert little_endian ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) +endfunction(set_LIBRARY_UTIL_Debug_Intel) + +function(set_GSI_ENKF_Intel) + #Common release/production flags + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) + set(GSI_Fortran_FLAGS "${GSI_Intel_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full GSI Fortran FLAGS" ) + set(ENKF_Fortran_FLAGS "${ENKF_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full ENKF Fortran FLAGS" ) + set(GSDCLOUD_Fortran_FLAGS "-O3 -convert big_endian" CACHE INTERNAL "") +endfunction(set_GSI_ENKF_Intel) + +function (set_GSI_ENKF_Debug_Intel) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") + set(ENKF_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug all -check all,noarg_temp_created -fp-model strict -convert big_endian -assume byterecl -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -convert big_endian" CACHE INTERNAL "") + #Common debug flags + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) +endfunction (set_GSI_ENKF_Debug_Intel) + +function (setIntel) + string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) + list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) + list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) + list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) + set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") + set(COMPILER_TYPE "intel" CACHE INTERNAL "Compiler brand") + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) + set(EXTRA_LINKER_FLAGS ${MKL_FLAG} CACHE INTERNAL "Extra Linker flags") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set_GSI_ENKF_Intel() + set_LIBRARY_UTIL_Intel() + else( ) #DEBUG flags + message("Building DEBUG version of GSI") + set( debug_suffix "_DBG" CACHE INTERNAL "" ) + set_GSI_ENKF_Debug_Intel() + set_LIBRARY_UTIL_Debug_Intel() + endif() +endfunction() + diff --git a/cmake/Modules/setPGIFlags.cmake b/cmake/Modules/setPGIFlags.cmake new file mode 100644 index 0000000000..2088a7416d --- /dev/null +++ b/cmake/Modules/setPGIFlags.cmake @@ -0,0 +1,78 @@ +function (setPGI) + message("Setting PGI Compiler Flags") + set(COMPILER_TYPE "pgi" CACHE INTERNAL "Compiler brand") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set(CMAKE_Fortran_FLAGS_RELEASE "") + set(Fortran_FLAGS "" CACHE INTERNAL "") + set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -O3 -byteswapio -fast" CACHE INTERNAL "") + + set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + + set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") + set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_4_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -DLINUX -O1 -byteswapio " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 " CACHE INTERNAL "") + set(COV_CALC_FLAGS "-O3 -byteswapio -mp" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") + if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) + set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) + else() + set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) + endif() + else() + set(Fortran_FLAGS "" CACHE INTERNAL "") + set(GSI_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -traceback -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -g -traceback -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -g -traceback -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -g -traceback -byteswapio -fast" CACHE INTERNAL "") + + set(BUFR_Fortran_FLAGS "-g -traceback -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -traceback -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + + set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") + set(BACIO_Fortran_FLAGS " -g -traceback -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -traceback -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -g -traceback -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -g -traceback -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_4_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -DLINUX -g -traceback -D_REAL8_ -mp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -traceback " CACHE INTERNAL "") + set(COV_CALC_FLAGS "-O3 -byteswapio -traceback -mp" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") + if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) + set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) + else() + set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) + endif() + endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) +endfunction() diff --git a/cmake/Modules/setPlatformVariables.cmake b/cmake/Modules/setPlatformVariables.cmake new file mode 100644 index 0000000000..79408821a6 --- /dev/null +++ b/cmake/Modules/setPlatformVariables.cmake @@ -0,0 +1,11 @@ +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Jet.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-C.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/S4.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Hera.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Orion.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Gaea.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Cheyenne.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Discover.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-D.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Generic.cmake) diff --git a/src/enkf/CMakeCache.txt b/src/enkf/CMakeCache.txt deleted file mode 100644 index 36930e0d08..0000000000 --- a/src/enkf/CMakeCache.txt +++ /dev/null @@ -1,313 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//Path to a program. -CMAKE_AR:FILEPATH=/bin/ar - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler. -CMAKE_CXX_COMPILER:FILEPATH=/bin/c++ - -//Flags used by the compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler. -CMAKE_C_COMPILER:FILEPATH=/bin/cc - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Path to a program. -CMAKE_LINKER:FILEPATH=/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/bin/gmake - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=Project - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/bin/ranlib - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=/bin/strip - -//If true, cmake will use relative paths in makefiles and projects. -CMAKE_USE_RELATIVE_PATHS:BOOL=OFF - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Value Computed by CMake -Project_BINARY_DIR:STATIC=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf - -//Value Computed by CMake -Project_SOURCE_DIR:STATIC=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_BUILD_TOOL -CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1 -//What is the target build tool cmake is generating for. -CMAKE_BUILD_TOOL:INTERNAL=/bin/gmake -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=8 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=12 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Start directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/bin/uname -//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS -CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 - diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake deleted file mode 100644 index ed20818321..0000000000 --- a/src/enkf/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake +++ /dev/null @@ -1,56 +0,0 @@ -set(CMAKE_C_COMPILER "/bin/cc") -set(CMAKE_C_COMPILER_ARG1 "") -set(CMAKE_C_COMPILER_ID "GNU") -set(CMAKE_C_COMPILER_VERSION "4.8.5") -set(CMAKE_C_PLATFORM_ID "Linux") - -set(CMAKE_AR "/bin/ar") -set(CMAKE_RANLIB "/bin/ranlib") -set(CMAKE_LINKER "/bin/ld") -set(CMAKE_COMPILER_IS_GNUCC 1) -set(CMAKE_C_COMPILER_LOADED 1) -set(CMAKE_C_COMPILER_WORKS TRUE) -set(CMAKE_C_ABI_COMPILED TRUE) -set(CMAKE_COMPILER_IS_MINGW ) -set(CMAKE_COMPILER_IS_CYGWIN ) -if(CMAKE_COMPILER_IS_CYGWIN) - set(CYGWIN 1) - set(UNIX 1) -endif() - -set(CMAKE_C_COMPILER_ENV_VAR "CC") - -if(CMAKE_COMPILER_IS_MINGW) - set(MINGW 1) -endif() -set(CMAKE_C_COMPILER_ID_RUN 1) -set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) -set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_C_LINKER_PREFERENCE 10) - -# Save compiler ABI information. -set(CMAKE_C_SIZEOF_DATA_PTR "8") -set(CMAKE_C_COMPILER_ABI "ELF") -set(CMAKE_C_LIBRARY_ARCHITECTURE "") - -if(CMAKE_C_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_C_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") -endif() - -if(CMAKE_C_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "") -endif() - - - - -set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "c") -set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib") -set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") - - - diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake deleted file mode 100644 index 60f14de5e1..0000000000 --- a/src/enkf/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake +++ /dev/null @@ -1,57 +0,0 @@ -set(CMAKE_CXX_COMPILER "/bin/c++") -set(CMAKE_CXX_COMPILER_ARG1 "") -set(CMAKE_CXX_COMPILER_ID "GNU") -set(CMAKE_CXX_COMPILER_VERSION "4.8.5") -set(CMAKE_CXX_PLATFORM_ID "Linux") - -set(CMAKE_AR "/bin/ar") -set(CMAKE_RANLIB "/bin/ranlib") -set(CMAKE_LINKER "/bin/ld") -set(CMAKE_COMPILER_IS_GNUCXX 1) -set(CMAKE_CXX_COMPILER_LOADED 1) -set(CMAKE_CXX_COMPILER_WORKS TRUE) -set(CMAKE_CXX_ABI_COMPILED TRUE) -set(CMAKE_COMPILER_IS_MINGW ) -set(CMAKE_COMPILER_IS_CYGWIN ) -if(CMAKE_COMPILER_IS_CYGWIN) - set(CYGWIN 1) - set(UNIX 1) -endif() - -set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") - -if(CMAKE_COMPILER_IS_MINGW) - set(MINGW 1) -endif() -set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) -set(CMAKE_CXX_LINKER_PREFERENCE 30) -set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) - -# Save compiler ABI information. -set(CMAKE_CXX_SIZEOF_DATA_PTR "8") -set(CMAKE_CXX_COMPILER_ABI "ELF") -set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") - -if(CMAKE_CXX_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_CXX_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") -endif() - -if(CMAKE_CXX_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "") -endif() - - - - -set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;c") -set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib") -set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") - - - diff --git a/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake b/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake deleted file mode 100644 index 685c4bfe8f..0000000000 --- a/src/enkf/CMakeFiles/2.8.12.2/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Linux-3.10.0-957.1.3.el7.x86_64") -set(CMAKE_HOST_SYSTEM_NAME "Linux") -set(CMAKE_HOST_SYSTEM_VERSION "3.10.0-957.1.3.el7.x86_64") -set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") - - - -set(CMAKE_SYSTEM "Linux-3.10.0-957.1.3.el7.x86_64") -set(CMAKE_SYSTEM_NAME "Linux") -set(CMAKE_SYSTEM_VERSION "3.10.0-957.1.3.el7.x86_64") -set(CMAKE_SYSTEM_PROCESSOR "x86_64") - -set(CMAKE_CROSSCOMPILING "FALSE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c deleted file mode 100644 index cba81d4a6b..0000000000 --- a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c +++ /dev/null @@ -1,389 +0,0 @@ -#ifdef __cplusplus -# error "A C++ compiler has been selected for C." -#endif - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__18CXX) -# define ID_VOID_MAIN -#endif - -#if defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" - /* __INTEL_COMPILER = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_C = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) -# if defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" -# else -# if __IBMC__ >= 800 -# define COMPILER_ID "XL" -# else -# define COMPILER_ID "VisualAge" -# endif - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -/* Analog VisualDSP++ >= 4.5.6 */ -#elif defined(__VISUALDSPVERSION__) -# define COMPILER_ID "ADSP" - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) - -/* Analog VisualDSP++ < 4.5.6 */ -#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" - -/* IAR Systems compiler for embedded systems. - http://www.iar.com */ -#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" - -/* sdcc, the small devices C compiler for embedded systems, - http://sdcc.sourceforge.net */ -#elif defined(SDCC) -# define COMPILER_ID "SDCC" - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) - -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) -# define COMPILER_ID "MIPSpro" -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) -# endif - -/* This compiler is either not known or is too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__sgi) -# define COMPILER_ID "MIPSpro" - -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" - -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#else /* unknown platform */ -# define PLATFORM_ID "" - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM) -# define ARCHITECTURE_ID "ARM" - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID "" -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number components. */ -#ifdef COMPILER_VERSION_MAJOR -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -/*--------------------------------------------------------------------------*/ - -#ifdef ID_VOID_MAIN -void main() {} -#else -int main(int argc, char* argv[]) -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; - require += info_arch[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif - (void)argv; - return require; -} -#endif diff --git a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp b/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp deleted file mode 100644 index e8220b26e5..0000000000 --- a/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* This source file must have a .cpp extension so that all C++ compilers - recognize the extension without flags. Borland does not know .cxx for - example. */ -#ifndef __cplusplus -# error "A C compiler has been selected for C++." -#endif - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__COMO__) -# define COMPILER_ID "Comeau" - /* __COMO_VERSION__ = VRR */ -# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) - -#elif defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" - /* __INTEL_COMPILER = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) - -#elif defined(__SUNPRO_CC) -# define COMPILER_ID "SunPro" -# if __SUNPRO_CC >= 0x5100 - /* __SUNPRO_CC = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# endif - -#elif defined(__HP_aCC) -# define COMPILER_ID "HP" - /* __HP_aCC = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) - -#elif defined(__DECCXX) -# define COMPILER_ID "Compaq" - /* __DECCXX_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) - -#elif defined(__IBMCPP__) -# if defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" -# else -# if __IBMCPP__ >= 800 -# define COMPILER_ID "XL" -# else -# define COMPILER_ID "VisualAge" -# endif - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -/* Analog VisualDSP++ >= 4.5.6 */ -#elif defined(__VISUALDSPVERSION__) -# define COMPILER_ID "ADSP" - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) - -/* Analog VisualDSP++ < 4.5.6 */ -#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" - -/* IAR Systems compiler for embedded systems. - http://www.iar.com */ -#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" - -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) -# define COMPILER_ID "MIPSpro" -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) -# endif - -/* This compiler is either not known or is too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__sgi) -# define COMPILER_ID "MIPSpro" - -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" - -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#else /* unknown platform */ -# define PLATFORM_ID "" - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM) -# define ARCHITECTURE_ID "ARM" - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID "" -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number components. */ -#ifdef COMPILER_VERSION_MAJOR -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -/*--------------------------------------------------------------------------*/ - -int main(int argc, char* argv[]) -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif - (void)argv; - return require; -} diff --git a/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake b/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake deleted file mode 100644 index 64f2c3d9c5..0000000000 --- a/src/enkf/CMakeFiles/CMakeDirectoryInformation.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Relative path conversion top directories. -SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf") -SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf") - -# Force unix paths in dependencies. -SET(CMAKE_FORCE_UNIX_PATHS 1) - - -# The C and CXX include file regular expressions for this directory. -SET(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") -SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") -SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) -SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/src/enkf/CMakeFiles/CMakeOutput.log b/src/enkf/CMakeFiles/CMakeOutput.log deleted file mode 100644 index 3da7d94374..0000000000 --- a/src/enkf/CMakeFiles/CMakeOutput.log +++ /dev/null @@ -1,263 +0,0 @@ -The system is: Linux - 3.10.0-957.1.3.el7.x86_64 - x86_64 -Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. -Compiler: /bin/cc -Build flags: -Id flags: - -The output was: -0 - - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" - -The C compiler identification is GNU, found in "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/2.8.12.2/CompilerIdC/a.out" - -Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. -Compiler: /bin/c++ -Build flags: -Id flags: - -The output was: -0 - - -Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" - -The CXX compiler identification is GNU, found in "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/2.8.12.2/CompilerIdCXX/a.out" - -Determining if the C compiler works passed with the following output: -Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp - -Run Build Command:/bin/gmake "cmTryCompileExec1571880127/fast" -/bin/gmake -f CMakeFiles/cmTryCompileExec1571880127.dir/build.make CMakeFiles/cmTryCompileExec1571880127.dir/build -gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' -/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 -Building C object CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o -/bin/cc -o CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/testCCompiler.c -Linking C executable cmTryCompileExec1571880127 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1571880127.dir/link.txt --verbose=1 -/bin/cc CMakeFiles/cmTryCompileExec1571880127.dir/testCCompiler.c.o -o cmTryCompileExec1571880127 -rdynamic -gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' - - -Detecting C compiler ABI info compiled with the following output: -Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp - -Run Build Command:/bin/gmake "cmTryCompileExec3965901837/fast" -/bin/gmake -f CMakeFiles/cmTryCompileExec3965901837.dir/build.make CMakeFiles/cmTryCompileExec3965901837.dir/build -gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' -/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 -Building C object CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -/bin/cc -o CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c -Linking C executable cmTryCompileExec3965901837 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3965901837.dir/link.txt --verbose=1 -/bin/cc -v CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3965901837 -rdynamic -Using built-in specs. -COLLECT_GCC=/bin/cc -COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper -Target: x86_64-redhat-linux -Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux -Thread model: posix -gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) -COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3965901837' '-rdynamic' '-mtune=generic' '-march=x86-64' - /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3965901837 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o -gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' - - -Parsed C implicit link information from above output: - link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)] - ignore line: [Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp] - ignore line: [] - ignore line: [Run Build Command:/bin/gmake "cmTryCompileExec3965901837/fast"] - ignore line: [/bin/gmake -f CMakeFiles/cmTryCompileExec3965901837.dir/build.make CMakeFiles/cmTryCompileExec3965901837.dir/build] - ignore line: [gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp'] - ignore line: [/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1] - ignore line: [Building C object CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o] - ignore line: [/bin/cc -o CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c] - ignore line: [Linking C executable cmTryCompileExec3965901837] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3965901837.dir/link.txt --verbose=1] - ignore line: [/bin/cc -v CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3965901837 -rdynamic ] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/bin/cc] - ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper] - ignore line: [Target: x86_64-redhat-linux] - ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux] - ignore line: [Thread model: posix] - ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ] - ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3965901837' '-rdynamic' '-mtune=generic' '-march=x86-64'] - link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3965901837 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] - arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore - arg [--build-id] ==> ignore - arg [--no-add-needed] ==> ignore - arg [--eh-frame-hdr] ==> ignore - arg [--hash-style=gnu] ==> ignore - arg [-m] ==> ignore - arg [elf_x86_64] ==> ignore - arg [-export-dynamic] ==> ignore - arg [-dynamic-linker] ==> ignore - arg [/lib64/ld-linux-x86-64.so.2] ==> ignore - arg [-o] ==> ignore - arg [cmTryCompileExec3965901837] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] - arg [-L/lib/../lib64] ==> dir [/lib/../lib64] - arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] - arg [-L/apps/cairo/1.14.2/lib] ==> dir [/apps/cairo/1.14.2/lib] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] - arg [CMakeFiles/cmTryCompileExec3965901837.dir/CMakeCCompilerABI.c.o] ==> ignore - arg [-lgcc] ==> lib [gcc] - arg [--as-needed] ==> ignore - arg [-lgcc_s] ==> lib [gcc_s] - arg [--no-as-needed] ==> ignore - arg [-lc] ==> lib [c] - arg [-lgcc] ==> lib [gcc] - arg [--as-needed] ==> ignore - arg [-lgcc_s] ==> lib [gcc_s] - arg [--no-as-needed] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore - remove lib [gcc] - remove lib [gcc_s] - remove lib [gcc] - remove lib [gcc_s] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64] - collapse library dir [/lib/../lib64] ==> [/lib64] - collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] - collapse library dir [/apps/cairo/1.14.2/lib] ==> [/apps/cairo/1.14.2/lib] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib] - implicit libs: [c] - implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib] - implicit fwks: [] - - -Determining if the CXX compiler works passed with the following output: -Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp - -Run Build Command:/bin/gmake "cmTryCompileExec4106867847/fast" -/bin/gmake -f CMakeFiles/cmTryCompileExec4106867847.dir/build.make CMakeFiles/cmTryCompileExec4106867847.dir/build -gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' -/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 -Building CXX object CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o -/bin/c++ -o CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/testCXXCompiler.cxx -Linking CXX executable cmTryCompileExec4106867847 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4106867847.dir/link.txt --verbose=1 -/bin/c++ CMakeFiles/cmTryCompileExec4106867847.dir/testCXXCompiler.cxx.o -o cmTryCompileExec4106867847 -rdynamic -gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' - - -Detecting CXX compiler ABI info compiled with the following output: -Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp - -Run Build Command:/bin/gmake "cmTryCompileExec2000728824/fast" -/bin/gmake -f CMakeFiles/cmTryCompileExec2000728824.dir/build.make CMakeFiles/cmTryCompileExec2000728824.dir/build -gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' -/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1 -Building CXX object CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -/bin/c++ -o CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -Linking CXX executable cmTryCompileExec2000728824 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2000728824.dir/link.txt --verbose=1 -/bin/c++ -v CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec2000728824 -rdynamic -Using built-in specs. -COLLECT_GCC=/bin/c++ -COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper -Target: x86_64-redhat-linux -Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux -Thread model: posix -gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) -COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec2000728824' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64' - /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec2000728824 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o -gmake[1]: Leaving directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp' - - -Parsed CXX implicit link information from above output: - link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)] - ignore line: [Change Dir: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp] - ignore line: [] - ignore line: [Run Build Command:/bin/gmake "cmTryCompileExec2000728824/fast"] - ignore line: [/bin/gmake -f CMakeFiles/cmTryCompileExec2000728824.dir/build.make CMakeFiles/cmTryCompileExec2000728824.dir/build] - ignore line: [gmake[1]: Entering directory `/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp'] - ignore line: [/usr/bin/cmake -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/CMakeTmp/CMakeFiles 1] - ignore line: [Building CXX object CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o] - ignore line: [/bin/c++ -o CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp] - ignore line: [Linking CXX executable cmTryCompileExec2000728824] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2000728824.dir/link.txt --verbose=1] - ignore line: [/bin/c++ -v CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec2000728824 -rdynamic ] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/bin/c++] - ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper] - ignore line: [Target: x86_64-redhat-linux] - ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux] - ignore line: [Thread model: posix] - ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ] - ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/cairo/1.14.2/lib/:/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec2000728824' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] - link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec2000728824 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/apps/cairo/1.14.2/lib -L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 -L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] - arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore - arg [--build-id] ==> ignore - arg [--no-add-needed] ==> ignore - arg [--eh-frame-hdr] ==> ignore - arg [--hash-style=gnu] ==> ignore - arg [-m] ==> ignore - arg [elf_x86_64] ==> ignore - arg [-export-dynamic] ==> ignore - arg [-dynamic-linker] ==> ignore - arg [/lib64/ld-linux-x86-64.so.2] ==> ignore - arg [-o] ==> ignore - arg [cmTryCompileExec2000728824] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] - arg [-L/lib/../lib64] ==> dir [/lib/../lib64] - arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] - arg [-L/apps/cairo/1.14.2/lib] ==> dir [/apps/cairo/1.14.2/lib] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] - arg [-L/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] - arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] - arg [CMakeFiles/cmTryCompileExec2000728824.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore - arg [-lstdc++] ==> lib [stdc++] - arg [-lm] ==> lib [m] - arg [-lgcc_s] ==> lib [gcc_s] - arg [-lgcc] ==> lib [gcc] - arg [-lc] ==> lib [c] - arg [-lgcc_s] ==> lib [gcc_s] - arg [-lgcc] ==> lib [gcc] - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore - arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore - remove lib [gcc_s] - remove lib [gcc] - remove lib [gcc_s] - remove lib [gcc] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64] - collapse library dir [/lib/../lib64] ==> [/lib64] - collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] - collapse library dir [/apps/cairo/1.14.2/lib] ==> [/apps/cairo/1.14.2/lib] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] ==> [/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64] - collapse library dir [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] ==> [/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4] - collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib] - implicit libs: [stdc++;m;c] - implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/apps/cairo/1.14.2/lib;/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64;/apps/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4;/usr/lib] - implicit fwks: [] - - diff --git a/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake b/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake deleted file mode 100644 index ec70177280..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# The set of languages for which implicit dependencies are needed: -SET(CMAKE_DEPENDS_LANGUAGES - "Fortran" - ) -# The set of files for implicit dependencies of each language: -SET(CMAKE_DEPENDS_CHECK_Fortran - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" - ) -SET(CMAKE_Fortran_COMPILER_ID "Intel") - -# Targets to which this target links. -SET(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") - -# The include file search paths: -SET(CMAKE_C_TARGET_INCLUDE_PATH - "/apps/intel/impi/5.1.2.150/intel64/include" - "." - "include" - "src/enkf" - "include/wrf" - "include/global" - "src/enkf/.." - "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" - "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" - "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" - "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" - "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" - "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" - "/apps/netcdf/4.3.0-intel/include" - "libsrc/ncdiag/include" - ) -SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/MODS1.dir/build.make b/src/enkf/CMakeFiles/MODS1.dir/build.make deleted file mode 100644 index 9e57937cd0..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/build.make +++ /dev/null @@ -1,88 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# Include any dependencies generated for this target. -include src/enkf/CMakeFiles/MODS1.dir/depend.make - -# Include the progress variables for this target. -include src/enkf/CMakeFiles/MODS1.dir/progress.make - -# Include the compile flags for this target's objects. -include src/enkf/CMakeFiles/MODS1.dir/flags.make - -src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/MODS1.dir/flags.make -src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o - -src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires - -src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/MODS1.dir/build.make src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides - -src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o - -MODS1: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o -MODS1: src/enkf/CMakeFiles/MODS1.dir/build.make -.PHONY : MODS1 - -# Rule to build all files generated by this target. -src/enkf/CMakeFiles/MODS1.dir/build: MODS1 -.PHONY : src/enkf/CMakeFiles/MODS1.dir/build - -src/enkf/CMakeFiles/MODS1.dir/requires: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o.requires -.PHONY : src/enkf/CMakeFiles/MODS1.dir/requires - -src/enkf/CMakeFiles/MODS1.dir/clean: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/MODS1.dir/cmake_clean.cmake -.PHONY : src/enkf/CMakeFiles/MODS1.dir/clean - -src/enkf/CMakeFiles/MODS1.dir/depend: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/DependInfo.cmake --color=$(COLOR) -.PHONY : src/enkf/CMakeFiles/MODS1.dir/depend - diff --git a/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake deleted file mode 100644 index a21c5e1c17..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/cmake_clean.cmake +++ /dev/null @@ -1,8 +0,0 @@ -FILE(REMOVE_RECURSE - "CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" -) - -# Per-language clean rules from dependency scanning. -FOREACH(lang Fortran) - INCLUDE(CMakeFiles/MODS1.dir/cmake_clean_${lang}.cmake OPTIONAL) -ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/MODS1.dir/depend.make b/src/enkf/CMakeFiles/MODS1.dir/depend.make deleted file mode 100644 index 9c43adee43..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for MODS1. -# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/MODS1.dir/flags.make b/src/enkf/CMakeFiles/MODS1.dir/flags.make deleted file mode 100644 index 0594feea72..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort -Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include - -Fortran_DEFINES = - -# Custom flags: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - diff --git a/src/enkf/CMakeFiles/MODS1.dir/progress.make b/src/enkf/CMakeFiles/MODS1.dir/progress.make deleted file mode 100644 index 225de343d6..0000000000 --- a/src/enkf/CMakeFiles/MODS1.dir/progress.make +++ /dev/null @@ -1,2 +0,0 @@ -CMAKE_PROGRESS_1 = - diff --git a/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake b/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake deleted file mode 100644 index 897b7f7a83..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# The set of languages for which implicit dependencies are needed: -SET(CMAKE_DEPENDS_LANGUAGES - "Fortran" - ) -# The set of files for implicit dependencies of each language: -SET(CMAKE_DEPENDS_CHECK_Fortran - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" - ) -SET(CMAKE_Fortran_COMPILER_ID "Intel") - -# Targets to which this target links. -SET(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") - -# The include file search paths: -SET(CMAKE_C_TARGET_INCLUDE_PATH - "/apps/intel/impi/5.1.2.150/intel64/include" - "." - "include" - "src/enkf" - "include/wrf" - "include/global" - "src/enkf/.." - "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" - "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" - "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" - "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" - "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" - "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" - "/apps/netcdf/4.3.0-intel/include" - "libsrc/ncdiag/include" - ) -SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/MODS2.dir/build.make b/src/enkf/CMakeFiles/MODS2.dir/build.make deleted file mode 100644 index 016e3c9209..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/build.make +++ /dev/null @@ -1,88 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# Include any dependencies generated for this target. -include src/enkf/CMakeFiles/MODS2.dir/depend.make - -# Include the progress variables for this target. -include src/enkf/CMakeFiles/MODS2.dir/progress.make - -# Include the compile flags for this target's objects. -include src/enkf/CMakeFiles/MODS2.dir/flags.make - -src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/MODS2.dir/flags.make -src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/MODS2.dir/gridio_gfs.f90.o - -src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires - -src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/MODS2.dir/build.make src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides - -src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o - -MODS2: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o -MODS2: src/enkf/CMakeFiles/MODS2.dir/build.make -.PHONY : MODS2 - -# Rule to build all files generated by this target. -src/enkf/CMakeFiles/MODS2.dir/build: MODS2 -.PHONY : src/enkf/CMakeFiles/MODS2.dir/build - -src/enkf/CMakeFiles/MODS2.dir/requires: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o.requires -.PHONY : src/enkf/CMakeFiles/MODS2.dir/requires - -src/enkf/CMakeFiles/MODS2.dir/clean: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/MODS2.dir/cmake_clean.cmake -.PHONY : src/enkf/CMakeFiles/MODS2.dir/clean - -src/enkf/CMakeFiles/MODS2.dir/depend: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/DependInfo.cmake --color=$(COLOR) -.PHONY : src/enkf/CMakeFiles/MODS2.dir/depend - diff --git a/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake deleted file mode 100644 index 6bc72f60cd..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/cmake_clean.cmake +++ /dev/null @@ -1,8 +0,0 @@ -FILE(REMOVE_RECURSE - "CMakeFiles/MODS2.dir/gridio_gfs.f90.o" -) - -# Per-language clean rules from dependency scanning. -FOREACH(lang Fortran) - INCLUDE(CMakeFiles/MODS2.dir/cmake_clean_${lang}.cmake OPTIONAL) -ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/MODS2.dir/depend.make b/src/enkf/CMakeFiles/MODS2.dir/depend.make deleted file mode 100644 index e58aed43c9..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for MODS2. -# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/MODS2.dir/flags.make b/src/enkf/CMakeFiles/MODS2.dir/flags.make deleted file mode 100644 index ad6c937ff4..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort -Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include - -Fortran_DEFINES = - -# Custom flags: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - diff --git a/src/enkf/CMakeFiles/MODS2.dir/progress.make b/src/enkf/CMakeFiles/MODS2.dir/progress.make deleted file mode 100644 index 225de343d6..0000000000 --- a/src/enkf/CMakeFiles/MODS2.dir/progress.make +++ /dev/null @@ -1,2 +0,0 @@ -CMAKE_PROGRESS_1 = - diff --git a/src/enkf/CMakeFiles/Makefile.cmake b/src/enkf/CMakeFiles/Makefile.cmake deleted file mode 100644 index deb5929463..0000000000 --- a/src/enkf/CMakeFiles/Makefile.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# The generator used is: -SET(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") - -# The top level Makefile was generated from the following files: -SET(CMAKE_MAKEFILE_DEPENDS - "CMakeCache.txt" - "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" - "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" - "CMakeFiles/2.8.12.2/CMakeSystem.cmake" - "CMakeLists.txt" - "/usr/share/cmake/Modules/CMakeCCompiler.cmake.in" - "/usr/share/cmake/Modules/CMakeCCompilerABI.c" - "/usr/share/cmake/Modules/CMakeCInformation.cmake" - "/usr/share/cmake/Modules/CMakeCXXCompiler.cmake.in" - "/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp" - "/usr/share/cmake/Modules/CMakeCXXInformation.cmake" - "/usr/share/cmake/Modules/CMakeClDeps.cmake" - "/usr/share/cmake/Modules/CMakeCommonLanguageInclude.cmake" - "/usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake" - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake" - "/usr/share/cmake/Modules/CMakeDetermineCompiler.cmake" - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake" - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake" - "/usr/share/cmake/Modules/CMakeDetermineSystem.cmake" - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake" - "/usr/share/cmake/Modules/CMakeGenericSystem.cmake" - "/usr/share/cmake/Modules/CMakeParseImplicitLinkInfo.cmake" - "/usr/share/cmake/Modules/CMakeSystem.cmake.in" - "/usr/share/cmake/Modules/CMakeSystemSpecificInformation.cmake" - "/usr/share/cmake/Modules/CMakeTestCCompiler.cmake" - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake" - "/usr/share/cmake/Modules/CMakeTestCompilerCommon.cmake" - "/usr/share/cmake/Modules/CMakeUnixFindMake.cmake" - "/usr/share/cmake/Modules/Compiler/GNU-C.cmake" - "/usr/share/cmake/Modules/Compiler/GNU-CXX.cmake" - "/usr/share/cmake/Modules/Compiler/GNU.cmake" - "/usr/share/cmake/Modules/Platform/Linux-CXX.cmake" - "/usr/share/cmake/Modules/Platform/Linux-GNU-C.cmake" - "/usr/share/cmake/Modules/Platform/Linux-GNU-CXX.cmake" - "/usr/share/cmake/Modules/Platform/Linux-GNU.cmake" - "/usr/share/cmake/Modules/Platform/Linux.cmake" - "/usr/share/cmake/Modules/Platform/UnixPaths.cmake" - ) - -# The corresponding makefile is: -SET(CMAKE_MAKEFILE_OUTPUTS - "Makefile" - "CMakeFiles/cmake.check_cache" - ) - -# Byproducts of CMake generate step: -SET(CMAKE_MAKEFILE_PRODUCTS - "CMakeFiles/2.8.12.2/CMakeSystem.cmake" - "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" - "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" - "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" - "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" - "CMakeFiles/CMakeDirectoryInformation.cmake" - ) - -# Dependency information for all targets: -SET(CMAKE_DEPEND_INFO_FILES - ) diff --git a/src/enkf/CMakeFiles/Makefile2 b/src/enkf/CMakeFiles/Makefile2 deleted file mode 100644 index 4ea910d716..0000000000 --- a/src/enkf/CMakeFiles/Makefile2 +++ /dev/null @@ -1,67 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -# The main recursive all target -all: -.PHONY : all - -# The main recursive preinstall target -preinstall: -.PHONY : preinstall - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/src/enkf/CMakeFiles/TargetDirectories.txt b/src/enkf/CMakeFiles/TargetDirectories.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/enkf/CMakeFiles/cmake.check_cache b/src/enkf/CMakeFiles/cmake.check_cache deleted file mode 100644 index 3dccd73172..0000000000 --- a/src/enkf/CMakeFiles/cmake.check_cache +++ /dev/null @@ -1 +0,0 @@ -# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake deleted file mode 100644 index cdb6d3e346..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# The set of languages for which implicit dependencies are needed: -SET(CMAKE_DEPENDS_LANGUAGES - "Fortran" - ) -# The set of files for implicit dependencies of each language: -SET(CMAKE_DEPENDS_CHECK_Fortran - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" - ) -SET(CMAKE_Fortran_COMPILER_ID "Intel") - -# Targets to which this target links. -SET(CMAKE_TARGET_LINKED_INFO_FILES - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/CMakeFiles/gsilib_shrd.dir/DependInfo.cmake" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/CMakeFiles/gsilib_wrf.dir/DependInfo.cmake" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/CMakeFiles/ncdiag.dir/DependInfo.cmake" - ) - -# Fortran module output directory. -SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") - -# The include file search paths: -SET(CMAKE_C_TARGET_INCLUDE_PATH - "/apps/intel/impi/5.1.2.150/intel64/include" - "." - "include" - "src/enkf" - "include/wrf" - "include/global" - "src/enkf/.." - "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" - "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" - "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" - "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" - "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" - "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" - "/apps/netcdf/4.3.0-intel/include" - "libsrc/ncdiag/include" - ) -SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make deleted file mode 100644 index e73fb39b83..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make +++ /dev/null @@ -1,167 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# Include any dependencies generated for this target. -include src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make - -# Include the progress variables for this target. -include src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make - -# Include the compile flags for this target's objects. -include src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make - -src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o: src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make -src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o: src/enkf/enkf_main.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90 -o CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o - -src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires - -src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides - -src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.provides.build: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o - -# Object files for target enkf_gfs.x -enkf_gfs_x_OBJECTS = \ -"CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" - -# External object files for target enkf_gfs.x -enkf_gfs_x_EXTERNAL_OBJECTS = - -bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o -bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/build.make -bin/enkf_gfs.x: lib/libenkflib.a -bin/enkf_gfs.x: lib/libenkfdeplib.a -bin/enkf_gfs.x: lib/libgsilib_shrd.a -bin/enkf_gfs.x: lib/libgsilib_wrf.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a -bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a -bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a -bin/enkf_gfs.x: /usr/lib64/libdl.so -bin/enkf_gfs.x: /usr/lib64/librt.so -bin/enkf_gfs.x: /usr/lib64/libpthread.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_gf_lp64.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_lp64.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_thread.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_core.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so -bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so -bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdf.so -bin/enkf_gfs.x: /usr/lib64/libcurl.so -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a -bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a -bin/enkf_gfs.x: /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a -bin/enkf_gfs.x: /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a -bin/enkf_gfs.x: lib/libncdiag.a -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so -bin/enkf_gfs.x: /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a -bin/enkf_gfs.x: /usr/lib64/libdl.so -bin/enkf_gfs.x: /usr/lib64/librt.so -bin/enkf_gfs.x: /usr/lib64/libpthread.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_gf_lp64.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_lp64.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_intel_thread.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_core.so -bin/enkf_gfs.x: /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdff.so -bin/enkf_gfs.x: /apps/netcdf/4.3.0-intel/lib/libnetcdf.so -bin/enkf_gfs.x: /usr/lib64/libcurl.so -bin/enkf_gfs.x: src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran executable ../../bin/enkf_gfs.x" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkf_gfs.x.dir/link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -src/enkf/CMakeFiles/enkf_gfs.x.dir/build: bin/enkf_gfs.x -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/build - -src/enkf/CMakeFiles/enkf_gfs.x.dir/requires: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o.requires -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/requires - -src/enkf/CMakeFiles/enkf_gfs.x.dir/clean: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/clean - -src/enkf/CMakeFiles/enkf_gfs.x.dir/depend: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkf_gfs.x.dir/DependInfo.cmake --color=$(COLOR) -.PHONY : src/enkf/CMakeFiles/enkf_gfs.x.dir/depend - diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake deleted file mode 100644 index acdd21a5d8..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/cmake_clean.cmake +++ /dev/null @@ -1,10 +0,0 @@ -FILE(REMOVE_RECURSE - "CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o" - "../../bin/enkf_gfs.x.pdb" - "../../bin/enkf_gfs.x" -) - -# Per-language clean rules from dependency scanning. -FOREACH(lang Fortran) - INCLUDE(CMakeFiles/enkf_gfs.x.dir/cmake_clean_${lang}.cmake OPTIONAL) -ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make deleted file mode 100644 index 62030144f3..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for enkf_gfs.x. -# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make deleted file mode 100644 index 91ed503c5a..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort -Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include - -Fortran_DEFINES = - -# Custom flags: src/enkf/CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt b/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt deleted file mode 100644 index cdded996f7..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/link.txt +++ /dev/null @@ -1 +0,0 @@ -/apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort CMakeFiles/enkf_gfs.x.dir/enkf_main.f90.o -o ../../bin/enkf_gfs.x -L/apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so -L/apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so -L/apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a -L/usr/lib64/libdl.so -L/usr/lib64/librt.so -L/usr/lib64/libpthread.so -L/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/lib -i_dynamic ../../lib/libenkflib.a ../../lib/libenkfdeplib.a ../../lib/libgsilib_shrd.a ../../lib/libgsilib_wrf.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a /usr/lib64/libdl.so /usr/lib64/librt.so -lpthread -lmkl_gf_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -lpthread -lm /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdf.so -mkl /usr/lib64/libcurl.so /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a /scratch3/NCEPDEV/nwprod/lib/bacio/v2.0.1/libbacio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/bufr/v10.2.5/libbufr_v10.2.5_d_64.a /scratch3/NCEPDEV/nwprod/lib/sigio/v2.0.1/libsigio_v2.0.1_4.a /scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/libnemsio_v2.2.1.a /scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/libcrtm_v2.2.3.a /scratch3/NCEPDEV/nwprod/lib/sp/v2.0.2/libsp_v2.0.2_d.a /scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/libsfcio_v1.0.0_4.a /scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/libw3emc_v2.0.5_d.a /scratch3/NCEPDEV/nwprod/lib/w3nco/v2.0.6/libw3nco_v2.0.6_d.a ../../lib/libncdiag.a /apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so /apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so /apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a /usr/lib64/libdl.so /usr/lib64/librt.so -lpthread -lmkl_gf_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core /apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libiomp5.so -lpthread -lm /apps/netcdf/4.3.0-intel/lib/libnetcdff.so /apps/netcdf/4.3.0-intel/lib/libnetcdf.so /usr/lib64/libcurl.so -lirng -ldecimal -lcilkrts -lstdc++ -lirc -Wl,-rpath,/apps/intel/impi/5.1.2.150/intel64/lib/libmpifort.so:/apps/intel/impi/5.1.2.150/intel64/lib/release_mt/libmpi.so:/apps/intel/impi/5.1.2.150/intel64/lib/libmpigi.a:/usr/lib64/libdl.so:/usr/lib64/librt.so:/usr/lib64/libpthread.so:/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/lib:/apps/intel/impi/5.1.2.150/intel64/lib:/apps/intel/impi/5.1.2.150/intel64/lib/release_mt:/apps/netcdf/4.3.0-intel/lib diff --git a/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make b/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make deleted file mode 100644 index 225de343d6..0000000000 --- a/src/enkf/CMakeFiles/enkf_gfs.x.dir/progress.make +++ /dev/null @@ -1,2 +0,0 @@ -CMAKE_PROGRESS_1 = - diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake deleted file mode 100644 index 265a143fb9..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# The set of languages for which implicit dependencies are needed: -SET(CMAKE_DEPENDS_LANGUAGES - "Fortran" - ) -# The set of files for implicit dependencies of each language: -SET(CMAKE_DEPENDS_CHECK_Fortran - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/controlvec.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/covlocal.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obsmod.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/expand_ens.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/fftpack.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/genqsat1.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/kdtree2.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpi_readobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpisetup.F90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/netcdf_io_wrf.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/observer_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/params.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readconvobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readozobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readsatobs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/reducedgrid.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/rnorm.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/sorting.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/specmod.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/statevec.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/write_logfile.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" - ) -SET(CMAKE_Fortran_COMPILER_ID "Intel") - -# Targets to which this target links. -SET(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") - -# The include file search paths: -SET(CMAKE_C_TARGET_INCLUDE_PATH - "/apps/intel/impi/5.1.2.150/intel64/include" - "." - "include" - "src/enkf" - "include/wrf" - "include/global" - "src/enkf/.." - "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" - "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" - "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" - "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" - "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" - "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" - "/apps/netcdf/4.3.0-intel/include" - "libsrc/ncdiag/include" - ) -SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/build.make b/src/enkf/CMakeFiles/enkfdeplib.dir/build.make deleted file mode 100644 index 17844fb803..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/build.make +++ /dev/null @@ -1,494 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# Include any dependencies generated for this target. -include src/enkf/CMakeFiles/enkfdeplib.dir/depend.make - -# Include the progress variables for this target. -include src/enkf/CMakeFiles/enkfdeplib.dir/progress.make - -# Include the compile flags for this target's objects. -include src/enkf/CMakeFiles/enkfdeplib.dir/flags.make - -src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o: src/enkf/netcdf_io_wrf.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/netcdf_io_wrf.f90 -o CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o: src/enkf/params.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_2) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/params.f90 -o CMakeFiles/enkfdeplib.dir/params.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o: src/enkf/covlocal.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_3) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/covlocal.f90 -o CMakeFiles/enkfdeplib.dir/covlocal.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o: src/enkf/fftpack.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_4) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/fftpack.f90 -o CMakeFiles/enkfdeplib.dir/fftpack.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o: src/enkf/genqsat1.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_5) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/genqsat1.f90 -o CMakeFiles/enkfdeplib.dir/genqsat1.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o: src/enkf/mpisetup.F90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_6) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpisetup.F90 -o CMakeFiles/enkfdeplib.dir/mpisetup.F90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o: src/enkf/rnorm.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_7) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/rnorm.f90 -o CMakeFiles/enkfdeplib.dir/rnorm.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o: src/enkf/sorting.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_8) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/sorting.f90 -o CMakeFiles/enkfdeplib.dir/sorting.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o: src/enkf/specmod.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_9) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/specmod.f90 -o CMakeFiles/enkfdeplib.dir/specmod.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o: src/enkf/reducedgrid.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_10) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/reducedgrid.f90 -o CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o: src/enkf/readozobs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_11) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readozobs.f90 -o CMakeFiles/enkfdeplib.dir/readozobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o: src/enkf/readsatobs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_12) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readsatobs.f90 -o CMakeFiles/enkfdeplib.dir/readsatobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o: src/enkf/readconvobs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_13) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/readconvobs.f90 -o CMakeFiles/enkfdeplib.dir/readconvobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o: src/enkf/write_logfile.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_14) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/write_logfile.f90 -o CMakeFiles/enkfdeplib.dir/write_logfile.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o: src/enkf/kdtree2.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_15) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/kdtree2.f90 -o CMakeFiles/enkfdeplib.dir/kdtree2.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o: src/enkf/mpi_readobs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_16) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/mpi_readobs.f90 -o CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o: src/enkf/enkf_obsmod.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_17) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obsmod.f90 -o CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o: src/enkf/statevec.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_18) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/statevec.f90 -o CMakeFiles/enkfdeplib.dir/statevec.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o: src/enkf/controlvec.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_19) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/controlvec.f90 -o CMakeFiles/enkfdeplib.dir/controlvec.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o: src/enkf/observer_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_20) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/observer_gfs.f90 -o CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_21) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_22) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o: src/enkf/CMakeFiles/enkfdeplib.dir/flags.make -src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o: src/enkf/expand_ens.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_23) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/expand_ens.f90 -o CMakeFiles/enkfdeplib.dir/expand_ens.f90.o - -src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires - -src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkfdeplib.dir/build.make src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides - -src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.provides.build: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o - -# Object files for target enkfdeplib -enkfdeplib_OBJECTS = \ -"CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" \ -"CMakeFiles/enkfdeplib.dir/params.f90.o" \ -"CMakeFiles/enkfdeplib.dir/covlocal.f90.o" \ -"CMakeFiles/enkfdeplib.dir/fftpack.f90.o" \ -"CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" \ -"CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" \ -"CMakeFiles/enkfdeplib.dir/rnorm.f90.o" \ -"CMakeFiles/enkfdeplib.dir/sorting.f90.o" \ -"CMakeFiles/enkfdeplib.dir/specmod.f90.o" \ -"CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" \ -"CMakeFiles/enkfdeplib.dir/readozobs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" \ -"CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" \ -"CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" \ -"CMakeFiles/enkfdeplib.dir/statevec.f90.o" \ -"CMakeFiles/enkfdeplib.dir/controlvec.f90.o" \ -"CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" \ -"CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" - -# External object files for target enkfdeplib -enkfdeplib_EXTERNAL_OBJECTS = - -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/build.make -lib/libenkfdeplib.a: src/enkf/CMakeFiles/enkfdeplib.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran static library ../../lib/libenkfdeplib.a" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkfdeplib.dir/link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -src/enkf/CMakeFiles/enkfdeplib.dir/build: lib/libenkfdeplib.a -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/build - -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o.requires -src/enkf/CMakeFiles/enkfdeplib.dir/requires: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o.requires -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/requires - -src/enkf/CMakeFiles/enkfdeplib.dir/clean: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkfdeplib.dir/cmake_clean.cmake -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/clean - -src/enkf/CMakeFiles/enkfdeplib.dir/depend: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkfdeplib.dir/DependInfo.cmake --color=$(COLOR) -.PHONY : src/enkf/CMakeFiles/enkfdeplib.dir/depend - diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake deleted file mode 100644 index d2c33159c1..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean.cmake +++ /dev/null @@ -1,32 +0,0 @@ -FILE(REMOVE_RECURSE - "CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o" - "CMakeFiles/enkfdeplib.dir/params.f90.o" - "CMakeFiles/enkfdeplib.dir/covlocal.f90.o" - "CMakeFiles/enkfdeplib.dir/fftpack.f90.o" - "CMakeFiles/enkfdeplib.dir/genqsat1.f90.o" - "CMakeFiles/enkfdeplib.dir/mpisetup.F90.o" - "CMakeFiles/enkfdeplib.dir/rnorm.f90.o" - "CMakeFiles/enkfdeplib.dir/sorting.f90.o" - "CMakeFiles/enkfdeplib.dir/specmod.f90.o" - "CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o" - "CMakeFiles/enkfdeplib.dir/readozobs.f90.o" - "CMakeFiles/enkfdeplib.dir/readsatobs.f90.o" - "CMakeFiles/enkfdeplib.dir/readconvobs.f90.o" - "CMakeFiles/enkfdeplib.dir/write_logfile.f90.o" - "CMakeFiles/enkfdeplib.dir/kdtree2.f90.o" - "CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o" - "CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o" - "CMakeFiles/enkfdeplib.dir/statevec.f90.o" - "CMakeFiles/enkfdeplib.dir/controlvec.f90.o" - "CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o" - "CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o" - "CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o" - "CMakeFiles/enkfdeplib.dir/expand_ens.f90.o" - "../../lib/libenkfdeplib.pdb" - "../../lib/libenkfdeplib.a" -) - -# Per-language clean rules from dependency scanning. -FOREACH(lang Fortran) - INCLUDE(CMakeFiles/enkfdeplib.dir/cmake_clean_${lang}.cmake OPTIONAL) -ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake b/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake deleted file mode 100644 index 1103891c94..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/cmake_clean_target.cmake +++ /dev/null @@ -1,3 +0,0 @@ -FILE(REMOVE_RECURSE - "../../lib/libenkfdeplib.a" -) diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make b/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make deleted file mode 100644 index 4ce2736bc1..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for enkfdeplib. -# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make b/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make deleted file mode 100644 index 167f6cb0c9..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/flags.make +++ /dev/null @@ -1,54 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort -Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include - -Fortran_DEFINES = - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/params.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/covlocal.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/fftpack.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/genqsat1.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/mpisetup.F90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/rnorm.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/sorting.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/specmod.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readozobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readsatobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/readconvobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/write_logfile.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/kdtree2.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/statevec.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/controlvec.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkfdeplib.dir/expand_ens.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt b/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt deleted file mode 100644 index 8caf201fee..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/link.txt +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ar cr ../../lib/libenkfdeplib.a CMakeFiles/enkfdeplib.dir/netcdf_io_wrf.f90.o CMakeFiles/enkfdeplib.dir/params.f90.o CMakeFiles/enkfdeplib.dir/covlocal.f90.o CMakeFiles/enkfdeplib.dir/fftpack.f90.o CMakeFiles/enkfdeplib.dir/genqsat1.f90.o CMakeFiles/enkfdeplib.dir/mpisetup.F90.o CMakeFiles/enkfdeplib.dir/rnorm.f90.o CMakeFiles/enkfdeplib.dir/sorting.f90.o CMakeFiles/enkfdeplib.dir/specmod.f90.o CMakeFiles/enkfdeplib.dir/reducedgrid.f90.o CMakeFiles/enkfdeplib.dir/readozobs.f90.o CMakeFiles/enkfdeplib.dir/readsatobs.f90.o CMakeFiles/enkfdeplib.dir/readconvobs.f90.o CMakeFiles/enkfdeplib.dir/write_logfile.f90.o CMakeFiles/enkfdeplib.dir/kdtree2.f90.o CMakeFiles/enkfdeplib.dir/mpi_readobs.f90.o CMakeFiles/enkfdeplib.dir/enkf_obsmod.f90.o CMakeFiles/enkfdeplib.dir/statevec.f90.o CMakeFiles/enkfdeplib.dir/controlvec.f90.o CMakeFiles/enkfdeplib.dir/observer_gfs.f90.o CMakeFiles/enkfdeplib.dir/gridio_gfs.f90.o CMakeFiles/enkfdeplib.dir/gridinfo_gfs.f90.o CMakeFiles/enkfdeplib.dir/expand_ens.f90.o -/bin/ranlib ../../lib/libenkfdeplib.a diff --git a/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make b/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make deleted file mode 100644 index 388520a19f..0000000000 --- a/src/enkf/CMakeFiles/enkfdeplib.dir/progress.make +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_PROGRESS_1 = -CMAKE_PROGRESS_2 = -CMAKE_PROGRESS_3 = -CMAKE_PROGRESS_4 = 2 -CMAKE_PROGRESS_5 = -CMAKE_PROGRESS_6 = -CMAKE_PROGRESS_7 = -CMAKE_PROGRESS_8 = -CMAKE_PROGRESS_9 = -CMAKE_PROGRESS_10 = -CMAKE_PROGRESS_11 = 3 -CMAKE_PROGRESS_12 = -CMAKE_PROGRESS_13 = -CMAKE_PROGRESS_14 = -CMAKE_PROGRESS_15 = -CMAKE_PROGRESS_16 = -CMAKE_PROGRESS_17 = 4 -CMAKE_PROGRESS_18 = -CMAKE_PROGRESS_19 = -CMAKE_PROGRESS_20 = -CMAKE_PROGRESS_21 = -CMAKE_PROGRESS_22 = -CMAKE_PROGRESS_23 = 5 - diff --git a/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake b/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake deleted file mode 100644 index d194c62ae4..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# The set of languages for which implicit dependencies are needed: -SET(CMAKE_DEPENDS_LANGUAGES - "Fortran" - ) -# The set of files for implicit dependencies of each language: -SET(CMAKE_DEPENDS_CHECK_Fortran - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obs_sensitivity.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/inflation.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/innovstats.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/letkf.F90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/loadbal.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/quicksort.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/radbias.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/read_locinfo.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o" - "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/smooth_gfs.f90" "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o" - ) -SET(CMAKE_Fortran_COMPILER_ID "Intel") - -# Targets to which this target links. -SET(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -SET(CMAKE_Fortran_TARGET_MODULE_DIR "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include") - -# The include file search paths: -SET(CMAKE_C_TARGET_INCLUDE_PATH - "/apps/intel/impi/5.1.2.150/intel64/include" - "." - "include" - "src/enkf" - "include/wrf" - "include/global" - "src/enkf/.." - "/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0" - "/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc" - "/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1" - "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3" - "/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4" - "/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d" - "/apps/netcdf/4.3.0-intel/include" - "libsrc/ncdiag/include" - ) -SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) -SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) diff --git a/src/enkf/CMakeFiles/enkflib.dir/build.make b/src/enkf/CMakeFiles/enkflib.dir/build.make deleted file mode 100644 index fe4aee8f12..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/build.make +++ /dev/null @@ -1,318 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI - -# Include any dependencies generated for this target. -include src/enkf/CMakeFiles/enkflib.dir/depend.make - -# Include the progress variables for this target. -include src/enkf/CMakeFiles/enkflib.dir/progress.make - -# Include the compile flags for this target's objects. -include src/enkf/CMakeFiles/enkflib.dir/flags.make - -src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o: src/enkf/innovstats.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_1) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/innovstats.f90 -o CMakeFiles/enkflib.dir/innovstats.f90.o - -src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o: src/enkf/enkf.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_2) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf.f90 -o CMakeFiles/enkflib.dir/enkf.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o - -src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o: src/enkf/read_locinfo.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_3) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/read_locinfo.f90 -o CMakeFiles/enkflib.dir/read_locinfo.f90.o - -src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o: src/enkf/enkf_main.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_4) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_main.f90 -o CMakeFiles/enkflib.dir/enkf_main.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o - -src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o: src/enkf/inflation.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_5) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/inflation.f90 -o CMakeFiles/enkflib.dir/inflation.f90.o - -src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o - -src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o: src/enkf/letkf.F90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_6) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/letkf.F90 -o CMakeFiles/enkflib.dir/letkf.F90.o - -src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o - -src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o: src/enkf/quicksort.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_7) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/quicksort.f90 -o CMakeFiles/enkflib.dir/quicksort.f90.o - -src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o - -src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o: src/enkf/radbias.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_8) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/radbias.f90 -o CMakeFiles/enkflib.dir/radbias.f90.o - -src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o - -src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o: src/enkf/loadbal.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_9) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/loadbal.f90 -o CMakeFiles/enkflib.dir/loadbal.f90.o - -src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o - -src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o: src/enkf/smooth_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_10) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/smooth_gfs.f90 -o CMakeFiles/enkflib.dir/smooth_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o: src/enkf/gridio_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_11) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridio_gfs.f90 -o CMakeFiles/enkflib.dir/gridio_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o: src/enkf/gridinfo_gfs.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_12) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/gridinfo_gfs.f90 -o CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o: src/enkf/CMakeFiles/enkflib.dir/flags.make -src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o: src/enkf/enkf_obs_sensitivity.f90 - $(CMAKE_COMMAND) -E cmake_progress_report /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/CMakeFiles $(CMAKE_PROGRESS_13) - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building Fortran object src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort $(Fortran_DEFINES) $(Fortran_FLAGS) -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp -c /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/enkf_obs_sensitivity.f90 -o CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o - -src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires: -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires - -src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires - $(MAKE) -f src/enkf/CMakeFiles/enkflib.dir/build.make src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides.build -.PHONY : src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides - -src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.provides.build: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o - -# Object files for target enkflib -enkflib_OBJECTS = \ -"CMakeFiles/enkflib.dir/innovstats.f90.o" \ -"CMakeFiles/enkflib.dir/enkf.f90.o" \ -"CMakeFiles/enkflib.dir/read_locinfo.f90.o" \ -"CMakeFiles/enkflib.dir/enkf_main.f90.o" \ -"CMakeFiles/enkflib.dir/inflation.f90.o" \ -"CMakeFiles/enkflib.dir/letkf.F90.o" \ -"CMakeFiles/enkflib.dir/quicksort.f90.o" \ -"CMakeFiles/enkflib.dir/radbias.f90.o" \ -"CMakeFiles/enkflib.dir/loadbal.f90.o" \ -"CMakeFiles/enkflib.dir/smooth_gfs.f90.o" \ -"CMakeFiles/enkflib.dir/gridio_gfs.f90.o" \ -"CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" \ -"CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" - -# External object files for target enkflib -enkflib_EXTERNAL_OBJECTS = \ -"/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o" \ -"/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o" - -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/MODS2.dir/gridio_gfs.f90.o -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/build.make -lib/libenkflib.a: src/enkf/CMakeFiles/enkflib.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking Fortran static library ../../lib/libenkflib.a" - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkflib.dir/cmake_clean_target.cmake - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/enkflib.dir/link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -src/enkf/CMakeFiles/enkflib.dir/build: lib/libenkflib.a -.PHONY : src/enkf/CMakeFiles/enkflib.dir/build - -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o.requires -src/enkf/CMakeFiles/enkflib.dir/requires: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o.requires -.PHONY : src/enkf/CMakeFiles/enkflib.dir/requires - -src/enkf/CMakeFiles/enkflib.dir/clean: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf && $(CMAKE_COMMAND) -P CMakeFiles/enkflib.dir/cmake_clean.cmake -.PHONY : src/enkf/CMakeFiles/enkflib.dir/clean - -src/enkf/CMakeFiles/enkflib.dir/depend: - cd /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/CMakeFiles/enkflib.dir/DependInfo.cmake --color=$(COLOR) -.PHONY : src/enkf/CMakeFiles/enkflib.dir/depend - diff --git a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake deleted file mode 100644 index cb5d14a003..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean.cmake +++ /dev/null @@ -1,22 +0,0 @@ -FILE(REMOVE_RECURSE - "CMakeFiles/enkflib.dir/innovstats.f90.o" - "CMakeFiles/enkflib.dir/enkf.f90.o" - "CMakeFiles/enkflib.dir/read_locinfo.f90.o" - "CMakeFiles/enkflib.dir/enkf_main.f90.o" - "CMakeFiles/enkflib.dir/inflation.f90.o" - "CMakeFiles/enkflib.dir/letkf.F90.o" - "CMakeFiles/enkflib.dir/quicksort.f90.o" - "CMakeFiles/enkflib.dir/radbias.f90.o" - "CMakeFiles/enkflib.dir/loadbal.f90.o" - "CMakeFiles/enkflib.dir/smooth_gfs.f90.o" - "CMakeFiles/enkflib.dir/gridio_gfs.f90.o" - "CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o" - "CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o" - "../../lib/libenkflib.pdb" - "../../lib/libenkflib.a" -) - -# Per-language clean rules from dependency scanning. -FOREACH(lang Fortran) - INCLUDE(CMakeFiles/enkflib.dir/cmake_clean_${lang}.cmake OPTIONAL) -ENDFOREACH(lang) diff --git a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake b/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake deleted file mode 100644 index 41610b20bb..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/cmake_clean_target.cmake +++ /dev/null @@ -1,3 +0,0 @@ -FILE(REMOVE_RECURSE - "../../lib/libenkflib.a" -) diff --git a/src/enkf/CMakeFiles/enkflib.dir/depend.make b/src/enkf/CMakeFiles/enkflib.dir/depend.make deleted file mode 100644 index 8fc584e226..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for enkflib. -# This may be replaced when dependencies are built. diff --git a/src/enkf/CMakeFiles/enkflib.dir/flags.make b/src/enkf/CMakeFiles/enkflib.dir/flags.make deleted file mode 100644 index 49ecff3f58..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/flags.make +++ /dev/null @@ -1,34 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# compile Fortran with /apps/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort -Fortran_FLAGS = -module ../../include -I/apps/intel/impi/5.1.2.150/intel64/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/. -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/wrf -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/include/global -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/.. -I/apps/intel/impi/5.1.2.150/intel64/include/gfortran/4.8.0 -I/scratch3/NCEPDEV/nwprod/lib/sorc/sigio_v2.0.1/libsrc -I/scratch3/NCEPDEV/nwprod/lib/nemsio/v2.2.1/incmod/nemsio_v2.2.1 -I/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm/2.2.3/incmod/crtm_v2.2.3 -I/scratch3/NCEPDEV/nwprod/lib/sfcio/v1.0.0/incmod/sfcio_v1.0.0_4 -I/scratch3/NCEPDEV/nwprod/lib/w3emc/v2.0.5/incmod/w3emc_v2.0.5_d -I/apps/netcdf/4.3.0-intel/include -I/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/libsrc/ncdiag/include - -Fortran_DEFINES = - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/innovstats.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/read_locinfo.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf_main.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/inflation.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/letkf.F90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/quicksort.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/radbias.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/loadbal.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/smooth_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/gridio_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - -# Custom flags: src/enkf/CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o_FLAGS = -O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ -DMPI3 -openmp - diff --git a/src/enkf/CMakeFiles/enkflib.dir/link.txt b/src/enkf/CMakeFiles/enkflib.dir/link.txt deleted file mode 100644 index 72fa31aab2..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/link.txt +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ar cr ../../lib/libenkflib.a CMakeFiles/enkflib.dir/innovstats.f90.o CMakeFiles/enkflib.dir/enkf.f90.o CMakeFiles/enkflib.dir/read_locinfo.f90.o CMakeFiles/enkflib.dir/enkf_main.f90.o CMakeFiles/enkflib.dir/inflation.f90.o CMakeFiles/enkflib.dir/letkf.F90.o CMakeFiles/enkflib.dir/quicksort.f90.o CMakeFiles/enkflib.dir/radbias.f90.o CMakeFiles/enkflib.dir/loadbal.f90.o CMakeFiles/enkflib.dir/smooth_gfs.f90.o CMakeFiles/enkflib.dir/gridio_gfs.f90.o CMakeFiles/enkflib.dir/gridinfo_gfs.f90.o CMakeFiles/enkflib.dir/enkf_obs_sensitivity.f90.o CMakeFiles/MODS1.dir/gridinfo_gfs.f90.o CMakeFiles/MODS2.dir/gridio_gfs.f90.o -/bin/ranlib ../../lib/libenkflib.a diff --git a/src/enkf/CMakeFiles/enkflib.dir/progress.make b/src/enkf/CMakeFiles/enkflib.dir/progress.make deleted file mode 100644 index 6d05e974fe..0000000000 --- a/src/enkf/CMakeFiles/enkflib.dir/progress.make +++ /dev/null @@ -1,14 +0,0 @@ -CMAKE_PROGRESS_1 = -CMAKE_PROGRESS_2 = -CMAKE_PROGRESS_3 = -CMAKE_PROGRESS_4 = -CMAKE_PROGRESS_5 = -CMAKE_PROGRESS_6 = -CMAKE_PROGRESS_7 = 6 -CMAKE_PROGRESS_8 = -CMAKE_PROGRESS_9 = -CMAKE_PROGRESS_10 = -CMAKE_PROGRESS_11 = -CMAKE_PROGRESS_12 = -CMAKE_PROGRESS_13 = 7 - diff --git a/src/enkf/CMakeFiles/progress.marks b/src/enkf/CMakeFiles/progress.marks deleted file mode 100644 index 573541ac97..0000000000 --- a/src/enkf/CMakeFiles/progress.marks +++ /dev/null @@ -1 +0,0 @@ -0 From de65128ca84ff6820269e747ac0185258ce85959 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Thu, 19 Nov 2020 20:00:38 +0000 Subject: [PATCH 055/155] some cleaning --- src/enkf/CTestTestfile.cmake | 6 ----- src/enkf/cmake_install.cmake | 44 ------------------------------------ src/enkf/d0 | 1 - src/enkf/d2 | 1 - src/enkf/dd0 | 17 -------------- 5 files changed, 69 deletions(-) delete mode 100644 src/enkf/CTestTestfile.cmake delete mode 100644 src/enkf/cmake_install.cmake delete mode 100644 src/enkf/d0 delete mode 100644 src/enkf/d2 delete mode 100644 src/enkf/dd0 diff --git a/src/enkf/CTestTestfile.cmake b/src/enkf/CTestTestfile.cmake deleted file mode 100644 index 1594bddb50..0000000000 --- a/src/enkf/CTestTestfile.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# CMake generated Testfile for -# Source directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -# Build directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf -# -# This file includes the relevant testing commands required for -# testing this directory and lists subdirectories to be tested as well. diff --git a/src/enkf/cmake_install.cmake b/src/enkf/cmake_install.cmake deleted file mode 100644 index beb89d8da4..0000000000 --- a/src/enkf/cmake_install.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Install script for directory: /scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf - -# Set the install prefix -IF(NOT DEFINED CMAKE_INSTALL_PREFIX) - SET(CMAKE_INSTALL_PREFIX "/usr/local") -ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) -STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - -# Set the install configuration name. -IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) - IF(BUILD_TYPE) - STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" "" - CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") - ELSE(BUILD_TYPE) - SET(CMAKE_INSTALL_CONFIG_NAME "") - ENDIF(BUILD_TYPE) - MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") -ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) - -# Set the component getting installed. -IF(NOT CMAKE_INSTALL_COMPONENT) - IF(COMPONENT) - MESSAGE(STATUS "Install component: \"${COMPONENT}\"") - SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}") - ELSE(COMPONENT) - SET(CMAKE_INSTALL_COMPONENT) - ENDIF(COMPONENT) -ENDIF(NOT CMAKE_INSTALL_COMPONENT) - -# Install shared libraries without execute permission? -IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) - SET(CMAKE_INSTALL_SO_NO_EXE "0") -ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) - -IF(CMAKE_INSTALL_COMPONENT) - SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") -ELSE(CMAKE_INSTALL_COMPONENT) - SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt") -ENDIF(CMAKE_INSTALL_COMPONENT) - -FILE(WRITE "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/${CMAKE_INSTALL_MANIFEST}" "") -FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES}) - FILE(APPEND "/scratch4/NCEPDEV/fv3-cam/save/Ting.Lei/dr-CAM/dr-witaker/ProdGSI/src/enkf/${CMAKE_INSTALL_MANIFEST}" "${file}\n") -ENDFOREACH(file) diff --git a/src/enkf/d0 b/src/enkf/d0 deleted file mode 100644 index 7168ca31f8..0000000000 --- a/src/enkf/d0 +++ /dev/null @@ -1 +0,0 @@ - use gridio,only: ak,bk,eta1_ll,eta2_ll,ptop diff --git a/src/enkf/d2 b/src/enkf/d2 deleted file mode 100644 index 9c9086d736..0000000000 --- a/src/enkf/d2 +++ /dev/null @@ -1 +0,0 @@ -integer(i_kind) file_id,var_id,dim_id,nlevsp1,nx_tile,ny_tile,ntile diff --git a/src/enkf/dd0 b/src/enkf/dd0 deleted file mode 100644 index 850fd1b6e9..0000000000 --- a/src/enkf/dd0 +++ /dev/null @@ -1,17 +0,0 @@ - if (u_ind > 0) then - varstrname = 'u' - - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(u_ind-1)+k,nb) - enddo - enddo - enddo - workvar3d=workvar3d+workinc3d - call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) - - endif From f19368dc03e9f5a3d048da71d2d3b7a94ede78b9 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Thu, 19 Nov 2020 20:12:47 +0000 Subject: [PATCH 056/155] merging with EMC GSI master --- src/enkf/write_fv3regional_restarts.f90 | 67 ------------------- src/gsi/read_l2bufr_mod.f90 | 7 +- .../jobs/JGDAS_ATMOS_VERFOZN | 10 +++ 3 files changed, 11 insertions(+), 73 deletions(-) delete mode 100644 src/enkf/write_fv3regional_restarts.f90 diff --git a/src/enkf/write_fv3regional_restarts.f90 b/src/enkf/write_fv3regional_restarts.f90 deleted file mode 100644 index c5e13d9009..0000000000 --- a/src/enkf/write_fv3regional_restarts.f90 +++ /dev/null @@ -1,67 +0,0 @@ - module write_fv3regional_restarts -!clt modified from write_fv3_restarts.f90 - -! ifort -I${NETCDF}/include -O2 -traceback write_fv3_restarts.f90 kinds.o -! netcdf_mod.o -L/${NETCDF}/lib -lnetcdf -lnetcdff - -! read data from FV3 restart files. - - - use kinds, only: i_kind,r_single,r_kind - use netcdf, only: nf90_open,nf90_close,nf90_put_var,nf90_noerr - use netcdf, only: nf90_inq_dimid,nf90_inq_varid - use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension - use netcdf_mod, only: nc_check - public write_fv3_restart_data1d,write_fv3_restart_data2d - public write_fv3_restart_data3d,write_fv3_restart_data4d - - contains - - subroutine write_fv3_restart_data1d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:) :: data_arr - character(len=24),parameter :: myname_ = 'write_fv3_restart_data1d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1) - include "write_fv3_restart_data.f90" - end subroutine write_fv3_restart_data1d - - subroutine write_fv3_restart_data2d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:) :: data_arr - character(len=24),parameter :: myname_ = 'write_fv3_restart_data2d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1) - include "write_fv3_restart_data.f90" - end subroutine write_fv3_restart_data2d - - subroutine write_fv3_restart_data3d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'write_fv3_restart_data3d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1) - include "write_fv3_restart_data.f90" - end subroutine write_fv3_restart_data3d - - subroutine write_fv3_restart_data4d(varname,filename,file_id,data_arr) - real(r_single), intent(inout), dimension(:,:,:,:) :: data_arr - character(len=24),parameter :: myname_ = 'write_fv3_restart_data4d' - character(len=*), intent(in) :: varname - character(len=*), intent(in) :: filename - integer(i_kind), intent(in) :: file_id - integer(i_kind) :: var_id - data_arr=data_arr(ubound(data_arr,1):lbound(data_arr,1):-1,ubound(data_arr,2):lbound(data_arr,2):-1, & - ubound(data_arr,3):lbound(data_arr,3):-1,lbound(data_arr,4):ubound(data_arr,4)) -!Notice, the 4th dimension is not reversed - include "write_fv3_restart_data.f90" - end subroutine write_fv3_restart_data4d - - end module write_fv3regional_restarts diff --git a/src/gsi/read_l2bufr_mod.f90 b/src/gsi/read_l2bufr_mod.f90 index 57a102b20e..a124b75d3d 100644 --- a/src/gsi/read_l2bufr_mod.f90 +++ b/src/gsi/read_l2bufr_mod.f90 @@ -20,6 +20,7 @@ module read_l2bufr_mod ! 2009-11-24 parrish change time variable from regional_time (passed from gridmod) to ! iadate (passed from obsmod), to prevent all radar data being tossed. ! 2011-07-04 todling - fixes to run either single or double precision +! 2020-10-23 S.Liu - fix reading l2rw_bufr issue ! 2020-10-14 xu/sippel - Add options to superob the GRO ! ! subroutines included: @@ -302,12 +303,6 @@ subroutine radar_bufr_read_all(npe,mype) ! Open bufr file with openbf to initialize bufr table, etc in bufrlib inbufr=10 open(inbufr,file=infile,form='unformatted') - read(inbufr,iostat=iret)subset - if(iret/=0) then - if(rite) write(6,*)'RADAR_BUFR_READ_ALL: problem opening level 2 bufr file "l2rwbufr"' - close(inbufr) - return - end if rewind inbufr lundx=inbufr call openbf(inbufr,'IN',lundx) diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_ATMOS_VERFOZN b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_ATMOS_VERFOZN index 13f71e21b1..8fb52314f6 100755 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_ATMOS_VERFOZN +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_ATMOS_VERFOZN @@ -34,6 +34,14 @@ export pgmerr=errfile export cycle=t${cyc}z +############################################## +# Run setpdy and initialize PDY variables +############################################## +if [[ $MY_MACHINE != "HERA" && $MY_MACHINE != "hera" ]]; then + setpdy.sh + . ./PDY +fi + #---------------------------------- # Set up the UTILITIES # @@ -44,6 +52,7 @@ export utilexec=${utilexec:-${UTILROOT}/exec} #--------------------------------------------- # Specify Execution Areas # +export HOMEgfs_ozn=${HOMEgfs:-${NWROOT}/gfs.$gfs_ver} export HOMEgdas_ozn=${HOMEgfs_ozn:-${NWROOT}/gfs.$gfs_ver} export PARMgdas_ozn=${PARMgfs_ozn:-$HOMEgfs_ozn/parm/mon} export SCRgdas_ozn=${SCRgfs_ozn:-$HOMEgfs_ozn/scripts} @@ -76,6 +85,7 @@ export p_cyc=`echo ${cdate} | cut -c9-10` # OZN_TANKDIR - WHERE OUTPUT DATA WILL RESIDE # echo "pre-assignment, OZN_TANKDIR = $OZN_TANKDIR" +export OZN_TANKDIR=${COMROOT}/$NET/$envir export TANKverf_ozn=${TANKverf_ozn:-${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/$COMPONENT/oznmon} export TANKverf_oznM1=${TANKverf_oznM1:-${OZN_TANKDIR}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/oznmon} export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} From 9b3fbc8940af217efa6ec8d32c89b7c984027ce4 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Thu, 19 Nov 2020 20:18:13 +0000 Subject: [PATCH 057/155] some cleaning for git --- src/enkf/test.dot | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/enkf/test.dot diff --git a/src/enkf/test.dot b/src/enkf/test.dot deleted file mode 100644 index f4f3033161..0000000000 --- a/src/enkf/test.dot +++ /dev/null @@ -1,5 +0,0 @@ -digraph GG { -node [ - fontsize = "12" -]; -} From a605f9f20a48d8ead2167a2b8e27c43dd6b5e326 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Thu, 19 Nov 2020 18:26:07 -0600 Subject: [PATCH 058/155] Update the fix submodule. --- .gitmodules | 2 -- fix | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index cd366203c3..9eac6ee698 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,6 @@ [submodule "fix"] path = fix url = gerrit:GSI-fix - branch = master [submodule "libsrc"] path = libsrc url = gerrit:GSI-libsrc - branch = master diff --git a/fix b/fix index e47bcf18cc..82c9a46fab 160000 --- a/fix +++ b/fix @@ -1 +1 @@ -Subproject commit e47bcf18cc9cab37a1f3ccc198b8e6bab578c9b9 +Subproject commit 82c9a46fabd8d04686589241c36381ab17810cfd From 53432d1cb16f0f4128267972eb52bfb2610883d8 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Sat, 12 Dec 2020 20:12:15 -0500 Subject: [PATCH 059/155] FGAT related changes for FV3 regional DA (#2) From Xu Lu and Xuguang Wang (OU): Add the FGAT capability for FV3 regional DA. POC: xuguang.wang@ou.edu --- src/gsi/fv3_regional_interface.f90 | 4 +- src/gsi/gsi_rfv3io_mod.f90 | 118 ++++++++++++++++++++--------- src/gsi/read_guess.F90 | 27 ++++++- src/gsi/write_all.F90 | 8 +- 4 files changed, 114 insertions(+), 43 deletions(-) diff --git a/src/gsi/fv3_regional_interface.f90 b/src/gsi/fv3_regional_interface.f90 index fccd8bff45..d47bcd0c81 100644 --- a/src/gsi/fv3_regional_interface.f90 +++ b/src/gsi/fv3_regional_interface.f90 @@ -18,7 +18,7 @@ subroutine convert_fv3_regional ! 2017-04-08 parrish ! 2018-02-16 wu - read in grid and time infor from fv3 files ! read directly from fv3 files and not writeout GSI internal file -! +! 2020-11-19 Lu & Wang - add time label it for fgat. POC: xuguang.wang@ou.edu ! ! attributes: ! language: f90 @@ -37,7 +37,7 @@ subroutine convert_fv3_regional !!!!!!!!!!! get grid specs !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! grid_spec='fv3_grid_spec' ! horizontal grid information ak_bk='fv3_akbk' ! vertical grid information - call bg_fv3regfilenameg%init(grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') + call bg_fv3regfilenameg%init(6,grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') call gsi_rfv3io_get_grid_specs(bg_fv3regfilenameg,ierr) if(ierr/=0)then write(6,*)' problem in convert_fv3_regional - get_grid_specs Status = ',ierr diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 02953dd946..8d834fa6b1 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -12,6 +12,7 @@ module gsi_rfv3io_mod ! 2017-10-10 wu - setup A grid and interpolation coeff in generate_anl_grid ! 2018-02-22 wu - add subroutines for read/write fv3_ncdf ! 2019 ting - modifications for use for ensemble IO and cold start files +! 2020-11-19 Lu & Wang - add time label it for fgat. POC: xuguang.wang@ou.edu ! subroutines included: ! sub gsi_rfv3io_get_grid_specs ! sub read_fv3_files @@ -100,47 +101,62 @@ module gsi_rfv3io_mod n2d=11 ) contains - subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & + subroutine fv3regfilename_init(this,it,grid_spec_input,ak_bk_input,dynvars_input, & tracers_input,sfcdata_input,couplerres_input) implicit None class(type_fv3regfilenameg),intent(inout):: this character(*),optional :: grid_spec_input,ak_bk_input,dynvars_input, & tracers_input,sfcdata_input,couplerres_input + integer,intent(in) :: it + character(255):: filename if(present(grid_spec_input))then - this%grid_spec=grid_spec_input - else + else if (it.eq.6) then this%grid_spec='fv3_grid_spec' + else + write(filename,"(A14,I2.2)") 'fv3_grid_spec_',(it) + this%grid_spec=trim(filename) endif if(present(ak_bk_input))then this%ak_bk=ak_bk_input - else + else if (it.eq.6) then this%ak_bk='fv3_ak_bk' + else + write(filename,"(A10,I2.2)") 'fv3_ak_bk_',(it) + this%ak_bk=trim(filename) endif if(present(dynvars_input))then - this%dynvars=dynvars_input - else + else if (it.eq.6) then this%dynvars='fv3_dynvars' + else + write(filename,"(A12,I2.2)") 'fv3_dynvars_',(it) + this%dynvars=trim(filename) endif if(present(tracers_input))then - this%tracers=tracers_input - else + else if (it.eq.6) then this%tracers='fv3_tracer' + else + write(filename,"(A11,I2.2)") 'fv3_tracer_',(it) + this%tracers=trim(filename) endif if(present(sfcdata_input))then - this%sfcdata=sfcdata_input - else + else if (it.eq.6) then this%sfcdata='fv3_sfcdata' + else + write(filename,"(A12,I2.2)") 'fv3_sfcdata_',(it) + this%sfcdata=trim(filename) endif if(present(couplerres_input))then - this%couplerres=couplerres_input - else + else if (it.eq.6) then this%couplerres='coupler.res' + else + write(filename,"(A12,I2.2)") 'coupler.res_',(it) + this%couplerres=trim(filename) endif end subroutine fv3regfilename_init @@ -496,12 +512,15 @@ subroutine read_fv3_files(mype) ! Declare local variables logical(4) fexist character(6) filename + character(14) filenames integer(i_kind) in_unit integer(i_kind) i,j,iwan,npem1 integer(i_kind) nhr_half integer(i_kind) nminanl,nmings,nming2,ndiff,isecond integer(i_kind),dimension(4):: idateg integer(i_kind),dimension(5):: idate5 + character*1 :: datein(4),dateout(4) + integer(i_kind) datecc real(r_kind) hourg,temp,t4dv real(r_kind),dimension(202,2):: time_ges @@ -528,14 +547,26 @@ subroutine read_fv3_files(mype) in_unit=15 iwan=0 !WWWWWW setup for one first guess file for now -! do i=0,9 !place holder for FGAT - i=3 + do i=0,99 !place holder for FGAT + if (i.eq.6) then + write(filenames,"(A11)") 'fv3_dynvars' + else + write(filenames,"(A12,I2.2)") 'fv3_dynvars_',i + endif + INQUIRE(FILE=filenames, EXIST=fexist) + if(.not.fexist) cycle !wwww read in from the external file directly, no internal files sigfxx for FV3 - idate5(1)= regional_time(1) - idate5(2)= regional_time(2) - idate5(3)= regional_time(3) - idate5(4)= regional_time(4) + datecc=regional_time(1)/100 + datein(1)=char(regional_time(1)-datecc*100) + datein(2)=char(regional_time(2)) + datein(3)=char(regional_time(3)) + datein(4)=char(regional_time(4)) + call w3fs15(datein,(i-6),dateout) + idate5(1)=ichar(dateout(1))+datecc*100 + idate5(2)=ichar(dateout(2)) + idate5(3)=ichar(dateout(3)) + idate5(4)=ichar(dateout(4)) idate5(5)= regional_time(5) isecond = regional_time(6) hourg = zero ! forcast hour @@ -547,20 +578,20 @@ subroutine read_fv3_files(mype) if (l4dvar.or.l4densvar) then if (t4dvwinlen) then write(6,*)'ges file not in time range, t4dv=',t4dv -! cycle ! place holder for FGAT + cycle ! place holder for FGAT endif else ndiff=nming2-nminanl !for test with the 3 hr files with FGAT if(abs(ndiff) > 60*nhr_half ) then write(6,*)'ges file not in time range, ndiff=',ndiff -! cycle ! place holder for FGAT + cycle ! place holder for FGAT endif endif iwan=iwan+1 time_ges(iwan,1) =real((nming2-iwinbgn),r_kind)*r60inv time_ges(iwan+100,1)=i+r0_001 -! end do ! i !place holder for FGAT + end do ! i !place holder for FGAT time_ges(201,1)=one time_ges(202,1)=one if(iwan > 1)then @@ -583,12 +614,23 @@ subroutine read_fv3_files(mype) ! Check for consistency of times from surface guess files. iwan=0 do i=0,99 - write(filename,200)i - 200 format('sfcf',i2.2) - inquire(file=filename,exist=fexist) + if (i.eq.6) then + write(filenames,"(A11)") 'fv3_sfcdata' + else + write(filenames,"(A12,I2.2)") 'fv3_sfcdata_',i + endif + INQUIRE(FILE=filenames, EXIST=fexist) if(fexist)then - idateg(4)=iadate(1); idateg(2)=iadate(2) - idateg(3)=iadate(3); idateg(1)=iadate(4) + datecc=iadate(1)/100 + datein(1)=char(iadate(1)-datecc*100) + datein(2)=char(iadate(2)) + datein(3)=char(iadate(3)) + datein(4)=char(iadate(4)) + call w3fs15(datein,(i-6),dateout) + idateg(1)=ichar(dateout(1))+datecc*100 + idateg(2)=ichar(dateout(2)) + idateg(3)=ichar(dateout(3)) + idateg(4)=ichar(dateout(4)) hourg = zero idate5(1)=idateg(4); idate5(2)=idateg(2) idate5(3)=idateg(3); idate5(4)=idateg(1); idate5(5)=0 @@ -598,7 +640,7 @@ subroutine read_fv3_files(mype) ndiff=nming2-nminanl if(abs(ndiff) > 60*nhr_half ) then write(6,*)'ges file not in time range, ndiff=',ndiff -! cycle ! place holder for FGAT + cycle ! place holder for FGAT endif iwan=iwan+1 time_ges(iwan,2) =real((nming2-iwinbgn),r_kind)*r60inv @@ -691,7 +733,7 @@ subroutine read_fv3_files(mype) return end subroutine read_fv3_files -subroutine read_fv3_netcdf_guess(fv3filenamegin) +subroutine read_fv3_netcdf_guess(fv3filenamegin,it) !$$$ subprogram documentation block ! . . . . ! subprogram: read_fv3_netcdf_guess read fv3 interface file @@ -712,14 +754,15 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) use gsi_metguess_mod, only: gsi_metguess_bundle use gsi_bundlemod, only: gsi_bundlegetpointer use mpeu_util, only: die - use guess_grids, only: ntguessig + use guess_grids, only: ntguessig,nfldsig implicit none type (type_fv3regfilenameg),intent (in) :: fv3filenamegin + integer(i_kind),intent (in) :: it character(len=24),parameter :: myname = 'read_fv3_netcdf_guess' integer(i_kind) k,i,j - integer(i_kind) it,ier,istatus + integer(i_kind) ier,istatus real(r_kind),dimension(:,:),pointer::ges_ps=>NULL() real(r_kind),dimension(:,:),pointer::ges_z=>NULL() real(r_kind),dimension(:,:,:),pointer::ges_u=>NULL() @@ -749,8 +792,14 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) mype_oz=6 mype_2d=7 - allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) - allocate(displss(npe),displss2d(npe),displsz_g(npe) ) +! allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) +! allocate(displss(npe),displss2d(npe),displsz_g(npe) ) + if (.not.allocated(ijns)) allocate(ijns(npe)) + if (.not.allocated(ijns2d)) allocate(ijns2d(npe)) + if (.not.allocated(ijnz)) allocate(ijnz(npe)) + if (.not.allocated(displss)) allocate(displss(npe)) + if (.not.allocated(displss2d)) allocate(displss2d(npe)) + if (.not.allocated(displsz_g)) allocate(displsz_g(npe)) do i=1,npe ijns(i)=ijn_s(i)*nsig @@ -767,7 +816,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) enddo ! do it=1,nfldsig - it=ntguessig +! it=ntguessig ier=0 @@ -793,7 +842,8 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) endif if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi,mype_p) +! call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi,mype_p) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi(:,:,:,it),mype_p) ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) do i=nsig,1,-1 ges_prsi(:,:,i,it)=ges_prsi(:,:,i,it)*0.001_r_kind+ges_prsi(:,:,i+1,it) diff --git a/src/gsi/read_guess.F90 b/src/gsi/read_guess.F90 index 608bfc56e8..af33c145a9 100644 --- a/src/gsi/read_guess.F90 +++ b/src/gsi/read_guess.F90 @@ -75,7 +75,7 @@ subroutine read_guess(iyear,month,idd,mype) ! 2017-10-10 Wu W - add code for FV3 netcdf guess input ! 2019-09-18 martin - added new fields to save guess tsen, q, geop_hgt for writing increment ! 2019-09-23 martin - add code for FV3 GFS netcdf guess input -! +! 2020-11-19 Lu & Wang - modify file read for fgat, POC: xuguang.wang@ou.edu ! input argument list: ! mype - mpi task id ! @@ -90,7 +90,7 @@ subroutine read_guess(iyear,month,idd,mype) use kinds, only: r_kind,i_kind use jfunc, only: bcoption,clip_supersaturation use guess_grids, only: nfldsig,ges_tsen,load_prsges,load_geop_hgt,ges_prsl,& - ges_tsen1, geop_hgti, ges_geopi, ges_q1 + ges_tsen1,geop_hgti,ges_geopi,ges_q1,ifilesig,nfldsfc,ntguessig use m_gsiBiases,only : bkg_bias_correction,nbc use m_gsiBiases, only: gsi_bkgbias_bundle use gsi_bias, only: read_bias @@ -128,6 +128,7 @@ subroutine read_guess(iyear,month,idd,mype) logical :: ice integer(i_kind) i,j,k,it,iret_bias,ier,istatus integer(i_kind) iderivative + logical :: file_exists type(read_wrf_nmm_guess_class) :: nmm_binary_guess type(read_wrf_mass_guess_class) :: nmm_mass_guess @@ -164,8 +165,26 @@ subroutine read_guess(iyear,month,idd,mype) else if (nems_nmmb_regional) then call nmm_binary_guess%read_nems_nmmb_guess(mype) else if (fv3_regional ) then - call bg_fv3regfilenameg%init - call read_fv3_netcdf_guess(bg_fv3regfilenameg) + do it=1,nfldsig + if (it.eq.ntguessig) then + write(filename,"(A11)") 'fv3_sfcdata' + INQUIRE(FILE=filename, EXIST=file_exists) + if(.not.file_exists) then + if(mype.eq.0) write(6,*)' file ',trim(filename),' not exists!' + cycle + endif + else + write(filename,"(A12,I2.2)") 'fv3_sfcdata_',ifilesig(it) + INQUIRE(FILE=filename, EXIST=file_exists) + if(.not.file_exists) then + if (mype.eq.0) write(6,*)' file ',trim(filename),' not exists for FGAT!' + cycle + endif + endif + if (mype.eq.0) print *,filename,"file read in for first guess",nfldsig + call bg_fv3regfilenameg%init(ifilesig(it)) + call read_fv3_netcdf_guess(bg_fv3regfilenameg,it) + end do else if (cmaq_regional) then call read_cmaq_guess(mype) end if diff --git a/src/gsi/write_all.F90 b/src/gsi/write_all.F90 index 89483251d7..94d0b574e9 100644 --- a/src/gsi/write_all.F90 +++ b/src/gsi/write_all.F90 @@ -22,7 +22,7 @@ subroutine write_all(increment) use gridmod, only: regional,fv3_regional - use guess_grids, only: ntguessig + use guess_grids, only: ntguessig,ifilesig use m_gsiBiases, only: gsi_bkgbias_bundle use m_gsibiases ,only: nbc @@ -42,7 +42,6 @@ subroutine write_all(increment) use mpeu_util, only: die use control_vectors, only: control_vector - implicit none ! !INPUT PARAMETERS: @@ -96,6 +95,7 @@ subroutine write_all(increment) ! 2013-10-19 todling - metguess holds ges fields now ! 2014-10-05 todling - background biases now held in bundle ! 2017-10-10 Wu W - add FV3 option for regional output +! 2020-11-19 Lu & Wang - modify output filename option for fgat. POC: xuguang.wang@ou.edu ! ! !REMARKS: ! @@ -112,6 +112,7 @@ subroutine write_all(increment) integer(i_kind) mype_atm,mype_bias,mype_sfc,iret_bias,ier real(r_kind),dimension(:,:),pointer::ges_z=>NULL() type(regional_io_class) :: io + logical :: file_exists #ifndef HAVE_ESMF !******************************************************************** @@ -120,7 +121,8 @@ subroutine write_all(increment) ! Regional output if (regional) then if (fv3_regional) then - call wrfv3_netcdf(bg_fv3regfilenameg) + call bg_fv3regfilenameg%init(ifilesig(ntguessig)) + call wrfv3_netcdf(bg_fv3regfilenameg) else call io%write_regional_analysis(mype) endif From 0a46bfdad12f43e0221c4452142891e30bd4d752 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Tue, 12 Jan 2021 14:57:22 -0600 Subject: [PATCH 060/155] Add the driver script ush/build_enkf_cmake.sh to build enkf_fv3reg.x. --- ush/build_enkf_cmake.sh | 97 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 ush/build_enkf_cmake.sh diff --git a/ush/build_enkf_cmake.sh b/ush/build_enkf_cmake.sh new file mode 100755 index 0000000000..d25fa09742 --- /dev/null +++ b/ush/build_enkf_cmake.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +set -ex + +cd .. +pwd=$(pwd) + +build_type=${1:-'PRODUCTION'} +dir_root=${2:-$pwd} + +if [[ -d /dcom && -d /hwrf ]] ; then + . /usrx/local/Modules/3.2.10/init/sh + target=wcoss + . $MODULESHOME/init/sh +elif [[ -d /cm ]] ; then + . $MODULESHOME/init/sh + target=wcoss_c +elif [[ -d /ioddev_dell ]]; then + . $MODULESHOME/init/sh + target=wcoss_d +elif [[ -d /scratch1 ]] ; then + . /apps/lmod/lmod/init/sh + target=hera +elif [[ -d /carddata ]] ; then + . /opt/apps/lmod/3.1.9/init/sh + target=s4 +elif [[ -d /jetmon ]] ; then + . $MODULESHOME/init/sh + target=jet +elif [[ -d /glade ]] ; then + . $MODULESHOME/init/sh + target=cheyenne +elif [[ -d /sw/gaea ]] ; then + . /opt/cray/pe/modules/3.2.10.5/init/sh + target=gaea +elif [[ -d /discover ]] ; then +# . /opt/cray/pe/modules/3.2.10.5/init/sh + target=discover + build_type=0 + export SPACK_ROOT=/discover/nobackup/mapotts1/spack + export PATH=$PATH:$SPACK_ROOT/bin + . $SPACK_ROOT/share/spack/setup-env.sh +elif [[ -d /work ]]; then + . $MODULESHOME/init/sh + target=orion +else + echo "unknown target = $target" + exit 9 +fi + +dir_modules=$dir_root/modulefiles +if [ ! -d $dir_modules ]; then + echo "modulefiles does not exist in $dir_modules" + exit 10 +fi +[ -d $dir_root/exec ] || mkdir -p $dir_root/exec + +rm -rf $dir_root/build +mkdir -p $dir_root/build +cd $dir_root/build + +if [ $target = wcoss_d ]; then + module purge + module use -a $dir_modules + module load modulefile.ProdGSI.$target +elif [ $target = wcoss -o $target = gaea ]; then + module purge + module load $dir_modules/modulefile.ProdGSI.$target +elif [ $target = hera -o $target = cheyenne -o $target = orion ]; then + module purge + source $dir_modules/modulefile.ProdGSI.$target +elif [ $target = wcoss_c ]; then + module purge + module load $dir_modules/modulefile.ProdGSI.$target +elif [ $target = discover ]; then + module load $dir_modules/modulefile.ProdGSI.$target +else + module purge + source $dir_modules/modulefile.ProdGSI.$target +fi + +#if [ $build_type = PRODUCTION -o $build_type = DEBUG ] ; then +# cmake -DBUILD_UTIL=ON -DBUILD_NCDIAG_SERIAL=ON -DCMAKE_BUILD_TYPE=$build_type -DBUILD_CORELIBS=OFF .. +#else +# cmake .. +#fi + +#make -j 8 + +# Build FV3 regional enkf executable +cmake -DBUILD_PRODUCTION=off -DBUILD_WRF=off -DBUILD_GFS=off -DBUILD_NMMB=off -DBUILD_FV3reg=on .. + +make -j 8 + +cp -p bin/enkf_fv3reg.x ../exec/ + +exit From 1719fe825da39e8abc0f4ee576a35e73c1735fb7 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Mon, 8 Feb 2021 11:43:59 -0600 Subject: [PATCH 061/155] Modifications from Xu Lu and Xuguang Wang (OU) to enable running dual resolution ensembles in HAFS ENSDA system. POC: xuguang.wang@ou.edu. --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 80 +++-- src/gsi/general_commvars_mod.f90 | 6 + src/gsi/gridmod.F90 | 12 +- src/gsi/gsi_rfv3io_mod.f90 | 383 ++++++++++++++++----- src/gsi/hybrid_ensemble_isotropic.F90 | 9 + src/gsi/mod_fv3_lolgrid.f90 | 5 +- 6 files changed, 378 insertions(+), 117 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index bbf3a661ad..c68b908c0a 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -20,6 +20,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! ! program history log: ! 2011-08-31 todling - revisit en_perts (single-prec) in light of extended bundle + ! 2021-02-01 Lu & Wang - modify functions for hafs dual ens. POC: xuguang.wang@ou.edu ! ! input argument list: ! @@ -330,9 +331,9 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g use gridmod, only: eta1_ll,eta2_ll use constants, only: zero,one,fv,zero_single,one_tenth,h300 use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens - use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt + use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt,dual_res - use mpimod, only: mpi_comm_world,mpi_rtype + use mpimod, only: mpi_comm_world,mpi_rtype,mype use netcdf_mod, only: nc_check use gsi_rfv3io_mod,only: type_fv3regfilenameg use gsi_rfv3io_mod,only:n2d @@ -361,7 +362,7 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g ! ! Declare local variables - integer(i_kind):: i,j,k,kp + integer(i_kind):: i,j,k,kp,lon2ens,lat2ens integer(i_kind) iderivative @@ -391,42 +392,71 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens - - - if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v) - else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v) - endif - if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t) + lon2ens=grd_ens%lon2 + lat2ens=grd_ens%lat2 + if (dual_res) then + if(fv3sar_ensemble_opt == 0 ) then + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,lat2ens,lon2ens,.true.) + else + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,lat2ens,lon2ens,.true.) + endif + if(fv3sar_ensemble_opt == 0) then + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,lat2ens,lon2ens,.true.) + else + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,lat2ens,lon2ens,.true.) + endif else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t) - endif + if(fv3sar_ensemble_opt == 0 ) then + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,lat2ens,lon2ens,.false.) + else + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,lat2ens,lon2ens,.false.) + endif + if(fv3sar_ensemble_opt == 0) then + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,lat2ens,lon2ens,.false.) + else + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,lat2ens,lon2ens,.false.) + endif + end if if (fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p) + if (dual_res) then + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,lat2ens,lon2ens,.true.) + else + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,lat2ens,lon2ens,.false.) + end if g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid do i=grd_ens%nsig,1,-1 g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) enddo g_ps(:,:)=g_prsi(:,:,1) else ! for the ensemble processed frm CHGRES - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p) + if (dual_res) then + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,lat2ens,lon2ens,.true.) + else + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,lat2ens,lon2ens,.false.) + end if g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps enddo - - endif - if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz) + if (dual_res) then + if(fv3sar_ensemble_opt == 0) then + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,lat2ens,lon2ens,.true.) + else + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,lat2ens,lon2ens,.true.) + endif else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz) - endif + if(fv3sar_ensemble_opt == 0) then + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,lat2ens,lon2ens,.false.) + else + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,lat2ens,lon2ens,.false.) + endif + end if !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do k=1,grd_ens%nsig @@ -447,7 +477,7 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g end do end do end do - call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) + call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),lat2ens,lon2ens,grd_ens%nsig,ice,iderivative) do k=1,grd_ens%nsig do j=1,grd_ens%lon2 do i=1,grd_ens%lat2 diff --git a/src/gsi/general_commvars_mod.f90 b/src/gsi/general_commvars_mod.f90 index daf182fbdd..e15bf03d7a 100644 --- a/src/gsi/general_commvars_mod.f90 +++ b/src/gsi/general_commvars_mod.f90 @@ -10,6 +10,7 @@ module general_commvars_mod ! program history log: ! 2012-06-25 parrish ! 2013-10-24 todling - move vars ltosj/i to from gridmod here; same for load and fill routines +! 2021-02-01 Lu & Wang - add vars for hafs dual ens. POC: xuguang.wang@ou.edu ! ! Subroutines Included: ! sub init_general_commvars - initialize type(sub2grid_info) structure variables @@ -62,11 +63,13 @@ module general_commvars_mod public :: filluv2_ns public :: load_grid public :: ltosj_s,ltosi_s,ltosj,ltosi + public :: ltosj_sens,ltosi_sens integer(i_kind),allocatable,dimension(:):: ltosi ! lats in iglobal array excluding buffer integer(i_kind),allocatable,dimension(:):: ltosj ! lons in iglobal array excluding buffer integer(i_kind),allocatable,dimension(:):: ltosi_s ! lats in itotsub array including buffer integer(i_kind),allocatable,dimension(:):: ltosj_s ! lons in itotsub array including buffer + integer(i_kind),allocatable,dimension(:):: ltosj_sens,ltosi_sens ! lats/lons for ens ! Declare types @@ -196,6 +199,7 @@ subroutine init_general_commvars displs_s=s2g_raf%displs_s itotsub=s2g_raf%itotsub allocate(ltosi_s(itotsub),ltosj_s(itotsub)) + allocate(ltosi_sens(itotsub),ltosj_sens(itotsub)) ltosi_s=s2g_raf%ltosi_s ltosj_s=s2g_raf%ltosj_s @@ -352,6 +356,8 @@ subroutine destroy_general_commvars implicit none deallocate(ltosi,ltosj,ltosi_s,ltosj_s) + if (allocated(ltosj_sens)) deallocate(ltosj_sens) + if (allocated(ltosi_sens)) deallocate(ltosi_sens) deallocate(levs_id,nvar_id,nvar_pe) call general_sub2grid_destroy_info(s2g_cv,s_ref=s2g_raf) call general_sub2grid_destroy_info(s2g2,s_ref=s2g_raf) diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index 2bd3c3381f..c375a560f7 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -91,6 +91,7 @@ module gridmod ! 2019-04-19 martin - add use_fv3_aero option to distingiush between NGAC and FV3-Chem ! 2019-09-04 martin - add write_fv3_incr to write netCDF increment rather than analysis in NEMSIO format ! 2019-09-23 martin - add use_gfs_ncio to read global first guess from netCDF file +! 2021-02-01 Lu & Wang - add vars for hafs dual ens. POC: xuguang.wang@ou.edu ! ! ! @@ -132,6 +133,7 @@ module gridmod ! set passed variables to public public :: nnnn1o,iglobal,itotsub,ijn,ijn_s,lat2,lon2,lat1,lon1,nsig,nsig_soil public :: ncloud,nlat,nlon,ntracer,displs_s,displs_g + public :: ijn_sens,ijnens,displs_sens public :: bk5,regional,latlon11,latlon1n,twodvar_regional public :: netcdf,nems_nmmb_regional,wrf_mass_regional,wrf_nmm_regional,cmaq_regional public :: aeta2_ll,pdtop_ll,pt_ll,eta1_ll,eta2_ll,aeta1_ll,idsl5,ck5,ak5 @@ -283,6 +285,9 @@ module gridmod integer(i_kind),allocatable,dimension(:):: isd_g ! displacement for send to global integer(i_kind),allocatable,dimension(:):: displs_s ! displacement for send from subdomain integer(i_kind),allocatable,dimension(:):: displs_g ! displacement for receive on global grid + integer(i_kind),allocatable,dimension(:):: ijn_sens + integer(i_kind),allocatable,dimension(:):: ijnens + integer(i_kind),allocatable,dimension(:):: displs_sens integer(i_kind),dimension(200):: nlayers ! number of RTM layers per model layer ! (k=1 is near surface layer), default is 1 @@ -924,7 +929,8 @@ subroutine create_mapping(npe) allocate(periodic_s(npe),jstart(npe),istart(npe),& ilat1(npe),jlon1(npe),& ijn_s(npe),irc_s(npe),ird_s(npe),displs_s(npe),& - ijn(npe),isc_g(npe),isd_g(npe),displs_g(npe)) + ijn(npe),isc_g(npe),isd_g(npe),displs_g(npe), & + ijn_sens(npe),ijnens(npe),displs_sens(npe)) do i=1,npe periodic_s(i)= .false. @@ -940,6 +946,9 @@ subroutine create_mapping(npe) isc_g(i) = 0 isd_g(i) = 0 displs_g(i) = 0 + ijn_sens(i) = 0 + displs_sens(i)= 0 + ijnens(i) = 0 end do return @@ -980,6 +989,7 @@ subroutine destroy_mapping deallocate(periodic_s,jstart,istart,ilat1,jlon1,& ijn_s,irc_s,ird_s,displs_s,& ijn,isc_g,isd_g,displs_g) + deallocate(ijn_sens,ijnens,displs_sens) return end subroutine destroy_mapping diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 8d834fa6b1..def202ecd5 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -13,6 +13,8 @@ module gsi_rfv3io_mod ! 2018-02-22 wu - add subroutines for read/write fv3_ncdf ! 2019 ting - modifications for use for ensemble IO and cold start files ! 2020-11-19 Lu & Wang - add time label it for fgat. POC: xuguang.wang@ou.edu +! 2021-02-01 Lu & Wang - modify functions for hafs dual ens. POC: +! xuguang.wang@ou.edu ! subroutines included: ! sub gsi_rfv3io_get_grid_specs ! sub read_fv3_files @@ -58,12 +60,13 @@ module gsi_rfv3io_mod integer(i_kind):: fv3sar_bg_opt=0 type(type_fv3regfilenameg):: bg_fv3regfilenameg - integer(i_kind) nx,ny,nz + integer(i_kind) nx,ny,nz,nxens,nyens real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) real(r_kind),allocatable:: ak(:),bk(:) integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) integer(i_kind),allocatable:: ijnz(:),displsz_g(:) - + integer(i_kind),allocatable:: ijns2dens(:),displss2dens(:),ijnsens(:),displssens(:) + integer(i_kind),allocatable:: ijnzens(:),displsz_gens(:) ! set default to private private ! set subroutines to public @@ -82,6 +85,7 @@ module gsi_rfv3io_mod public :: k_slmsk,k_tsea,k_vfrac,k_vtype,k_stype,k_zorl,k_smc,k_stc public :: k_snwdph,k_f10m,mype_2d,n2d,k_orog,k_psfc public :: ijns,ijns2d,displss,displss2d,ijnz,displsz_g + public :: ijnsens,ijns2dens,displssens,displss2dens,ijnzens,displsz_gens integer(i_kind) mype_u,mype_v,mype_t,mype_q,mype_p,mype_oz,mype_ql integer(i_kind) k_slmsk,k_tsea,k_vfrac,k_vtype,k_stype,k_zorl,k_smc,k_stc @@ -427,17 +431,17 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) gfile_loc=gfile_grid_spec do k=1,ndimensions iret=nf90_inquire_dimension(gfile_loc,k,name,len) - if(trim(name)=='grid_xt') nx=len - if(trim(name)=='grid_yt') ny=len + if(trim(name)=='grid_xt') nxens=len + if(trim(name)=='grid_yt') nyens=len enddo - if(mype==0)write(6,*),'nx,ny=',nx,ny + if(mype==0)write(6,*),'nxens,nyens=',nxens,nyens !!! get nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,nz,ak,bk - allocate(grid_lat(nx+1,ny+1)) - allocate(grid_lon(nx+1,ny+1)) - allocate(grid_latt(nx,ny)) - allocate(grid_lont(nx,ny)) + allocate(grid_lat(nxens+1,nyens+1)) + allocate(grid_lon(nxens+1,nyens+1)) + allocate(grid_latt(nxens,nyens)) + allocate(grid_lont(nxens,nyens)) do k=ndimensions+1,nvariables iret=nf90_inquire_variable(gfile_loc,k,name,len) @@ -462,7 +466,7 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) !!!!!!! setup A grid and interpolation/rotation coeff. - call definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & + call definecoef_regular_grids(nxens,nyens,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & nlat_ens,nlon_ens,region_lat_ens,region_lon_ens) deallocate (grid_lon,grid_lat,grid_lont,grid_latt) @@ -750,6 +754,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) use mpimod, only: npe use guess_grids, only: ges_tsen,ges_prsi use gridmod, only: lat2,lon2,nsig,ijn,eta1_ll,eta2_ll,ijn_s + use gridmod, only: ijnens,ijn_sens use constants, only: one,fv use gsi_metguess_mod, only: gsi_metguess_bundle use gsi_bundlemod, only: gsi_bundlegetpointer @@ -800,11 +805,19 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) if (.not.allocated(displss)) allocate(displss(npe)) if (.not.allocated(displss2d)) allocate(displss2d(npe)) if (.not.allocated(displsz_g)) allocate(displsz_g(npe)) - + if (.not.allocated(ijnsens)) allocate(ijnsens(npe)) + if (.not.allocated(ijns2dens)) allocate(ijns2dens(npe)) + if (.not.allocated(ijnzens)) allocate(ijnzens(npe)) + if (.not.allocated(displssens)) allocate(displssens(npe)) + if (.not.allocated(displss2dens)) allocate(displss2dens(npe)) + if (.not.allocated(displsz_gens)) allocate(displsz_gens(npe)) do i=1,npe ijns(i)=ijn_s(i)*nsig ijnz(i)=ijn(i)*nsig ijns2d(i)=ijn_s(i)*n2d + ijnsens(i)=ijn_sens(i)*nsig + ijnzens(i)=ijnens(i)*nsig + ijns2dens(i)=ijn_sens(i)*n2d enddo displss(1)=0 displsz_g(1)=0 @@ -814,7 +827,14 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) displsz_g(i)=displsz_g(i-1)+ ijnz(i-1) displss2d(i)=displss2d(i-1)+ ijns2d(i-1) enddo - + displssens(1)=0 + displsz_gens(1)=0 + displss2dens(1)=0 + do i=2,npe + displssens(i)=displssens(i-1)+ ijnsens(i-1) + displsz_gens(i)=displsz_gens(i-1)+ ijnzens(i-1) + displss2dens(i)=displss2dens(i-1)+ ijns2dens(i-1) + enddo ! do it=1,nfldsig ! it=ntguessig @@ -831,26 +851,26 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_readuv(dynvars,ges_u,ges_v) + call gsi_fv3ncdf_readuv(dynvars,ges_u,ges_v,lat2,lon2,.false.) else - call gsi_fv3ncdf_readuv_v1(dynvars,ges_u,ges_v) + call gsi_fv3ncdf_readuv_v1(dynvars,ges_u,ges_v,lat2,lon2,.false.) endif if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',ges_tsen(1,1,1,it),mype_t) + call gsi_fv3ncdf_read(dynvars,'T','t',ges_tsen(1,1,1,it),mype_t,lat2,lon2,.false.) else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',ges_tsen(1,1,1,it),mype_t) + call gsi_fv3ncdf_read_v1(dynvars,'t','T',ges_tsen(1,1,1,it),mype_t,lat2,lon2,.false.) endif if( fv3sar_bg_opt == 0) then ! call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi,mype_p) - call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi(:,:,:,it),mype_p) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',ges_prsi(:,:,:,it),mype_p,lat2,lon2,.false.) ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) do i=nsig,1,-1 ges_prsi(:,:,i,it)=ges_prsi(:,:,i,it)*0.001_r_kind+ges_prsi(:,:,i+1,it) enddo ges_ps(:,:)=ges_prsi(:,:,1,it) else - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',ges_ps,mype_p) + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',ges_ps,mype_p,lat2,lon2,.false.) ges_ps=ges_ps*0.001_r_kind ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) do k=1,nsig @@ -859,12 +879,12 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) endif if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',ges_q,mype_q) + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',ges_q,mype_q,lat2,lon2,.false.) ! call gsi_fv3ncdf_read(tracers,'LIQ_WAT','liq_wat',ges_ql,mype_ql) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',ges_oz,mype_oz) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',ges_oz,mype_oz,lat2,lon2,.false.) else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',ges_q,mype_q) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',ges_oz,mype_oz) + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',ges_q,mype_q,lat2,lon2,.false.) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',ges_oz,mype_oz,lat2,lon2,.false.) endif !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -878,6 +898,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) call gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) + end subroutine read_fv3_netcdf_guess subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) @@ -1069,7 +1090,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) deallocate (sfcn2d,a) return end subroutine gsi_fv3ncdf2d_read -subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) +subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io,lat2in,lon2in,ensgrid) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv23ncdf2d_readv1 @@ -1105,11 +1126,16 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_inquire_variable use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s + use gridmod, only: ijn_sens,ijnens,displs_sens + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none character(*) ,intent(in ) :: varname,varname2,filenamein - real(r_kind) ,intent(out ) :: work_sub(lat2,lon2) + integer(i_kind) ,intent(in ) :: lat2in,lon2in + real(r_kind) ,intent(out ) :: work_sub(lat2in,lon2in) integer(i_kind) ,intent(in ) :: mype_io + logical, intent(in ) :: ensgrid real(r_kind),allocatable,dimension(:,:,:):: uu integer(i_kind),allocatable,dimension(:):: dim_id,dim real(r_kind),allocatable,dimension(:):: work @@ -1134,7 +1160,11 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) - allocate(a(nlat,nlon)) + if (ensgrid) then + allocate(a(nlat_ens,nlon_ens)) + else + allocate(a(nlat,nlon)) + end if iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) if(iret/=nf90_noerr) then @@ -1149,8 +1179,22 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) allocate(dim_id(ndim)) iret=nf90_inquire_variable(gfile_loc,var_id,dimids=dim_id) if(allocated(uu )) deallocate(uu ) - allocate(uu(nx,ny,1)) - iret=nf90_get_var(gfile_loc,var_id,uu) + if (ensgrid) then + allocate(uu(nxens,nyens,1)) + iret=nf90_get_var(gfile_loc,var_id,uu) + call fv3_h_to_ll_regular_grids(uu(:,:,1),a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + kk=0 + do n=1,npe + do j=1,ijn_sens(n) + kk=kk+1 + ii=ltosi_sens(kk) + jj=ltosj_sens(kk) + work(kk)=a(ii,jj) + end do + end do + else + allocate(uu(nx,ny,1)) + iret=nf90_get_var(gfile_loc,var_id,uu) call fv3_h_to_ll_regular_grids(uu(:,:,1),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) kk=0 do n=1,npe @@ -1161,20 +1205,25 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) work(kk)=a(ii,jj) end do end do - + end if iret=nf90_close(gfile_loc) deallocate (uu,a,dim,dim_id) endif !mype - call mpi_scatterv(work,ijn_s,displs_s,mpi_rtype,& - work_sub,ijn_s(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + if (ensgrid) then + call mpi_scatterv(work,ijn_sens,displs_sens,mpi_rtype,& + work_sub,ijn_sens(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + else + call mpi_scatterv(work,ijn_s,displs_s,mpi_rtype,& + work_sub,ijn_s(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + end if deallocate (work) return end subroutine gsi_fv3ncdf2d_read_v1 -subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) +subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io,lat2in,lon2in,ensgrid) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_read @@ -1208,11 +1257,16 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_inquire_variable use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s + use gridmod, only: ijn_sens,ijnens + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none character(*) ,intent(in ) :: varname,varname2,filenamein - real(r_kind) ,intent(out ) :: work_sub(lat2,lon2,nsig) + integer(i_kind) ,intent(in ) :: lat2in,lon2in + real(r_kind) ,intent(out ) :: work_sub(lat2in,lon2in,nsig) integer(i_kind) ,intent(in ) :: mype_io + logical, intent(in ) :: ensgrid character(len=128) :: name real(r_kind),allocatable,dimension(:,:,:):: uu integer(i_kind),allocatable,dimension(:):: dim_id,dim @@ -1235,10 +1289,13 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) write(6,*)' gsi_fv3ncdf_read:problem opening5 with varnam ',trim(varname) return endif - iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) - allocate(a(nlat,nlon)) + if (ensgrid) then + allocate(a(nlat_ens,nlon_ens)) + else + allocate(a(nlat,nlon)) + end if do k=1,ndimensions iret=nf90_inquire_dimension(gfile_loc,k,name,len) @@ -1264,9 +1321,24 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) nzp1=nz+1 do i=1,nz ir=nzp1-i - call fv3_h_to_ll_regular_grids(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat,p_fv3sar2anlgrid) - kk=0 - do n=1,npe + if (ensgrid) then + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon_ens,nlat_ens,p_fv3sar2ensgrid) + kk=0 + do n=1,npe + ns=displssens(n)+(ir-1)*ijn_sens(n) + do j=1,ijn_sens(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_sens(kk) + jj=ltosj_sens(kk) + work(ns)=a(ii,jj) + end do + end do + else + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat,p_fv3sar2anlgrid) + + kk=0 + do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) do j=1,ijn_s(n) ns=ns+1 @@ -1275,22 +1347,27 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) jj=ltosj_s(kk) work(ns)=a(ii,jj) end do - end do + end do + end if enddo ! i - iret=nf90_close(gfile_loc) deallocate (uu,a,dim,dim_id) endif !mype - call mpi_scatterv(work,ijns,displss,mpi_rtype,& - work_sub,ijns(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + if (ensgrid) then + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + work_sub,ijnsens(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + else + call mpi_scatterv(work,ijns,displss,mpi_rtype,& + work_sub,ijns(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + end if deallocate (work) return end subroutine gsi_fv3ncdf_read -subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) +subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io,lat2in,lon2in,ensgrid) !$$$ subprogram documentation block ! . . . . @@ -1327,11 +1404,15 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - + use gridmod, only: lat2,lon2,nsig,nlat,nlon,itotsub,ijn_s,ijn_sens + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none character(*) ,intent(in ) :: varname,varname2,filenamein - real(r_kind) ,intent(out ) :: work_sub(lat2,lon2,nsig) + integer(i_kind) ,intent(in ) :: lon2in,lat2in + real(r_kind) ,intent(out ) :: work_sub(lat2in,lon2in,nsig) integer(i_kind) ,intent(in ) :: mype_io + logical, intent(in ) :: ensgrid character(len=128) :: name real(r_kind),allocatable,dimension(:,:,:):: uu real(r_kind),allocatable,dimension(:,:,:):: temp0 @@ -1358,15 +1439,24 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) - allocate(a(nlat,nlon)) + if (ensgrid) then + allocate(a(nlat_ens,nlon_ens)) + else + allocate(a(nlat,nlon)) + end if do k=1,ndimensions iret=nf90_inquire_dimension(gfile_loc,k,name,len) dim(k)=len enddo + if (ensgrid) then + allocate(uu(nxens,nyens,nsig)) + allocate(temp0(nxens,nyens,nsig+1)) + else allocate(uu(nx,ny,nsig)) allocate(temp0(nx,ny,nsig+1)) + end if iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) if(iret/=nf90_noerr) then @@ -1383,9 +1473,23 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) nzp1=nztmp+1 do i=1,nztmp ir=nzp1-i - call fv3_h_to_ll_regular_grids(uu(:,:,i),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) - kk=0 - do n=1,npe + if (ensgrid) then + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + kk=0 + do n=1,npe + ns=displssens(n)+(ir-1)*ijn_sens(n) + do j=1,ijn_sens(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_sens(kk) + jj=ltosj_sens(kk) + work(ns)=a(ii,jj) + end do + end do + else + call fv3_h_to_ll_regular_grids(uu(:,:,i),a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) + kk=0 + do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) do j=1,ijn_s(n) ns=ns+1 @@ -1394,7 +1498,8 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) jj=ltosj_s(kk) work(ns)=a(ii,jj) end do - end do + end do + end if enddo ! i iret=nf90_close(gfile_loc) @@ -1403,14 +1508,18 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) endif !mype - call mpi_scatterv(work,ijns,displss,mpi_rtype,& - work_sub,ijns(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) - + if (ensgrid) then + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + work_sub,ijnsens(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + else + call mpi_scatterv(work,ijns,displss,mpi_rtype,& + work_sub,ijns(mm1),mpi_rtype,mype_io,mpi_comm_world,ierror) + end if deallocate (work) return end subroutine gsi_fv3ncdf_read_v1 -subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) +subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_readuv @@ -1433,18 +1542,23 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) !$$$ end documentation block use kinds, only: r_kind,i_kind use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype - use gridmod, only: lat2,lon2,nsig,itotsub,ijn_s + use gridmod, only: lat2,lon2,nsig,itotsub,ijn_s,nlat,nlon use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s + use gridmod, only: ijn_sens,ijnens + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none character(*) ,intent(in ):: dynvarsfile - real(r_kind) ,intent(out ) :: ges_u(lat2,lon2,nsig) - real(r_kind) ,intent(out ) :: ges_v(lat2,lon2,nsig) + integer(i_kind) ,intent(in ) :: lat2in,lon2in + real(r_kind) ,intent(out ) :: ges_u(lat2in,lon2in,nsig) + real(r_kind) ,intent(out ) :: ges_v(lat2in,lon2in,nsig) + logical, intent(in ) :: ensgrid character(len=128) :: name real(r_kind),allocatable,dimension(:,:,:):: uu,temp1 integer(i_kind),allocatable,dimension(:):: dim_id,dim @@ -1469,7 +1583,11 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) - allocate(a(nya,nxa)) + if (ensgrid) then + allocate(a(nlat_ens,nlon_ens)) + else + allocate(a(nlat,nlon)) + end if do k=1,ndimensions iret=nf90_inquire_dimension(gfile_loc,k,name,len) @@ -1507,14 +1625,33 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) nzp1=nz+1 do i=1,nz ir=nzp1-i - call fv3uv2earth_regular_grids(temp1(:,:,i),uu(:,:,i),nx,ny,u,v,p_fv3sar2anlgrid) - if(mype==mype_u)then - call fv3_h_to_ll_regular_grids(u,a,nx,ny,nxa,nya,p_fv3sar2anlgrid) + if (ensgrid) then + call fv3uv2earth_regular_grids(temp1(:,:,i),uu(:,:,i),nxens,nyens,u,v,p_fv3sar2ensgrid) + if(mype==mype_u)then + call fv3_h_to_ll_regular_grids(u,a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + else + call fv3_h_to_ll_regular_grids(v,a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + endif + kk=0 + do n=1,npe + ns=displssens(n)+(ir-1)*ijn_sens(n) + do j=1,ijn_sens(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_sens(kk) + jj=ltosj_sens(kk) + work(ns)=a(ii,jj) + end do + end do else - call fv3_h_to_ll_regular_grids(v,a,nx,ny,nxa,nya,p_fv3sar2anlgrid) - endif - kk=0 - do n=1,npe + call fv3uv2earth_regular_grids(temp1(:,:,i),uu(:,:,i),nx,ny,u,v,p_fv3sar2anlgrid) + if(mype==mype_u)then + call fv3_h_to_ll_regular_grids(u,a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) + else + call fv3_h_to_ll_regular_grids(v,a,nx,ny,nlon,nlat,p_fv3sar2anlgrid) + endif + kk=0 + do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) do j=1,ijn_s(n) ns=ns+1 @@ -1523,7 +1660,8 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) jj=ltosj_s(kk) work(ns)=a(ii,jj) end do - end do + end do + end if enddo ! i deallocate(temp1,a) deallocate (dim,dim_id,uu,v,u) @@ -1531,13 +1669,20 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) endif ! mype !! scatter to ges_u,ges_v !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - call mpi_scatterv(work,ijns,displss,mpi_rtype,& + if (ensgrid) then + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + ges_u,ijnsens(mm1),mpi_rtype,mype_u,mpi_comm_world,ierror) + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + ges_v,ijnsens(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) + else + call mpi_scatterv(work,ijns,displss,mpi_rtype,& ges_u,ijns(mm1),mpi_rtype,mype_u,mpi_comm_world,ierror) - call mpi_scatterv(work,ijns,displss,mpi_rtype,& + call mpi_scatterv(work,ijns,displss,mpi_rtype,& ges_v,ijns(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) + end if deallocate(work) end subroutine gsi_fv3ncdf_readuv -subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) +subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) !$$$ subprogram documentation block ! subprogram: gsi_fv3ncdf_readuv_v1 ! prgmmr: wu w org: np22 date: 2017-11-22 @@ -1562,18 +1707,22 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) use constants, only: half use kinds, only: r_kind,i_kind use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype - use gridmod, only: lat2,lon2,nsig,itotsub,ijn_s + use gridmod, only: lat2,lon2,nsig,itotsub,ijn_s,nlat,nlon use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - + use gridmod, only: ijn_sens,ijnens + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none character(*) ,intent(in ):: dynvarsfile - real(r_kind) ,intent(out ) :: ges_u(lat2,lon2,nsig) - real(r_kind) ,intent(out ) :: ges_v(lat2,lon2,nsig) + integer(i_kind) ,intent(in ) :: lat2in,lon2in + real(r_kind) ,intent(out ) :: ges_u(lat2in,lon2in,nsig) + real(r_kind) ,intent(out ) :: ges_v(lat2in,lon2in,nsig) + logical, intent(in ) :: ensgrid character(len=128) :: name real(r_kind),allocatable,dimension(:,:,:):: uu,temp0 integer(i_kind),allocatable,dimension(:):: dim_id,dim @@ -1598,31 +1747,54 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) - allocate(a(nya,nxa)) + if (ensgrid) then + allocate(a(nlat_ens,nlon_ens)) + else + allocate(a(nlat,nlon)) + end if do k=1,ndimensions iret=nf90_inquire_dimension(gfile_loc,k,name,len) dim(k)=len enddo - allocate(uorv(nx,ny)) - if(mype == mype_u) then - allocate(uu(nx,ny+1,nsig)) - else ! for mype_v - allocate(uu(nx+1,ny,nsig)) - endif + if (ensgrid) then + if(mype == mype_u) then + allocate(uorv(nxens,nyens)) + allocate(uu(nxens,nyens+1,nsig)) + else ! for mype_v + allocate(uorv(nxens,nyens)) + allocate(uu(nxens+1,nyens,nsig)) + endif + else + if(mype == mype_u) then + allocate(uorv(nx,ny)) + allocate(uu(nx,ny+1,nsig)) + else ! for mype_v + allocate(uorv(nx,ny)) + allocate(uu(nx+1,ny,nsig)) + endif + end if ! transfor to earth u/v, interpolate to analysis grid, reverse vertical order if(mype == mype_u) then iret=nf90_inq_varid(gfile_loc,trim(adjustl("u_s")),var_id) iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) - allocate(temp0(nx,ny+1,nsig+1)) + if (ensgrid) then + allocate(temp0(nxens,nyens+1,nsig+1)) + else + allocate(temp0(nx,ny+1,nsig+1)) + end if iret=nf90_get_var(gfile_loc,var_id,temp0) uu(:,:,:)=temp0(:,:,2:nsig+1) deallocate(temp0) endif if(mype == mype_v) then - allocate(temp0(nx+1,ny,nsig+1)) + if (ensgrid) then + allocate(temp0(nxens+1,nyens,nsig+1)) + else + allocate(temp0(nx+1,ny,nsig+1)) + endif iret=nf90_inq_varid(gfile_loc,trim(adjustl("v_w")),var_id) iret=nf90_inquire_variable(gfile_loc,var_id,ndims=ndim) iret=nf90_get_var(gfile_loc,var_id,temp0) @@ -1633,20 +1805,45 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) nzp1=nztmp+1 do i=1,nztmp ir=nzp1-i - if(mype == mype_u)then + if (ensgrid) then + if(mype == mype_u)then + do j=1,nyens + uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) + enddo + + call fv3_h_to_ll_regular_grids(uorv(:,:),a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + else + do j=1,nxens + uorv(j,:)=half*(uu(j,:,i)+uu(j+1,:,i)) + enddo + call fv3_h_to_ll_regular_grids(uorv(:,:),a,nxens,nyens,nlon_ens,nlat_ens,p_fv3sar2ensgrid) + endif + kk=0 + do n=1,npe + ns=displssens(n)+(ir-1)*ijn_sens(n) + do j=1,ijn_sens(n) + ns=ns+1 + kk=kk+1 + ii=ltosi_sens(kk) + jj=ltosj_sens(kk) + work(ns)=a(ii,jj) + end do + end do + else + if(mype == mype_u)then do j=1,ny uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) enddo call fv3_h_to_ll_regular_grids(uorv(:,:),a,nx,ny,nxa,nya,p_fv3sar2anlgrid) - else + else do j=1,nx uorv(j,:)=half*(uu(j,:,i)+uu(j+1,:,i)) enddo call fv3_h_to_ll_regular_grids(uorv(:,:),a,nx,ny,nxa,nya,p_fv3sar2anlgrid) - endif - kk=0 - do n=1,npe + endif + kk=0 + do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) do j=1,ijn_s(n) ns=ns+1 @@ -1655,7 +1852,8 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) jj=ltosj_s(kk) work(ns)=a(ii,jj) end do - end do + end do + end if enddo ! i deallocate(a) deallocate (uu,uorv) @@ -1663,10 +1861,17 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) endif ! mype !! scatter to ges_u,ges_v !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - call mpi_scatterv(work,ijns,displss,mpi_rtype,& + if (ensgrid) then + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + ges_u,ijnsens(mm1),mpi_rtype,mype_u,mpi_comm_world,ierror) + call mpi_scatterv(work,ijnsens,displssens,mpi_rtype,& + ges_v,ijnsens(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) + else + call mpi_scatterv(work,ijns,displss,mpi_rtype,& ges_u,ijns(mm1),mpi_rtype,mype_u,mpi_comm_world,ierror) - call mpi_scatterv(work,ijns,displss,mpi_rtype,& + call mpi_scatterv(work,ijns,displss,mpi_rtype,& ges_v,ijns(mm1),mpi_rtype,mype_v,mpi_comm_world,ierror) + end if deallocate(work) end subroutine gsi_fv3ncdf_readuv_v1 diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index ddd148ad98..5b4c111cc7 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3853,6 +3853,7 @@ subroutine hybens_grid_setup ! 2010-02-20 parrish, adapt for dual resolution ! 2011-01-30 parrish, fix so regional application depends only on parameters regional ! and dual_res. Rename subroutine get_regional_gefs_grid to get_regional_dual_res_grid. +! 2021-02-01 Lu & Wang - add vars for hafs dual ens. POC: xuguang.wang@ou.edu ! ! input argument list: ! @@ -3880,6 +3881,9 @@ subroutine hybens_grid_setup use gridmod, only: region_lat,region_lon,region_dx,region_dy use hybrid_ensemble_parameters, only:regional_ensemble_option use gsi_rfv3io_mod,only:gsi_rfv3io_get_ens_grid_specs + use general_commvars_mod, only: ltosi_sens,ltosj_sens + use gridmod, only: itotsub,ijn_sens,ijnens,displs_sens + use mpimod, only: npe implicit none @@ -3946,6 +3950,11 @@ subroutine hybens_grid_setup allocate(vector(num_fields)) vector=.false. call general_sub2grid_create_info(grd_loc,inner_vars,nlat_ens,nlon_ens,nsig,num_fields,regional,vector) + ltosi_sens=grd_loc%ltosi_s + ltosj_sens=grd_loc%ltosj_s + ijn_sens=grd_loc%ijn_s + ijnens=grd_loc%ijn + displs_sens=grd_loc%displs_s num_fields=max(0,nc3d)*nsig+max(0,nc2d) deallocate(vector) allocate(vector(num_fields)) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 4fd5218da2..c2cb2cb865 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -665,6 +665,7 @@ subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt, ! 2. compute/setup FV3 to A grid interpolation parameters ! 3. compute/setup A to FV3 grid interpolation parameters ! 4. setup weightings for wind conversion from FV3 to earth +! 2021-02-01 Lu & Wang - modify variable intent for HAFS dual ens. POC: xuguang.wang@ou.edu ! ! input argument list: ! nx, ny - number of cells = nx*ny @@ -686,8 +687,8 @@ subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt, use gridmod, only:init_general_transform implicit none type (fv3sar2grid_parm),intent(inout):: p_fv3sar2grid - real(r_kind),allocatable,intent(out):: region_lat_in(:,:),region_lon_in(:,:) - integer(i_kind), intent(out):: nlatin,nlonin + real(r_kind),allocatable,intent(inout):: region_lat_in(:,:),region_lon_in(:,:) + integer(i_kind), intent(inout):: nlatin,nlonin real(r_kind) ,pointer,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 From 636b6224b5363003e829153d73db5951b4e78b05 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 16 Feb 2021 12:14:35 -0500 Subject: [PATCH 062/155] Minor modifications for dual resolution regional ensembles (#3) A couple of modifications for fv3-lam dual resolution from @TingLei-NOAA --- src/gsi/gsi_rfv3io_mod.f90 | 6 +++--- src/gsi/mod_fv3_lolgrid.f90 | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index def202ecd5..1744602bda 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -393,7 +393,7 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens use mpimod, only: mype !cltorg use mod_fv3_lola, only: generate_anl_grid - use mod_fv3_lolgrid, only: definecoef_regular_grids + use mod_fv3_lolgrid, only: definecoef_regular_grids,nxa_ens,nya_ens use gridmod, only:region_lat,region_lon,nlat,nlon use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx use kinds, only: i_kind,r_kind @@ -466,7 +466,7 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) !!!!!!! setup A grid and interpolation/rotation coeff. - call definecoef_regular_grids(nxens,nyens,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & + call definecoef_regular_grids(nxens,nyens,nxa_ens,nya_ens,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & nlat_ens,nlon_ens,region_lat_ens,region_lon_ens) deallocate (grid_lon,grid_lat,grid_lont,grid_latt) @@ -930,7 +930,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable - use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nxa,nya + use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nxa,nya,nxa_ens,nya_ens use constants, only: grav implicit none diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index c2cb2cb865..4ccb6cc4b4 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -71,6 +71,7 @@ module mod_fv3_lolgrid public :: p_fv3sar2anlgrid public :: p_fv3sar2ensgrid public :: nxa,nya + public :: nxa_ens,nya_ens type fv3sar2grid_parm logical bilinear integer(i_kind) nxout,nyout,nx,ny @@ -82,6 +83,7 @@ module mod_fv3_lolgrid end type type (fv3sar2grid_parm)::p_fv3sar2anlgrid,p_fv3sar2ensgrid integer(i_kind) nxa,nya + integer(i_kind) nxa_ens,nya_ens contains @@ -648,7 +650,7 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) deallocate(rlat_in,rlon_in) end subroutine generate_regular_grids -subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2grid,& +subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2grid,& nlatin,nlonin,region_lat_in,region_lon_in) !$$$ subprogram documentation block ! . . . . @@ -705,6 +707,7 @@ subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt, integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + integer(i_kind), intent(inout ) :: nxa_inout,nya_inout real(r_kind) , intent(inout) :: grid_lon(nx+1,ny+1) ! fv3 cell corner longitudes real(r_kind) , intent(inout) :: grid_lont(nx,ny) ! fv3 cell center longitudes real(r_kind) , intent(inout) :: grid_lat(nx+1,ny+1) ! fv3 cell corner latitudes @@ -781,8 +784,8 @@ subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt, p_fv3sar2grid%nxout=nxout nyout=nlatin p_fv3sar2grid%nyout=nyout - nxa=nxout - nya=nyout ! for compatiability + nxa_inout=nxout + nya_inout=nyout ! for compatiability if(mype==0) print *,'nlatin,nlonin = ',nlatin,nlonin !--------------------------obtain analysis grid spacing @@ -854,10 +857,10 @@ subroutine definecoef_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt, index0=1 !cltthinkdeb should region_lon_in be in degree or not? - do j=1,nxa + do j=1,nxa_inout xa_a(j)= (rlon_in(index0,j)-clon)/dlon end do - do i=1,nya + do i=1,nya_inout ya_a(i)= (rlat_in(i,index0)-clat)/dlon end do From 8b0c604e8c473ab4e6f862d80b014e9f4c746796 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Tue, 16 Feb 2021 15:02:43 -0600 Subject: [PATCH 063/155] Changes from Xu Lu (OU): No need to introduce extra variables when the lon/lat2ens=grd_ens%lon/lat2 in cplr_get_fv3_regional_ensperts.f90. --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 46 +++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index c68b908c0a..fe943985d2 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -362,7 +362,7 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g ! ! Declare local variables - integer(i_kind):: i,j,k,kp,lon2ens,lat2ens + integer(i_kind):: i,j,k,kp integer(i_kind) iderivative @@ -392,36 +392,34 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens - lon2ens=grd_ens%lon2 - lat2ens=grd_ens%lat2 if (dual_res) then if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.true.) else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.true.) endif if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.true.) else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.true.) endif else if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.false.) else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.false.) endif if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.false.) else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.false.) endif end if if (fv3sar_ensemble_opt == 0) then if (dual_res) then - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,grd_ens%lat2,grd_ens%lon2,.true.) else - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,grd_ens%lat2,grd_ens%lon2,.false.) end if g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid do i=grd_ens%nsig,1,-1 @@ -430,9 +428,9 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g g_ps(:,:)=g_prsi(:,:,1) else ! for the ensemble processed frm CHGRES if (dual_res) then - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,grd_ens%lat2,grd_ens%lon2,.true.) else - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,grd_ens%lat2,grd_ens%lon2,.false.) end if g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 @@ -442,19 +440,19 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g if (dual_res) then if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,lat2ens,lon2ens,.true.) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.true.) else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,lat2ens,lon2ens,.true.) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,lat2ens,lon2ens,.true.) + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.true.) endif else if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,lat2ens,lon2ens,.false.) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.false.) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.false.) else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,lat2ens,lon2ens,.false.) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,lat2ens,lon2ens,.false.) + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.false.) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.false.) endif end if @@ -477,7 +475,7 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g end do end do end do - call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),lat2ens,lon2ens,grd_ens%nsig,ice,iderivative) + call genqsat(g_rh,g_tsen(1,1,1),g_prsl(1,1,1),grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,ice,iderivative) do k=1,grd_ens%nsig do j=1,grd_ens%lon2 do i=1,grd_ens%lat2 From daefeff129c246ecaf7dbc5e6b0902ee88aee019 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Sun, 21 Feb 2021 15:10:25 -0600 Subject: [PATCH 064/155] Add a build option to build gsi/enkf in the FV3reg mode. --- CMakeLists.txt | 2 +- ush/build_all_cmake.sh | 2 + ush/build_enkf_cmake.sh | 97 ----------------------------------------- 3 files changed, 3 insertions(+), 98 deletions(-) delete mode 100755 ush/build_enkf_cmake.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index d35ae3e184..afda561aec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ project(GSI) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PROFILE" BUILD_PROFILE) - if( BUILD_PRODUCTION ) + if(( BUILD_PRODUCTION ) OR ( BUILD_FV3reg MATCHES "ON" )) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/exec ) endif() if( BUILD_PROFILE ) diff --git a/ush/build_all_cmake.sh b/ush/build_all_cmake.sh index ceaf91d9c7..4d70a6e1ca 100755 --- a/ush/build_all_cmake.sh +++ b/ush/build_all_cmake.sh @@ -81,6 +81,8 @@ fi if [ $build_type = PRODUCTION -o $build_type = DEBUG ] ; then cmake -DBUILD_UTIL=ON -DBUILD_NCDIAG_SERIAL=ON -DCMAKE_BUILD_TYPE=$build_type -DBUILD_CORELIBS=OFF .. +elif [ $build_type = BUILD_FV3reg ] ; then + cmake -DBUILD_PRODUCTION=OFF -DBUILD_WRF=OFF -DBUILD_GFS=OFF -DBUILD_NMMB=OFF -DBUILD_FV3reg=ON -DBUILD_UTIL=ON -DBUILD_NCDIAG_SERIAL=ON -DBUILD_CORELIBS=OFF .. else cmake .. fi diff --git a/ush/build_enkf_cmake.sh b/ush/build_enkf_cmake.sh deleted file mode 100755 index d25fa09742..0000000000 --- a/ush/build_enkf_cmake.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -set -ex - -cd .. -pwd=$(pwd) - -build_type=${1:-'PRODUCTION'} -dir_root=${2:-$pwd} - -if [[ -d /dcom && -d /hwrf ]] ; then - . /usrx/local/Modules/3.2.10/init/sh - target=wcoss - . $MODULESHOME/init/sh -elif [[ -d /cm ]] ; then - . $MODULESHOME/init/sh - target=wcoss_c -elif [[ -d /ioddev_dell ]]; then - . $MODULESHOME/init/sh - target=wcoss_d -elif [[ -d /scratch1 ]] ; then - . /apps/lmod/lmod/init/sh - target=hera -elif [[ -d /carddata ]] ; then - . /opt/apps/lmod/3.1.9/init/sh - target=s4 -elif [[ -d /jetmon ]] ; then - . $MODULESHOME/init/sh - target=jet -elif [[ -d /glade ]] ; then - . $MODULESHOME/init/sh - target=cheyenne -elif [[ -d /sw/gaea ]] ; then - . /opt/cray/pe/modules/3.2.10.5/init/sh - target=gaea -elif [[ -d /discover ]] ; then -# . /opt/cray/pe/modules/3.2.10.5/init/sh - target=discover - build_type=0 - export SPACK_ROOT=/discover/nobackup/mapotts1/spack - export PATH=$PATH:$SPACK_ROOT/bin - . $SPACK_ROOT/share/spack/setup-env.sh -elif [[ -d /work ]]; then - . $MODULESHOME/init/sh - target=orion -else - echo "unknown target = $target" - exit 9 -fi - -dir_modules=$dir_root/modulefiles -if [ ! -d $dir_modules ]; then - echo "modulefiles does not exist in $dir_modules" - exit 10 -fi -[ -d $dir_root/exec ] || mkdir -p $dir_root/exec - -rm -rf $dir_root/build -mkdir -p $dir_root/build -cd $dir_root/build - -if [ $target = wcoss_d ]; then - module purge - module use -a $dir_modules - module load modulefile.ProdGSI.$target -elif [ $target = wcoss -o $target = gaea ]; then - module purge - module load $dir_modules/modulefile.ProdGSI.$target -elif [ $target = hera -o $target = cheyenne -o $target = orion ]; then - module purge - source $dir_modules/modulefile.ProdGSI.$target -elif [ $target = wcoss_c ]; then - module purge - module load $dir_modules/modulefile.ProdGSI.$target -elif [ $target = discover ]; then - module load $dir_modules/modulefile.ProdGSI.$target -else - module purge - source $dir_modules/modulefile.ProdGSI.$target -fi - -#if [ $build_type = PRODUCTION -o $build_type = DEBUG ] ; then -# cmake -DBUILD_UTIL=ON -DBUILD_NCDIAG_SERIAL=ON -DCMAKE_BUILD_TYPE=$build_type -DBUILD_CORELIBS=OFF .. -#else -# cmake .. -#fi - -#make -j 8 - -# Build FV3 regional enkf executable -cmake -DBUILD_PRODUCTION=off -DBUILD_WRF=off -DBUILD_GFS=off -DBUILD_NMMB=off -DBUILD_FV3reg=on .. - -make -j 8 - -cp -p bin/enkf_fv3reg.x ../exec/ - -exit From 269118e15bc0e5bd28687a4d6418aa85273d9205 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Mon, 15 Mar 2021 12:02:46 -0500 Subject: [PATCH 065/155] Remove the submodules fix and libsrc. --- .gitmodules | 8 -------- fix | 1 - libsrc | 1 - 3 files changed, 10 deletions(-) delete mode 160000 fix delete mode 160000 libsrc diff --git a/.gitmodules b/.gitmodules index cd366203c3..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +0,0 @@ -[submodule "fix"] - path = fix - url = gerrit:GSI-fix - branch = master -[submodule "libsrc"] - path = libsrc - url = gerrit:GSI-libsrc - branch = master diff --git a/fix b/fix deleted file mode 160000 index 82c9a46fab..0000000000 --- a/fix +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 82c9a46fabd8d04686589241c36381ab17810cfd diff --git a/libsrc b/libsrc deleted file mode 160000 index 071859a5c7..0000000000 --- a/libsrc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 071859a5c799761be786ccc4d17df6b2d0deb6e0 From 8f0e607b0622befbdda673d7f339d0eeca49c85f Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Mon, 15 Mar 2021 12:03:39 -0500 Subject: [PATCH 066/155] Import libsrc/wrflib directly. --- libsrc/wrflib/CMakeLists.txt | 11 + libsrc/wrflib/ext_ncd_get_dom_ti.code | 157 + libsrc/wrflib/ext_ncd_get_var_td.code | 227 + libsrc/wrflib/ext_ncd_get_var_ti.code | 174 + libsrc/wrflib/ext_ncd_put_dom_ti.code | 164 + libsrc/wrflib/ext_ncd_put_var_td.code | 233 + libsrc/wrflib/ext_ncd_put_var_ti.code | 144 + libsrc/wrflib/field_routines.F90 | 175 + libsrc/wrflib/io_int_stubs.f90 | 157 + libsrc/wrflib/model_data_order.inc | 8 + libsrc/wrflib/module_driver_constants.F90 | 180 + libsrc/wrflib/module_machine.F90 | 175 + libsrc/wrflib/pack_utils.c | 390 + libsrc/wrflib/streams.h | 16 + libsrc/wrflib/transpose.code | 40 + libsrc/wrflib/wrf_io.F90.orig | 3685 ++++++++++ libsrc/wrflib/wrf_io.f90 | 8169 +++++++++++++++++++++ libsrc/wrflib/wrf_io_flags.h | 15 + libsrc/wrflib/wrf_status_codes.h | 133 + 19 files changed, 14253 insertions(+) create mode 100644 libsrc/wrflib/CMakeLists.txt create mode 100644 libsrc/wrflib/ext_ncd_get_dom_ti.code create mode 100644 libsrc/wrflib/ext_ncd_get_var_td.code create mode 100644 libsrc/wrflib/ext_ncd_get_var_ti.code create mode 100644 libsrc/wrflib/ext_ncd_put_dom_ti.code create mode 100644 libsrc/wrflib/ext_ncd_put_var_td.code create mode 100644 libsrc/wrflib/ext_ncd_put_var_ti.code create mode 100644 libsrc/wrflib/field_routines.F90 create mode 100755 libsrc/wrflib/io_int_stubs.f90 create mode 100644 libsrc/wrflib/model_data_order.inc create mode 100644 libsrc/wrflib/module_driver_constants.F90 create mode 100644 libsrc/wrflib/module_machine.F90 create mode 100644 libsrc/wrflib/pack_utils.c create mode 100644 libsrc/wrflib/streams.h create mode 100644 libsrc/wrflib/transpose.code create mode 100644 libsrc/wrflib/wrf_io.F90.orig create mode 100644 libsrc/wrflib/wrf_io.f90 create mode 100644 libsrc/wrflib/wrf_io_flags.h create mode 100644 libsrc/wrflib/wrf_status_codes.h diff --git a/libsrc/wrflib/CMakeLists.txt b/libsrc/wrflib/CMakeLists.txt new file mode 100644 index 0000000000..a5e6358025 --- /dev/null +++ b/libsrc/wrflib/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.6) +file(GLOB WRFLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90) +file(GLOB WRFLIB_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +set_source_files_properties( ${WRFLIB_SRC} PROPERTIES COMPILE_FLAGS ${WRFLIB_Fortran_FLAGS} ) +set(WRFLIB_C_FLAGS "${WRFLIB_C_INCLUDES} -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") +set_source_files_properties( ${WRFLIB_C_SRC} PROPERTIES COMPILE_FLAGS ${WRFLIB_C_FLAGS} ) +set( wrflib "WRFLIB" CACHE INTERNAL "WRF Library for I/O" ) +include_directories(${NETCDF_INCLUDE_DIRS}) +add_library( ${wrflib} STATIC ${WRFLIB_SRC} ${WRFLIB_C_SRC} ) +set_target_properties( ${wrflib} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} ) + diff --git a/libsrc/wrflib/ext_ncd_get_dom_ti.code b/libsrc/wrflib/ext_ncd_get_dom_ti.code new file mode 100644 index 0000000000..fe365f153c --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_dom_ti.code @@ -0,0 +1,157 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + TYPE_BUFFER + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,Buffer) +#else + Data = '' + stat = NF_GET_ATT_TEXT(DH%NCID,NF_GLOBAL,Element,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + COPY + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif +ENDIF + return diff --git a/libsrc/wrflib/ext_ncd_get_var_td.code b/libsrc/wrflib/ext_ncd_get_var_td.code new file mode 100644 index 0000000000..bd28dc38a3 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_var_td.code @@ -0,0 +1,227 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + TYPE_BUFFER ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = LENGTH + VCount(2) = 1 +#ifndef CHAR_TYPE + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE (NCID,VarID,VStart,VCount,Buffer) +#else + if(Len1 > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_VARA_TEXT (NCID,VarID,VStart,VCount,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + COPY + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return diff --git a/libsrc/wrflib/ext_ncd_get_var_ti.code b/libsrc/wrflib/ext_ncd_get_var_ti.code new file mode 100644 index 0000000000..47a161ba99 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_var_ti.code @@ -0,0 +1,174 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + TYPE_BUFFER + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif +#ifndef CHAR_TYPE + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) +#else + if(XLen > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), Data ) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + endif + COPY +#ifndef CHAR_TYPE + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/ext_ncd_put_dom_ti.code b/libsrc/wrflib/ext_ncd_put_dom_ti.code new file mode 100644 index 0000000000..2d5b1a3e9e --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_dom_ti.code @@ -0,0 +1,164 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif +ENDIF + return diff --git a/libsrc/wrflib/ext_ncd_put_var_td.code b/libsrc/wrflib/ext_ncd_put_var_td.code new file mode 100644 index 0000000000..750e1ecd37 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_var_td.code @@ -0,0 +1,233 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(LENGTH < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == LENGTH) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),LENGTH,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = LENGTH + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = LENGTH + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_TYPE,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + if(LENGTH > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(LENGTH < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = LENGTH + VCount(2) = 1 +#ifdef LOG + allocate(Buffer(LENGTH), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/ext_ncd_put_var_ti.code b/libsrc/wrflib/ext_ncd_put_var_ti.code new file mode 100644 index 0000000000..05bfc64ca3 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_var_ti.code @@ -0,0 +1,144 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo +#endif +#ifdef CHAR_TYPE + if(len_trim(Data).le.0) then + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element),len_trim(null),null) + else + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), ARGS ) + endif +#else + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), ARGS ) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif +#ifdef LOG + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/field_routines.F90 b/libsrc/wrflib/field_routines.F90 new file mode 100644 index 0000000000..cd9bcfa7bf --- /dev/null +++ b/libsrc/wrflib/field_routines.F90 @@ -0,0 +1,175 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- +subroutine ext_ncd_RealFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + real, dimension(*) ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_REAL(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_REAL(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_RealFieldIO + +subroutine ext_ncd_DoubleFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + real*8 ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_DoubleFieldIO + +subroutine ext_ncd_IntFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + integer ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_IntFieldIO + +subroutine ext_ncd_LogicalFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(NVarDims) ,intent(in) :: VStart + integer,dimension(NVarDims) ,intent(in) :: VCount + logical,dimension(VCount(1),VCount(2),VCount(3)),intent(inout) :: Data + integer ,intent(out) :: Status + integer,dimension(:,:,:),allocatable :: Buffer + integer :: stat + integer :: i,j,k + + allocate(Buffer(VCount(1),VCount(2),VCount(3)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(IO == 'write') then + do k=1,VCount(3) + do j=1,VCount(2) + do i=1,VCount(1) + if(data(i,j,k)) then + Buffer(i,j,k)=1 + else + Buffer(i,j,k)=0 + endif + enddo + enddo + enddo + stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Buffer) + else + stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Buffer) + Data = Buffer == 1 + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_LogicalFieldIO diff --git a/libsrc/wrflib/io_int_stubs.f90 b/libsrc/wrflib/io_int_stubs.f90 new file mode 100755 index 0000000000..83c580a57d --- /dev/null +++ b/libsrc/wrflib/io_int_stubs.f90 @@ -0,0 +1,157 @@ +! Stubs version of wrf io spi subroutines +! +!--- get_dom_ti_real +SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) + INTEGER , INTENT(IN) :: DataHandle + CHARACTER*(*) :: Element + REAL , INTENT(INOUT) :: Data(*) + INTEGER , INTENT(IN) :: Count + INTEGER , INTENT(INOUT) :: Outcount + INTEGER , INTENT(INOUT) :: Status + + write(6,*) 'Calling dummy 1' +RETURN +END SUBROUTINE ext_int_get_dom_ti_real + + +SUBROUTINE ext_int_get_dom_ti_integer ( DataHandle,Element, Data, Count, Outcount, Status ) + + write(6,*) 'Calling dummy 2' +RETURN +END SUBROUTINE ext_int_get_dom_ti_integer + + +!--- get_dom_ti_char +SUBROUTINE ext_int_get_dom_ti_char ( DataHandle,Element, Data, Status ) + write(6,*) 'Calling dummy 3' + +RETURN +END SUBROUTINE ext_int_get_dom_ti_char + + +!--- get_var_info +SUBROUTINE ext_int_get_var_info ( DataHandle , VarName , NDim , MemoryOrder , Stagger , & + DomainStart , DomainEnd , WrfType, Status ) + + write(6,*) 'Calling dummy 4' +RETURN +END SUBROUTINE ext_int_get_var_info + + +!--- read_field +SUBROUTINE ext_int_read_field ( DataHandle , DateStr , VarName , Field , FieldType , Comm , IOComm, & + DomainDesc , MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + write(6,*) 'Calling dummy 5' + RETURN + +END SUBROUTINE ext_int_read_field + + +!--- close +SUBROUTINE ext_int_ioclose ( DataHandle, Status ) + + write(6,*) 'Calling dummy 6' + RETURN +END SUBROUTINE ext_int_ioclose + + +!--- initialize +SUBROUTINE ext_int_ioinit( SysDepInfo, Status ) + + write(6,*) 'Calling dummy 7' +END SUBROUTINE ext_int_ioinit + + + +!--- open_for_read +SUBROUTINE ext_int_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & + DataHandle , Status ) + + write(6,*) 'Calling dummy 8' + RETURN +END SUBROUTINE ext_int_open_for_read + + + +!SUBROUTINE int_get_ti_header_c ( hdrbuf, hdrbufsize, n, itypesize, typesize, & +! DataHandle, Data, Count, code ) + +! write(6,*) 'Calling dummy 9' +!RETURN +!END SUBROUTINE int_get_ti_header_c + + +! NETCDF STUBS +!SUBROUTINE ext_ncd_ioinit(SysDepInfo, Status) + +!RETURN +!END SUBROUTINE ext_ncd_ioinit + + +!subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + +!RETURN +!END subroutine ext_ncd_open_for_read + + +!subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) + +!RETURN +!END subroutine ext_ncd_get_dom_ti_integer + + +!subroutine ext_ncd_ioclose(DataHandle, Status) + +! return +!end subroutine ext_ncd_ioclose + + +!subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) + +! return +!end subroutine ext_ncd_get_dom_ti_char + + +!subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,Status) + +! return +!end subroutine ext_ncd_get_dom_ti_real + + +!subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder, & +! Stagger,DomainStart,DomainEnd,WrfType,Status) + +! return +!end subroutine ext_ncd_get_var_info + + +!subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & +! IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & +! DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + +! return +!end subroutine ext_ncd_read_field + + +!subroutine wrf_error_fatal(massage) + +!stop +!end subroutine wrf_error_fatal + + +!subroutine int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, typesize, & +! DataHandle, Data, Count, code ) +! write(6,*) 'Calling dummy 10' +!RETURN +!END SUBROUTINE int_gen_ti_header_c + + + + + + + diff --git a/libsrc/wrflib/model_data_order.inc b/libsrc/wrflib/model_data_order.inc new file mode 100644 index 0000000000..91a5098b8f --- /dev/null +++ b/libsrc/wrflib/model_data_order.inc @@ -0,0 +1,8 @@ +!STARTOFREGISTRYGENERATEDINCLUDE 'inc/model_data_order.inc' +! +! WARNING This file is generated automatically by use_registry +! using the data base in the file named Registry. +! Do not edit. Your changes to this file will be lost. +! +INTEGER , PARAMETER :: model_data_order = DATA_ORDER_XZY +!ENDOFREGISTRYGENERATEDINCLUDE diff --git a/libsrc/wrflib/module_driver_constants.F90 b/libsrc/wrflib/module_driver_constants.F90 new file mode 100644 index 0000000000..e5e7f71872 --- /dev/null +++ b/libsrc/wrflib/module_driver_constants.F90 @@ -0,0 +1,180 @@ +!WRF:DRIVER_LAYER:CONSTANTS +! +! This MODULE contains all of the constants used in the model. These +! are separated by usage within the code. + +#define MAX_DOMAINS_F 21 +# define IWORDSIZE 4 +# define DWORDSIZE 8 +# define RWORDSIZE 4 +# define LWORDSIZE 4 + +MODULE module_driver_constants + + ! 0. The following tells the rest of the model what data ordering we are + ! using + + INTEGER , PARAMETER :: DATA_ORDER_XYZ = 1 + INTEGER , PARAMETER :: DATA_ORDER_YXZ = 2 + INTEGER , PARAMETER :: DATA_ORDER_ZXY = 3 + INTEGER , PARAMETER :: DATA_ORDER_ZYX = 4 + INTEGER , PARAMETER :: DATA_ORDER_XZY = 5 + INTEGER , PARAMETER :: DATA_ORDER_YZX = 6 + INTEGER , PARAMETER :: DATA_ORDER_XY = DATA_ORDER_XYZ + INTEGER , PARAMETER :: DATA_ORDER_YX = DATA_ORDER_YXZ + + +#include "model_data_order.inc" + + ! 1. Following are constants for use in defining maximal values for array + ! definitions. + ! + + ! The maximum number of levels in the model is how deeply the domains may + ! be nested. + + INTEGER , PARAMETER :: max_levels = 20 + + ! The maximum number of nests that can depend on a single parent and other way round + + INTEGER , PARAMETER :: max_nests = 20 + + ! The maximum number of parents that a nest can have (simplified assumption -> one only) + + INTEGER , PARAMETER :: max_parents = 1 + + ! The maximum number of domains is how many grids the model will be running. + + INTEGER , PARAMETER :: max_domains = ( MAX_DOMAINS_F - 1 ) / 2 + 1 + + ! The maximum number of nest move specifications allowed in a namelist + + INTEGER , PARAMETER :: max_moves = 50 + + ! The maximum number of eta levels + !DJW 140701 Increased from 501 to 1001 since I can imagine using more than + !501 total vertical levels across multiple nested domains. Now that the + !code is modified to allow specification of all domains eta_levels using a + !array of length max_eta, this will need to be larger. I'll also add a check + !in module_initialize_real to ensure we don't exceed this value. + + INTEGER , PARAMETER :: max_eta = 1001 + + ! The maximum number of ocean levels in the 3d U Miami ocean. + + INTEGER , PARAMETER :: max_ocean = 501 + + ! The maximum number of pressure levels to interpolate to, for diagnostics + + INTEGER , PARAMETER :: max_plevs = 100 + + ! The maximum number of height levels to interpolate to, for diagnostics + + INTEGER , PARAMETER :: max_zlevs = 100 + + ! The maximum number of trackchem + + INTEGER , PARAMETER :: max_trackchem = 100 + + ! The maximum number of outer iterations (for DA minimisation) + + INTEGER , PARAMETER :: max_outer_iterations = 100 + + ! The maximum number of instruments (for radiance DA) + + INTEGER , PARAMETER :: max_instruments = 30 + + ! The maximum number of obs indexes (for conventional DA obs) + + INTEGER , PARAMETER :: num_ob_indexes = 28 + + + ! The maximum number of bogus storms + + INTEGER , PARAMETER :: max_bogus = 5 + + ! The maximum number of fields that can be sent or received in coupled mode + + INTEGER , PARAMETER :: max_cplfld = 20 + + ! The maximum number of domains used by the external model with which wrf is communicating in coupled mode + + INTEGER , PARAMETER :: max_extdomains = 5 + + ! 2. Following related to driver level data structures for DM_PARALLEL communications + +#ifdef DM_PARALLEL + INTEGER , PARAMETER :: max_comms = 1024 +#else + INTEGER , PARAMETER :: max_comms = 1 +#endif + + ! 3. Following is information related to the file I/O. + + ! These are the bounds of the available FORTRAN logical unit numbers for the file I/O. + ! Only logical unit numbers within these bounds will be chosen for I/O unit numbers. + + INTEGER , PARAMETER :: min_file_unit = 10 + INTEGER , PARAMETER :: max_file_unit = 99 + + ! 4. Unfortunately, the following definition is needed here (rather + ! than the more logical place in share/module_model_constants.F) + ! for the namelist reads in frame/module_configure.F, and for some + ! conversions in share/set_timekeeping.F + ! Actually, using it here will mean that we don't need to set it + ! in share/module_model_constants.F, since this file will be + ! included (USEd) in: + ! frame/module_configure.F + ! which will be USEd in: + ! share/module_bc.F + ! which will be USEd in: + ! phys/module_radiation_driver.F + ! which is the other important place for it to be, and where + ! it is passed as a subroutine parameter to any physics subroutine. + ! + ! P2SI is the number of SI seconds in an planetary solar day + ! divided by the number of SI seconds in an earth solar day +#if defined MARS + ! For Mars, P2SI = 88775.2/86400. + REAL , PARAMETER :: P2SI = 1.0274907 +#elif defined TITAN + ! For Titan, P2SI = 1378080.0/86400. + REAL , PARAMETER :: P2SI = 15.95 +#else + ! Default for Earth + REAL , PARAMETER :: P2SI = 1.0 +#endif + CONTAINS + SUBROUTINE init_module_driver_constants + END SUBROUTINE init_module_driver_constants + END MODULE module_driver_constants + +! routines that external packages can call to get at WRF stuff that isn't available +! through argument lists; since they are external we don't want them using WRF +! modules unnecessarily (complicates the build even more) + SUBROUTINE inquire_of_wrf_data_order_xyz( data_order ) + USE module_driver_constants, ONLY : DATA_ORDER_XYZ + IMPLICIT NONE + INTEGER, INTENT(OUT) :: data_order + data_order = DATA_ORDER_XYZ + END SUBROUTINE inquire_of_wrf_data_order_xyz + + SUBROUTINE inquire_of_wrf_data_order_xzy( data_order ) + USE module_driver_constants, ONLY : DATA_ORDER_XZY + IMPLICIT NONE + INTEGER, INTENT(OUT) :: data_order + data_order = DATA_ORDER_XZY + END SUBROUTINE inquire_of_wrf_data_order_xzy + + SUBROUTINE inquire_of_wrf_iwordsize( iwordsz ) + IMPLICIT NONE + INTEGER, INTENT(OUT) :: iwordsz + iwordsz = IWORDSIZE + END SUBROUTINE inquire_of_wrf_iwordsize + + SUBROUTINE inquire_of_wrf_rwordsize( rwordsz ) + IMPLICIT NONE + INTEGER, INTENT(OUT) :: rwordsz + rwordsz = RWORDSIZE + END SUBROUTINE inquire_of_wrf_rwordsize + diff --git a/libsrc/wrflib/module_machine.F90 b/libsrc/wrflib/module_machine.F90 new file mode 100644 index 0000000000..1888337f39 --- /dev/null +++ b/libsrc/wrflib/module_machine.F90 @@ -0,0 +1,175 @@ +!WRF:DRIVER_LAYER:DECOMPOSITION +! +# define IWORDSIZE 4 +# define DWORDSIZE 8 +# define RWORDSIZE 4 +# define LWORDSIZE 4 + +MODULE module_machine + + USE module_driver_constants + + ! Machine characteristics and utilities here. + + ! Tile strategy defined constants + INTEGER, PARAMETER :: TILE_NONE = 0, TILE_X = 1, TILE_Y = 2, TILE_XY = 3 + + CONTAINS + + RECURSIVE SUBROUTINE rlocproc(p,maxi,nproc,ml,mr,ret) + IMPLICIT NONE + INTEGER, INTENT(IN) :: p, maxi, nproc, ml, mr + INTEGER, INTENT(OUT) :: ret + INTEGER :: width, rem, ret2, bl, br, mid, adjust, & + p_r, maxi_r, nproc_r, zero + adjust = 0 + rem = mod( maxi, nproc ) + width = maxi / nproc + mid = maxi / 2 + IF ( rem>0 .AND. (((mod(rem,2).EQ.0).OR.(rem.GT.2)).OR.(p.LE.mid))) THEN + width = width + 1 + END IF + IF ( p.LE.mid .AND. mod(rem,2).NE.0 ) THEN + adjust = adjust + 1 + END IF + bl = max(width,ml) ; + br = max(width,mr) ; + IF (pmaxi-br-1) THEN + ret = nproc-1 + ELSE + p_r = p - bl + maxi_r = maxi-bl-br+adjust + nproc_r = max(nproc-2,1) + zero = 0 + CALL rlocproc( p_r, maxi_r, nproc_r, zero, zero, ret2 ) ! Recursive + ret = ret2 + 1 + END IF + RETURN + END SUBROUTINE rlocproc + + INTEGER FUNCTION locproc( i, m, numpart ) + implicit none + integer, intent(in) :: i, m, numpart + integer :: retval, ii, im, inumpart, zero + ii = i + im = m + inumpart = numpart + zero = 0 + CALL rlocproc( ii, im, inumpart, zero, zero, retval ) + locproc = retval + RETURN + END FUNCTION locproc + + SUBROUTINE patchmap( res, y, x, py, px ) + implicit none + INTEGER, INTENT(IN) :: y, x, py, px + INTEGER, DIMENSION(x,y), INTENT(OUT) :: res + INTEGER :: i, j, p_min, p_maj + DO j = 0,y-1 + p_maj = locproc( j, y, py ) + DO i = 0,x-1 + p_min = locproc( i, x, px ) + res(i+1,j+1) = p_min + px*p_maj + END DO + END DO + RETURN + END SUBROUTINE patchmap + + SUBROUTINE region_bounds( region_start, region_end, & + num_p, p, & + patch_start, patch_end ) + ! 1-D decomposition routine: Given starting and ending indices of a + ! vector, the number of patches dividing the vector, and the number of + ! the patch, give the start and ending indices of the patch within the + ! vector. This will work with tiles too. Implementation note. This is + ! implemented somewhat inefficiently, now, with a loop, so we can use the + ! locproc function above, which returns processor number for a given + ! index, whereas what we want is index for a given processor number. + ! With a little thought and a lot of debugging, we can come up with a + ! direct expression for what we want. For time being, we loop... + ! Remember that processor numbering starts with zero. + + IMPLICIT NONE + INTEGER, INTENT(IN) :: region_start, region_end, num_p, p + INTEGER, INTENT(OUT) :: patch_start, patch_end + INTEGER :: offset, i + patch_end = -999999999 + patch_start = 999999999 + offset = region_start + do i = 0, region_end - offset + if ( locproc( i, region_end-region_start+1, num_p ) == p ) then + patch_end = max(patch_end,i) + patch_start = min(patch_start,i) + endif + enddo + patch_start = patch_start + offset + patch_end = patch_end + offset + RETURN + END SUBROUTINE region_bounds + + SUBROUTINE least_aspect( nparts, minparts_y, minparts_x, nparts_y, nparts_x ) + IMPLICIT NONE + ! Input data. + INTEGER, INTENT(IN) :: nparts, & + minparts_y, minparts_x + ! Output data. + INTEGER, INTENT(OUT) :: nparts_y, nparts_x + ! Local data. + INTEGER :: x, y, mini + mini = 2*nparts + nparts_y = 1 + nparts_x = nparts + DO y = 1, nparts + IF ( mod( nparts, y ) .eq. 0 ) THEN + x = nparts / y + IF ( abs( y-x ) .LT. mini & + .AND. y .GE. minparts_y & + .AND. x .GE. minparts_x ) THEN + mini = abs( y-x ) + nparts_y = y + nparts_x = x + END IF + END IF + END DO + END SUBROUTINE least_aspect + + SUBROUTINE init_module_machine + RETURN + END SUBROUTINE init_module_machine + +END MODULE module_machine + +SUBROUTINE wrf_sizeof_integer( retval ) + IMPLICIT NONE + INTEGER retval +! IWORDSIZE is defined by CPP + retval = IWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_integer + +SUBROUTINE wrf_sizeof_real( retval ) + IMPLICIT NONE + INTEGER retval +! RWORDSIZE is defined by CPP + retval = RWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_real + +SUBROUTINE wrf_sizeof_doubleprecision( retval ) + IMPLICIT NONE + INTEGER retval +! DWORDSIZE is defined by CPP + retval = DWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_doubleprecision + +SUBROUTINE wrf_sizeof_logical( retval ) + IMPLICIT NONE + INTEGER retval +! LWORDSIZE is defined by CPP + retval = LWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_logical + diff --git a/libsrc/wrflib/pack_utils.c b/libsrc/wrflib/pack_utils.c new file mode 100644 index 0000000000..3caa8cc04f --- /dev/null +++ b/libsrc/wrflib/pack_utils.c @@ -0,0 +1,390 @@ +#ifndef MS_SUA +# include +# include +#endif +#include +#include "streams.h" + +#ifndef CRAY +# ifdef NOUNDERSCORE +# define INT_PACK_DATA int_pack_data +# define INT_GET_TI_HEADER_C int_get_ti_header_c +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field +# define PERTURB_REAL perturb_real +# define INSPECT_HEADER inspect_header +# define RESET_MASK reset_mask +# define SET_MASK set_mask +# define GET_MASK get_mask +# else +# ifdef F2CSTYLE +# define INT_PACK_DATA int_pack_data__ +# define INT_GET_TI_HEADER_C int_get_ti_header_c__ +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c__ +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c__ +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c__ +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c__ +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field__ +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field__ +# define PERTURB_REAL perturb_real__ +# define INSPECT_HEADER inspect_header__ +# define RESET_MASK reset_mask__ +# define SET_MASK set_mask__ +# define GET_MASK get_mask__ +# else +# define INT_PACK_DATA int_pack_data_ +# define INT_GET_TI_HEADER_C int_get_ti_header_c_ +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c_ +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c_ +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c_ +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c_ +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field_ +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field_ +# define PERTURB_REAL perturb_real_ +# define INSPECT_HEADER inspect_header_ +# define RESET_MASK reset_mask_ +# define SET_MASK set_mask_ +# define GET_MASK get_mask_ +# endif +# endif +#endif + +#ifdef MEMCPY_FOR_BCOPY +# define bcopy(A,B,C) memcpy((B),(A),(C)) +#endif + +/* CALL int_pack_data ( hdrbuf , hdrbufsiz * inttypesize , int_local_output_buffer, int_local_output_cursor ) */ + +void INT_PACK_DATA ( unsigned char *buf , int *ninbytes , unsigned char *obuf, int *cursor ) +{ + int i, lcurs ; + lcurs = *cursor - 1 ; + for ( i = 0 ; i < *ninbytes ; i++ ) + { + obuf[lcurs++] = buf[i] ; + } + *cursor = lcurs+1 ; +} + +int +INT_GEN_TI_HEADER_C ( char * hdrbuf, int * hdrbufsize, /* hdrbufsize is in bytes */ + int * itypesize, int * typesize, + int * DataHandle, char * Data, + int * Count, int * code ) +{ + int i ; + char * p ; + p = hdrbuf ; + p += sizeof(int) ; + bcopy( code, p, sizeof(int) ) ; p += sizeof(int) ; /* 2 */ + bcopy( DataHandle, p, sizeof(int) ) ; p += sizeof(int) ; /* 3 */ + bcopy( typesize, p, sizeof(int) ) ; p += sizeof(int) ; /* 4 */ + bcopy( Count, p, sizeof(int) ) ; p += sizeof(int) ; /* 5 */ + bcopy( Data, p, *Count * *typesize ) ; p += *Count * *typesize ; /* 6++ */ + *hdrbufsize = (int) (p - hdrbuf) ; + bcopy( hdrbufsize, hdrbuf, sizeof(int) ) ; + return(0) ; +} + +int +INT_GET_TI_HEADER_C ( char * hdrbuf, int * hdrbufsize, int * n, /* hdrbufsize and n are in bytes */ + int * itypesize, int * typesize, + int * DataHandle, char * Data, + int * Count, int * code ) +{ + int i ; + char * p ; + p = hdrbuf ; + bcopy( p, hdrbufsize, sizeof(int) ) ; p += sizeof(int) ; /* 1 */ + bcopy( p, code, sizeof(int) ) ; p += sizeof(int) ; /* 2 */ + bcopy( p, DataHandle, sizeof(int) ) ; p += sizeof(int) ; /* 3 */ + bcopy( p, typesize, sizeof(int) ) ; p += sizeof(int) ; /* 4 */ + bcopy( p, Count, sizeof(int) ) ; p += sizeof(int) ; /* 5 */ + if ( *Count * *typesize > 0 ) { + bcopy( p, Data, *Count * *typesize ) ; p += *Count * *typesize ; /* 6++ */ + } + *n = (int)( p - hdrbuf ) ; + return(0) ; +} + +#define MAX_FLDS 2000 +static char fld_name[MAX_FLDS][256] ; +static char *fld_cache[MAX_FLDS] ; +static int fld_curs[MAX_FLDS] ; +static int fld_bufsize[MAX_FLDS] ; +static int fld = 0 ; +static int numflds = 0 ; +static int frst = 1 ; + +int INIT_STORE_PIECE_OF_FIELD () +{ + int i ; + if ( frst ) { + for ( i = 0 ; i < MAX_FLDS ; i++ ) { + fld_cache[i] = NULL ; + } + frst = 0 ; + } + numflds = 0 ; + for ( i = 0 ; i < MAX_FLDS ; i++ ) { + strcpy( fld_name[i], "" ) ; + if ( fld_cache[i] != NULL ) free( fld_cache[i] ) ; + fld_cache[i] = NULL ; + fld_curs[i] = 0 ; + fld_bufsize[i] = 0 ; + } + return(0) ; +} + +int INIT_RETRIEVE_PIECES_OF_FIELD () +{ + fld = 0 ; + return(0) ; +} + +int +ADD_TO_BUFSIZE_FOR_FIELD_C ( int varname[], int * chunksize ) +{ + int i, n ; + int found ; + char vname[256] ; + + n = varname[0] ; + for ( i = 1; i <= n ; i++ ) { vname[i-1] = varname[i] ; } + vname[n] = '\0' ; + + found = -1 ; + for ( i = 0 ; i < numflds ; i++ ) { if ( !strcmp( fld_name[i], vname ) ) { found = i ; break ; } } + if ( found == -1 ) { + found = numflds++ ; + strcpy( fld_name[found], vname ) ; + fld_bufsize[found] = *chunksize ; + } + else + { + fld_bufsize[found] += *chunksize ; + } + if ( fld_cache[found] != NULL ) { free( fld_cache[found] ) ; } + fld_cache[found] = NULL ; + return(0) ; +} + +int +STORE_PIECE_OF_FIELD_C ( char * buf , int varname[], int * chunksize, int *retval ) +{ + int i, n ; + int found ; + char vname[256] ; + + n = varname[0] ; + for ( i = 1; i <= n ; i++ ) { vname[i-1] = varname[i] ; } + vname[n] = '\0' ; + + found = -1 ; + for ( i = 0 ; i < numflds ; i++ ) { if ( !strcmp( fld_name[i], vname ) ) { found = i ; break ; } } + if ( found == -1 ) { +#ifndef MS_SUA + fprintf(stderr,"frame/pack_utils.c: field (%s) not found; was not set up with add_to_bufsize_for_field\n",vname ) ; +#endif + *retval = 1 ; + return(0) ; + } + + if ( fld_cache[found] == NULL ) { + fld_cache[found] = (char *) malloc( fld_bufsize[found] ) ; + fld_curs[found] = 0 ; + } + + if ( fld_curs[found] + *chunksize > fld_bufsize[found] ) { +#ifndef MS_SUA + fprintf(stderr, +"frame/pack_utils.c: %s would overwrite %d + %d > %d [%d]\n",vname, fld_curs[found], *chunksize, fld_bufsize[found], found ) ; +#endif + *retval = 1 ; + return(0) ; + } + + bcopy( buf, fld_cache[found]+fld_curs[found], *chunksize ) ; + fld_curs[found] += *chunksize ; + *retval = 0 ; + return(0) ; +} + +int +RETRIEVE_PIECES_OF_FIELD_C ( char * buf , int varname[], int * insize, int * outsize, int *retval ) +{ + int i, n ; + int found ; + char vname[256] ; + + if ( fld < numflds ) { +#ifndef MS_SUA + if ( fld_curs[fld] > *insize ) { + fprintf(stderr,"retrieve: fld_curs[%d] (%d) > *insize (%d)\n",fld,fld_curs[fld], *insize ) ; + } +#endif + *outsize = ( fld_curs[fld] <= *insize ) ? fld_curs[fld] : *insize ; + bcopy( fld_cache[fld], buf, *outsize ) ; + varname[0] = (int) strlen( fld_name[fld] ) ; + for ( i = 1 ; i <= varname[0] ; i++ ) varname[i] = fld_name[fld][i-1] ; + if ( fld_cache[fld] != NULL ) free ( fld_cache[fld] ) ; + fld_cache[fld] = NULL ; + fld_bufsize[fld] = 0 ; + fld++ ; + *retval = 0 ; + } + else { + numflds = 0 ; + *retval = -1 ; + } + return(0) ; +} + +#define INDEX_2(A,B,NB) ( (B) + (A)*(NB) ) +#define INDEX_3(A,B,C) INDEX_2( (A), INDEX_2( (B), (C), (me[1]-ms[1]+1) ), (me[1]-ms[1]+1)*(me[0]-ms[0]+1) ) +/* flip low order bit of fp number */ +int +PERTURB_REAL ( float * field, int ds[], int de[], int ms[], int me[], int ps[], int pe[] ) +{ + int i,j,k ; + int le ; /* index of little end */ + float x = 2.0 ; + unsigned int y ; + unsigned char a[4], *p ; + if ( sizeof(float) != 4 ) return(-1) ; + /* check endianness of machine */ + bcopy ( &x, a, 4 ) ; + le = 0 ; + if ( a[0] == 0x40 ) le = 3 ; + for ( k = ps[2]-ms[2] ; k <= pe[2]-ms[2] ; k++ ) + for ( j = ps[1]-ms[1] ; j <= pe[1]-ms[1] ; j++ ) + for ( i = ps[0]-ms[0] ; i <= pe[0]-ms[0] ; i++ ) + { + /* do not change zeros */ + if ( field[ INDEX_3(k,j,i) ] != 0.0 ) { + p = (unsigned char *)&(field[ INDEX_3(k,j,i) ] ) ; + if ( *(p+le) & 1 ) { *(p+le) &= 0x7e ; } + else { *(p+le) |= 1 ; } + } + } + return(0) ; +} + +int INSPECT_HEADER ( char * buf, int * sz, int * line ) +{ + int i ; +#ifndef MS_SUA + fprintf(stderr,"INSPECT_HEADER: line = %d ", *line ) ; + if ( buf != NULL && sz != NULL ) { + for ( i = 0 ; i < *sz && i < 256 ; i++ ) { if ( (buf[i] >= 'a' && buf[i] <= 'z') || buf[i] == '_' || + (buf[i] >= 'A' && buf[i] <= 'Z') || + (buf[i] >= '0' && buf[i] <= '9') ) fprintf(stderr,"%c",buf[i]) ; + } + fprintf(stderr,"\n") ; + } +#endif + return(0) ; +} + +/* note that these work the same as the routines in tools/misc.c, but are Fortran callable. + They must be kept in sync, functionally. */ + +void +RESET_MASK ( unsigned int * mask , int *e ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; + n = 1 ; + m = ~( n << *e % (8*sizeof(int)-1) ) ; + if ( w >= 0 && w < IO_MASK_SIZE ) { + mask[w] &= m ; + } +} + +void +SET_MASK ( unsigned int * mask , int *e ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; + n = 1 ; + m = ( n << *e % (8*sizeof(int)-1) ) ; + if ( w >= 0 && w < IO_MASK_SIZE ) { + mask[w] |= m ; + } +} + +/* this is slightly different from in tools dir since it returns result as argument, not function */ +/* definition of IO_MASK_SIZE comes from build and must be uniform with frame/module_domain_type.F and + version of this function in tools dir */ +void +GET_MASK ( unsigned int * mask , int *e , int * retval ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; /* 8 is number of bits per byte */ + if ( w >= 0 && w < IO_MASK_SIZE ) { + m = mask[w] ; + n = ( 1 << *e % (8*sizeof(int)-1) ) ;; + *retval = ( (m & n) != 0 ) ; + } else { + *retval = 0 ; + } +} + +#ifdef WRAP_MALLOC +# ifndef WRAP_MALLOC_ALIGNMENT +# define WRAP_MALLOC_ALIGNMENT 128 +# endif +# define _XOPEN_SOURCE 600 +# include +void *malloc(size_t size) +{ + void *tmp; + if (posix_memalign(&tmp, WRAP_MALLOC_ALIGNMENT, size) == 0) + return tmp; + else { + errno = ENOMEM; + return NULL; + } +} +#endif + +#ifndef DM_PARALLEL +# ifndef CRAY +# ifdef NOUNDERSCORE +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock +# else +# ifdef F2CSTYLE +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock__ +# else +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock_ +# endif +# endif +# endif +# if !defined(MS_SUA) && !defined(_WIN32) +# include +int RSL_INTERNAL_MICROCLOCK () +{ + struct timeval tb ; + struct timezone tzp ; + int isec ; /* seconds */ + int usec ; /* microseconds */ + int msecs ; + gettimeofday( &tb, &tzp ) ; + isec = tb.tv_sec ; + usec = tb.tv_usec ; + msecs = 1000000 * isec + usec ; + return(msecs) ; +} +# endif +#endif + diff --git a/libsrc/wrflib/streams.h b/libsrc/wrflib/streams.h new file mode 100644 index 0000000000..645b02d855 --- /dev/null +++ b/libsrc/wrflib/streams.h @@ -0,0 +1,16 @@ +#ifndef MAX_HISTORY +# define MAX_HISTORY 12 +#endif +#ifndef IWORDSIZE +# define IWORDSIZE 4 +#endif +#define HISTORY_STREAM 0 +#define INPUT_STREAM ((HISTORY_STREAM)+(MAX_HISTORY)) +#if 0 + max streams is MAX_HISTORY plus equal number of input streams plus 1 restart + 1 boundary +#endif +#define MAX_STREAMS (2*(MAX_HISTORY)+2) +#define BOUNDARY_STREAM (2*(MAX_HISTORY)+1) +#define RESTART_STREAM (2*(MAX_HISTORY)+2) +#define IO_MASK_SIZE ((MAX_STREAMS)/(IWORDSIZE*8)+1) + diff --git a/libsrc/wrflib/transpose.code b/libsrc/wrflib/transpose.code new file mode 100644 index 0000000000..746be42fcb --- /dev/null +++ b/libsrc/wrflib/transpose.code @@ -0,0 +1,40 @@ + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 + +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + DFIELD = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = DFIELD + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + + return diff --git a/libsrc/wrflib/wrf_io.F90.orig b/libsrc/wrflib/wrf_io.F90.orig new file mode 100644 index 0000000000..4288b98e68 --- /dev/null +++ b/libsrc/wrflib/wrf_io.F90.orig @@ -0,0 +1,3685 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + +module wrf_data + + integer , parameter :: FATAL = 1 + integer , parameter :: WARN = 1 + integer , parameter :: WrfDataHandleMax = 99 + integer , parameter :: MaxDims = 2000 ! = NF_MAX_VARS +#if(WRF_CHEM == 1) + integer , parameter :: MaxVars = 10000 +#else + integer , parameter :: MaxVars = 3000 +#endif + integer , parameter :: MaxTimes = 10000 + integer , parameter :: DateStrLen = 19 + integer , parameter :: VarNameLen = 31 + integer , parameter :: NO_DIM = 0 + integer , parameter :: NVarDims = 4 + integer , parameter :: NMDVarDims = 2 + character (8) , parameter :: NO_NAME = 'NULL' + character (DateStrLen) , parameter :: ZeroDate = '0000-00-00-00:00:00' + +#include "wrf_io_flags.h" + + character (256) :: msg + logical :: WrfIOnotInitialized = .true. + + type :: wrf_data_handle + character (255) :: FileName + integer :: FileStatus + integer :: Comm + integer :: NCID + logical :: Free + logical :: Write + character (5) :: TimesName + integer :: TimeIndex + integer :: CurrentTime !Only used for read + integer :: NumberTimes !Only used for read + character (DateStrLen), pointer :: Times(:) + integer :: TimesVarID + integer , pointer :: DimLengths(:) + integer , pointer :: DimIDs(:) + character (31) , pointer :: DimNames(:) + integer :: DimUnlimID + character (9) :: DimUnlimName + integer , dimension(NVarDims) :: DimID + integer , dimension(NVarDims) :: Dimension + integer , pointer :: MDVarIDs(:) + integer , pointer :: MDVarDimLens(:) + character (80) , pointer :: MDVarNames(:) + integer , pointer :: VarIDs(:) + integer , pointer :: VarDimLens(:,:) + character (VarNameLen), pointer :: VarNames(:) + integer :: CurrentVariable !Only used for read + integer :: NumVars +! first_operation is set to .TRUE. when a new handle is allocated +! or when open-for-write or open-for-read are committed. It is set +! to .FALSE. when the first field is read or written. + logical :: first_operation + logical :: R4OnOutput + logical :: nofill + logical :: use_netcdf_classic + end type wrf_data_handle + type(wrf_data_handle),target :: WrfDataHandles(WrfDataHandleMax) +end module wrf_data + +module ext_ncd_support_routines + + implicit none + +CONTAINS + +subroutine allocHandle(DataHandle,DH,Comm,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(out) :: DataHandle + type(wrf_data_handle),pointer :: DH + integer ,intent(IN) :: Comm + integer ,intent(out) :: Status + integer :: i + integer :: stat + + do i=1,WrfDataHandleMax + if(WrfDataHandles(i)%Free) then + DH => WrfDataHandles(i) + DataHandle = i + allocate(DH%Times(MaxTimes), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimLengths(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimIDs(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimNames(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarDimLens(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarDimLens(NVarDims-1,MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + exit + endif + if(i==WrfDataHandleMax) then + Status = WRF_WARN_TOO_MANY_FILES + write(msg,*) 'Warning TOO MANY FILES in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) 'Did you call ext_ncd_ioinit?' + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + DH%Free =.false. + DH%Comm = Comm + DH%Write =.false. + DH%first_operation = .TRUE. + DH%R4OnOutput = .false. + DH%nofill = .false. + Status = WRF_NO_ERR +end subroutine allocHandle + +subroutine deallocHandle(DataHandle, Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + + IF ( DataHandle .GE. 1 .AND. DataHandle .LE. WrfDataHandleMax ) THEN + if(.NOT. WrfDataHandles(DataHandle)%Free) then + DH => WrfDataHandles(DataHandle) + deallocate(DH%Times, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimLengths, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + DH%Free =.TRUE. + endif + ENDIF + Status = WRF_NO_ERR +end subroutine deallocHandle + +subroutine GetDH(DataHandle,DH,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + type(wrf_data_handle) ,pointer :: DH + integer ,intent(out) :: Status + + if(DataHandle < 1 .or. DataHandle > WrfDataHandleMax) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + DH => WrfDataHandles(DataHandle) + if(DH%Free) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + Status = WRF_NO_ERR + return +end subroutine GetDH + +subroutine DateCheck(Date,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Date + integer ,intent(out) :: Status + + if(len(Date) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + else + Status = WRF_NO_ERR + endif + return +end subroutine DateCheck + +subroutine GetName(Element,Var,Name,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Name + integer ,intent(out) :: Status + character (VarNameLen) :: VarName + character (1) :: c + integer :: i + integer, parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + + VarName = Var + Name = 'MD___'//trim(Element)//VarName + do i=1,len(Name) + c=Name(i:i) + if('A'<=c .and. c <='Z') Name(i:i)=achar(iachar(c)+upper_to_lower) + if(c=='-'.or.c==':') Name(i:i)='_' + enddo + Status = WRF_NO_ERR + return +end subroutine GetName + +subroutine GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: TimeIndex + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VStart(2) + integer :: VCount(2) + integer :: stat + integer :: i + + DH => WrfDataHandles(DataHandle) + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + Status = WRF_WARN_DATESTR_ERROR + write(msg,*) 'Warning DATE STRING ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(IO == 'write') then + TimeIndex = DH%TimeIndex + if(TimeIndex <= 0) then + TimeIndex = 1 + elseif(DateStr == DH%Times(TimeIndex)) then + Status = WRF_NO_ERR + return + else + TimeIndex = TimeIndex +1 + if(TimeIndex > MaxTimes) then + Status = WRF_WARN_TIME_EOF + write(msg,*) 'Warning TIME EOF in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + DH%TimeIndex = TimeIndex + DH%Times(TimeIndex) = DateStr + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = DateStrLen + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT(DH%NCID,DH%TimesVarID,VStart,VCount,DateStr) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + Status = WRF_NO_ERR + TimeIndex = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + write(msg,*) 'Warning TIME ',DateStr,' NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + return +end subroutine GetTimeIndex + +subroutine GetDim(MemoryOrder,NDim,Status) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(out) :: NDim + integer ,intent(out) :: Status + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + NDim = 3 + case ('xy','yx','xs','xe','ys','ye','cc') + NDim = 2 + case ('z','c') + NDim = 1 + case ('0') ! NDim=0 for scalars. TBH: 20060502 + NDim = 0 + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine GetDim + +#ifdef USE_NETCDF4_FEATURES +subroutine set_chunking(MemoryOrder,need_chunking) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + logical ,intent(out) :: need_chunking + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + if(len(MemOrd) >= 2) then + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + need_chunking = .true. + case ('xy','yx') + need_chunking = .true. + case default + need_chunking = .false. + return + end select + endif +end subroutine set_chunking +#endif + +subroutine GetIndices(NDim,Start,End,i1,i2,j1,j2,k1,k2) + integer ,intent(in) :: NDim + integer ,dimension(*),intent(in) :: Start,End + integer ,intent(out) :: i1,i2,j1,j2,k1,k2 + + i1=1 + i2=1 + j1=1 + j2=1 + k1=1 + k2=1 + if(NDim == 0) return ! NDim=0 for scalars. TBH: 20060502 + i1 = Start(1) + i2 = End (1) + if(NDim == 1) return + j1 = Start(2) + j2 = End (2) + if(NDim == 2) return + k1 = Start(3) + k2 = End (3) + return +end subroutine GetIndices + +logical function ZeroLengthHorzDim(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(in) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + logical zero_length + + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + zero_length = .false. + select case (MemOrd) + case ('xsz','xez','ysz','yez','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy','yzx') + zero_length = temp(1) .lt. 1 .or. temp(3) .lt. 1 + case ('xy','yx','xyz','yxz') + zero_length = temp(1) .lt. 1 .or. temp(2) .lt. 1 + case ('zxy','zyx') + zero_length = temp(2) .lt. 1 .or. temp(3) .lt. 1 + case default + Status = WRF_WARN_BAD_MEMORYORDER + ZeroLengthHorzDim = .true. + return + end select + Status = WRF_NO_ERR + ZeroLengthHorzDim = zero_length + return +end function ZeroLengthHorzDim + +subroutine ExtOrder(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(inout) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + Vector(2) = temp(3) + Vector(3) = temp(2) + case ('yxz') + Vector(1) = temp(2) + Vector(2) = temp(1) + case ('yzx') + Vector(1) = temp(3) + Vector(2) = temp(1) + Vector(3) = temp(2) + case ('zxy') + Vector(1) = temp(2) + Vector(2) = temp(3) + Vector(3) = temp(1) + case ('zyx') + Vector(1) = temp(3) + Vector(3) = temp(1) + case ('yx') + Vector(1) = temp(2) + Vector(2) = temp(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrder + +subroutine ExtOrderStr(MemoryOrder,Vector,ROVector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + character*(*),dimension(*) ,intent(in) :: Vector + character(80),dimension(NVarDims),intent(out) :: ROVector + integer ,intent(out) :: Status + integer :: NDim + character*3 :: MemOrd + + call GetDim(MemoryOrder,NDim,Status) + ROVector(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + ROVector(2) = Vector(3) + ROVector(3) = Vector(2) + case ('yxz') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case ('yzx') + ROVector(1) = Vector(3) + ROVector(2) = Vector(1) + ROVector(3) = Vector(2) + case ('zxy') + ROVector(1) = Vector(2) + ROVector(2) = Vector(3) + ROVector(3) = Vector(1) + case ('zyx') + ROVector(1) = Vector(3) + ROVector(3) = Vector(1) + case ('yx') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrderStr + + +subroutine LowerCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + integer :: i,N + + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower) + enddo + return +end subroutine LowerCase + +subroutine UpperCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: lower_to_upper =IACHAR('A')-IACHAR('a') + integer :: i,N + + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c)+lower_to_upper) + enddo + return +end subroutine UpperCase + +subroutine netcdf_err(err,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: err + integer ,intent(out) :: Status + character(len=80) :: errmsg + integer :: stat + + if( err==NF_NOERR )then + Status = WRF_NO_ERR + else + errmsg = NF_STRERROR(err) + write(msg,*) 'NetCDF error: ',errmsg + call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_WARN_NETCDF + endif + return +end subroutine netcdf_err + +subroutine FieldIO(IO,DataHandle,DateStr,Length,MemoryOrder & + ,FieldType,NCID,VarID,XField,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer,dimension(NVarDims),intent(in) :: Length + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: FieldType + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(*) ,intent(inout) :: XField + integer ,intent(out) :: Status + integer :: TimeIndex + integer :: NDim + integer,dimension(NVarDims) :: VStart + integer,dimension(NVarDims) :: VCount +! include 'wrf_io_flags.h' + + call GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' Bad time index for DateStr = ',DateStr + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + VStart(:) = 1 + VCount(:) = 1 + VStart(1:NDim) = 1 + VCount(1:NDim) = Length(1:NDim) + VStart(NDim+1) = TimeIndex + VCount(NDim+1) = 1 + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + call ext_ncd_RealFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_DOUBLE) THEN + call ext_ncd_DoubleFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_INTEGER) THEN + call ext_ncd_IntFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_LOGICAL) THEN + call ext_ncd_LogicalFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + if(Status /= WRF_NO_ERR) return + ELSE + write(6,*) 'WARNING---- some missing calls commented out' + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + + return +end subroutine FieldIO + +subroutine Transpose(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + integer ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) +!jm 010827 integer ,intent(inout) :: XField(di,x1:x2,y1:y2,z1:z2) + integer ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + +#define XDEX(A,B,C) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + + case ('xzy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,k,j)) +#include "transpose.code" + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,j,k)) +#include "transpose.code" + case ('yxz') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + case ('zxy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,i,j)) +#include "transpose.code" + case ('yzx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,k,i)) +#include "transpose.code" + case ('zyx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,j,i)) +#include "transpose.code" + case ('yx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + end select + return +end subroutine Transpose + +subroutine reorder (MemoryOrder,MemO) + character*(*) ,intent(in) :: MemoryOrder + character*3 ,intent(out) :: MemO + character*3 :: MemOrd + integer :: N,i,i1,i2,i3 + + MemO = MemoryOrder + N = len_trim(MemoryOrder) + if(N == 1) return + call lowercase(MemoryOrder,MemOrd) +! never invert the boundary codes + select case ( MemOrd ) + case ( 'xsz','xez','ysz','yez' ) + return + case default + continue + end select + i1 = 1 + i3 = 1 + do i=2,N + if(ichar(MemOrd(i:i)) < ichar(MemOrd(i1:i1))) I1 = i + if(ichar(MemOrd(i:i)) > ichar(MemOrd(i3:i3))) I3 = i + enddo + if(N == 2) then + i2=i3 + else + i2 = 6-i1-i3 + endif + MemO(1:1) = MemoryOrder(i1:i1) + MemO(2:2) = MemoryOrder(i2:i2) + if(N == 3) MemO(3:3) = MemoryOrder(i3:i3) + if(MemOrd(i1:i1) == 's' .or. MemOrd(i1:i1) == 'e') then + MemO(1:N-1) = MemO(2:N) + MemO(N:N ) = MemoryOrder(i1:i1) + endif + return +end subroutine reorder + +! Returns .TRUE. iff it is OK to write time-independent domain metadata to the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_put_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, first_output, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + first_output = ncd_is_first_operation( DataHandle ) + retval = .NOT. dryrun .AND. first_output + ENDIF + ncd_ok_to_put_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_put_dom_ti + +! Returns .TRUE. iff it is OK to read time-independent domain metadata from the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_get_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + retval = .NOT. dryrun + ENDIF + ncd_ok_to_get_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_get_dom_ti + +! Returns .TRUE. iff nothing has been read from or written to the file +! referenced by DataHandle. If DataHandle is invalid, .FALSE. is returned. +LOGICAL FUNCTION ncd_is_first_operation( DataHandle ) + USE wrf_data + INCLUDE 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + TYPE(wrf_data_handle) ,POINTER :: DH + INTEGER :: Status + LOGICAL :: retval + CALL GetDH( DataHandle, DH, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + retval = DH%first_operation + ENDIF + ncd_is_first_operation = retval + RETURN +END FUNCTION ncd_is_first_operation + +subroutine upgrade_filename(FileName) + implicit none + + character*(*), intent(inout) :: FileName + integer :: i + + do i = 1, len(trim(FileName)) + if(FileName(i:i) == '-') then + FileName(i:i) = '_' + else if(FileName(i:i) == ':') then + FileName(i:i) = '_' + endif + enddo + +end subroutine upgrade_filename + +end module ext_ncd_support_routines + +subroutine TransposeToR4(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + + use ext_ncd_support_routines + + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + real*8 ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) + real*4 ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + +!#define XDEX(A,B,C) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + + case ('xzy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,k,j)) +#include "transpose.code" + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,j,k)) +#include "transpose.code" + case ('yxz') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + case ('zxy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,i,j)) +#include "transpose.code" + case ('yzx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,k,i)) +#include "transpose.code" + case ('zyx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,j,i)) +#include "transpose.code" + case ('yx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + end select + return +end subroutine TransposeToR4 + +subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), INTENT(IN) :: DatasetName + integer , INTENT(IN) :: Comm1, Comm2 + character *(*), INTENT(IN) :: SysDepInfo + integer , INTENT(OUT) :: DataHandle + integer , INTENT(OUT) :: Status + DataHandle = 0 ! dummy setting to quiet warning message + CALL ext_ncd_open_for_read_begin( DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status ) + IF ( Status .EQ. WRF_NO_ERR ) THEN + CALL ext_ncd_open_for_read_commit( DataHandle, Status ) + ENDIF + return +end subroutine ext_ncd_open_for_read + +!ends training phase; switches internal flag to enable input +!must be paired with call to ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_read_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer, intent(in) :: DataHandle + integer, intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_READ + DH%first_operation = .TRUE. + Status = WRF_NO_ERR + return +end subroutine ext_ncd_open_for_read_commit + +subroutine ext_ncd_open_for_read_begin( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + +#ifdef USE_NETCDF4_FEATURES + integer :: open_mode +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + stat = NF_OPEN(FileName, NF_NOWRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_read_begin + +subroutine ext_ncd_open_for_update( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + +#ifdef USE_NETCDF4_FEATURES + integer :: open_mode +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_WRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_FOR_UPDATE + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_update + + +SUBROUTINE ext_ncd_open_for_write_begin(FileName,Comm,IOComm,SysDepInfo,DataHandle,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(inout) :: FileName + integer ,intent(in) :: Comm + integer ,intent(in) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + character (7) :: Buffer + integer :: VDimIDs(2) + +#ifdef USE_NETCDF4_FEATURES + integer :: create_mode + integer, parameter :: cache_size = 32, & + cache_nelem = 37, & + cache_preemption = 100 +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_begin: ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + DH%TimeIndex = 0 + DH%Times = ZeroDate +#ifdef USE_NETCDF4_FEATURES +! create_mode = IOR(nf_netcdf4, nf_classic_model) + if ( DH%use_netcdf_classic ) then + write(msg,*) 'output will be in classic NetCDF format' + call wrf_debug ( WARN , TRIM(msg)) +#ifdef WRFIO_NCD_NO_LARGE_FILE_SUPPORT + stat = NF_CREATE(FileName, NF_CLOBBER, DH%NCID) +#else + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) +#endif + else + create_mode = nf_netcdf4 + stat = NF_CREATE(FileName, create_mode, DH%NCID) + stat = NF_SET_CHUNK_CACHE(cache_size, cache_nelem, cache_preemption) + endif +#else +#ifdef WRFIO_NCD_NO_LARGE_FILE_SUPPORT + stat = NF_CREATE(FileName, NF_CLOBBER, DH%NCID) +#else + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) +#endif +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + stat = NF_DEF_DIM(DH%NCID,DH%DimUnlimName,NF_UNLIMITED,DH%DimUnlimID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarNames (1:MaxVars) = NO_NAME + DH%MDVarNames(1:MaxVars) = NO_NAME + do i=1,MaxDims + write(Buffer,FMT="('DIM',i4.4)") i + DH%DimNames (i) = Buffer + DH%DimLengths(i) = NO_DIM + enddo + DH%DimNames(1) = 'DateStrLen' + stat = NF_DEF_DIM(DH%NCID,DH%DimNames(1),DateStrLen,DH%DimIDs(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VDimIDs(1) = DH%DimIDs(1) + VDimIDs(2) = DH%DimUnlimID + stat = NF_DEF_VAR(DH%NCID,DH%TimesName,NF_CHAR,2,VDimIDs,DH%TimesVarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(1) = DateStrLen + + if (index(SysDepInfo,'REAL_OUTPUT_SIZE=4') /= 0) then + DH%R4OnOutput = .true. + end if +!toggle on nofill mode + if (index(SysDepInfo,'NOFILL=.TRUE.') /= 0) then + DH%nofill = .true. + end if + + return +end subroutine ext_ncd_open_for_write_begin + +!stub +!opens a file for writing or coupler datastream for sending messages. +!no training phase for this version of the open stmt. +subroutine ext_ncd_open_for_write (DatasetName, Comm1, Comm2, & + SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), intent(in) ::DatasetName + integer , intent(in) ::Comm1, Comm2 + character *(*), intent(in) ::SysDepInfo + integer , intent(out) :: DataHandle + integer , intent(out) :: Status + Status=WRF_WARN_NOOP + DataHandle = 0 ! dummy setting to quiet warning message + return +end subroutine ext_ncd_open_for_write + +SUBROUTINE ext_ncd_open_for_write_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + integer :: oldmode ! for nf_set_fill, not used + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_commit: ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_open_for_write_commit ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if ( DH%nofill ) then + Status = NF_SET_FILL(DH%NCID,NF_NOFILL, oldmode ) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' from NF_SET_FILL ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + write(msg,*) 'Information: NOFILL being set for writing to ',TRIM(DH%FileName) + call wrf_debug ( WARN , TRIM(msg)) + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_commit ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + DH%first_operation = .TRUE. + return +end subroutine ext_ncd_open_for_write_commit + +subroutine ext_ncd_ioclose(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_CLOSE + write(msg,*) 'Warning TRY TO CLOSE DRYRUN in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + + stat = NF_CLOSE(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + CALL deallocHandle( DataHandle, Status ) + DH%Free=.true. + return +end subroutine ext_ncd_ioclose + +subroutine ext_ncd_iosync( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_SYNC(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + return +end subroutine ext_ncd_iosync + + + +subroutine ext_ncd_redef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + return +end subroutine ext_ncd_redef + +subroutine ext_ncd_enddef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + return +end subroutine ext_ncd_enddef + +subroutine ext_ncd_ioinit(SysDepInfo, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + CHARACTER*(*), INTENT(IN) :: SysDepInfo + INTEGER ,INTENT(INOUT) :: Status + + WrfIOnotInitialized = .false. + WrfDataHandles(1:WrfDataHandleMax)%Free = .true. + WrfDataHandles(1:WrfDataHandleMax)%TimesName = 'Times' + WrfDataHandles(1:WrfDataHandleMax)%DimUnlimName = 'Time' + WrfDataHandles(1:WrfDataHandleMax)%FileStatus = WRF_FILE_NOT_OPENED + if(trim(SysDepInfo) == "use_netcdf_classic" ) then + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .true. + else + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .false. + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_ioinit + + +subroutine ext_ncd_inquiry (Inquiry, Result, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + character *(*), INTENT(IN) :: Inquiry + character *(*), INTENT(OUT) :: Result + integer ,INTENT(INOUT) :: Status + SELECT CASE (Inquiry) + CASE ("RANDOM_WRITE","RANDOM_READ","SEQUENTIAL_WRITE","SEQUENTIAL_READ") + Result='ALLOW' + CASE ("OPEN_READ","OPEN_COMMIT_WRITE") + Result='REQUIRE' + CASE ("OPEN_WRITE","OPEN_COMMIT_READ","PARALLEL_IO") + Result='NO' + CASE ("SELF_DESCRIBING","SUPPORT_METADATA","SUPPORT_3D_FIELDS") + Result='YES' + CASE ("MEDIUM") + Result ='FILE' + CASE DEFAULT + Result = 'No Result for that inquiry!' + END SELECT + Status=WRF_NO_ERR + return +end subroutine ext_ncd_inquiry + + + + +subroutine ext_ncd_ioexit(Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer , INTENT(INOUT) ::Status + integer :: error + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,WrfDataHandleMax + CALL deallocHandle( i , stat ) + enddo + return +end subroutine ext_ncd_ioexit + +subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,OutCount,Status) +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real,intent(out) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCOunt +#define TYPE_BUFFER real,allocatable :: Buffer(:) +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_ATT_REAL +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_real + +subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_integer + +subroutine ext_ncd_get_dom_ti_double(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8,intent(out) :: Data(*) +#define TYPE_BUFFER real*8,allocatable :: Buffer(:) +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_ATT_DOUBLE +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_double + +subroutine ext_ncd_get_dom_ti_logical(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count))==1 +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_logical + +subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef TYPE_BUFFER +#undef NF_TYPE +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*),intent(out) :: Data +#define TYPE_COUNT +#define TYPE_OUTCOUNT +#define TYPE_BUFFER +#define NF_TYPE NF_CHAR +#define CHAR_TYPE +#include "ext_ncd_get_dom_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_dom_ti_char + +subroutine ext_ncd_put_dom_ti_real(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_REAL +#define ARGS NF_FLOAT,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_real + +subroutine ext_ncd_put_dom_ti_integer(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_integer + +subroutine ext_ncd_put_dom_ti_double(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_DOUBLE +#define ARGS NF_DOUBLE,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_double + +subroutine ext_ncd_put_dom_ti_logical(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Buffer +#define LOG +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_logical + +subroutine ext_ncd_put_dom_ti_char(DataHandle,Element,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*),intent(in) :: Data +#define TYPE_COUNT integer,parameter :: Count=1 +#define NF_ROUTINE NF_PUT_ATT_TEXT +#define ARGS len_trim(Data),Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_char + +subroutine ext_ncd_put_var_ti_real(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_REAL +#define ARGS NF_FLOAT,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_real + +subroutine ext_ncd_put_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_REAL +#define NF_TYPE NF_FLOAT +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_real + +subroutine ext_ncd_put_var_ti_double(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_DOUBLE +#define ARGS NF_DOUBLE,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_double + +subroutine ext_ncd_put_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_DOUBLE +#define NF_TYPE NF_DOUBLE +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_double + +subroutine ext_ncd_put_var_ti_integer(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_integer + +subroutine ext_ncd_put_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_INT +#define NF_TYPE NF_INT +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_integer + +subroutine ext_ncd_put_var_ti_logical(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define LOG +#define ARGS NF_INT,Count,Buffer +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_logical + +subroutine ext_ncd_put_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_INT +#define NF_TYPE NF_INT +#define LOG +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_logical + +subroutine ext_ncd_put_var_ti_char(DataHandle,Element,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(in) :: Data +#define TYPE_COUNT +#define NF_ROUTINE NF_PUT_ATT_TEXT +#define ARGS len_trim(Data),trim(Data) +#define CHAR_TYPE +#include "ext_ncd_put_var_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_put_var_ti_char + +subroutine ext_ncd_put_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(in) :: Data +#define TYPE_COUNT +#define NF_ROUTINE NF_PUT_VARA_TEXT +#define NF_TYPE NF_CHAR +#define LENGTH len(Data) +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_char + +subroutine ext_ncd_get_var_ti_real(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(out) :: Data(*) +#define TYPE_BUFFER real ,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_ATT_REAL +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_real + +subroutine ext_ncd_get_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(out) :: Data(*) +#define TYPE_BUFFER real +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_VARA_REAL +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_real + +subroutine ext_ncd_get_var_ti_double(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(out) :: Data(*) +#define TYPE_BUFFER real*8 ,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_ATT_DOUBLE +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_double + +subroutine ext_ncd_get_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(out) :: Data(*) +#define TYPE_BUFFER real*8 +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_VARA_DOUBLE +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_double + +subroutine ext_ncd_get_var_ti_integer(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_integer + +subroutine ext_ncd_get_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_VARA_INT +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_integer + +subroutine ext_ncd_get_var_ti_logical(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count))==1 +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_logical + +subroutine ext_ncd_get_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_VARA_INT +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count))==1 +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_logical + +subroutine ext_ncd_get_var_ti_char(DataHandle,Element,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(out) :: Data +#define TYPE_BUFFER +#define TYPE_COUNT integer :: Count = 1 +#define TYPE_OUTCOUNT +#define NF_TYPE NF_CHAR +#define NF_ROUTINE NF_GET_ATT_TEXT +#define COPY +#define CHAR_TYPE +#include "ext_ncd_get_var_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_var_ti_char + +subroutine ext_ncd_get_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(out) :: Data +#define TYPE_BUFFER character (80) +#define TYPE_COUNT integer :: Count = 1 +#define TYPE_OUTCOUNT +#define NF_TYPE NF_CHAR +#define NF_ROUTINE NF_GET_VARA_TEXT +#define LENGTH Len1 +#define CHAR_TYPE +#include "ext_ncd_get_var_td.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_var_td_char + +subroutine ext_ncd_put_dom_td_real(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_real + +subroutine ext_ncd_put_dom_td_integer(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_integer + +subroutine ext_ncd_put_dom_td_double(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_double + +subroutine ext_ncd_put_dom_td_logical(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_logical + +subroutine ext_ncd_put_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Data + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_put_dom_td_char + +subroutine ext_ncd_get_dom_td_real(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_real + +subroutine ext_ncd_get_dom_td_integer(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_integer + +subroutine ext_ncd_get_dom_td_double(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_double + +subroutine ext_ncd_get_dom_td_logical(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_logical + +subroutine ext_ncd_get_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(out) :: Data + integer ,intent(out) :: Status + call ext_ncd_get_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_get_dom_td_char + +subroutine ext_ncd_write_field(DataHandle,DateStr,Var,Field,FieldTypeIn, & + Comm, IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(inout) :: Field(*) + integer ,intent(in) :: FieldTypeIn + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) ,dimension(*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + integer :: FieldType + character (3) :: MemoryOrder + type(wrf_data_handle) ,pointer :: DH + integer :: NCID + integer :: NDim + character (VarNameLen) :: VarName + character (3) :: MemO + character (3) :: UCMemO + integer :: VarID + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + character(80),dimension(NVarDims) :: RODimNames + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(:,:,:,:),allocatable :: XField + integer :: stat + integer :: NVar + integer :: i,j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + integer :: XType + integer :: di + character (80) :: NullName + logical :: NotFound + +#ifdef USE_NETCDF4_FEATURES + integer, parameter :: cache_size = 32000000 + integer,dimension(NVarDims) :: chunks + logical :: need_chunking + integer :: compression_level + integer :: block_size +#endif + + MemoryOrder = trim(adjustl(MemoryOrdIn)) + NullName=char(0) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',MemoryOrder,'| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',DateStr,'| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NCID = DH%NCID + +#ifdef USE_NETCDF4_FEATURES +if ( .not. DH%use_netcdf_classic ) then + call set_chunking(MemoryOrder,need_chunking) + compression_level = 2 +else + need_chunking = .false. +endif +#endif + + if ( DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE ) then + FieldType = WRF_REAL + else + FieldType = FieldTypeIn + end if + + write(msg,*)'ext_ncd_write_field: called for ',TRIM(Var) + +!jm 010827 Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + + IF ( ZeroLengthHorzDim(MemoryOrder,Length,Status) ) THEN + write(msg,*)'ext_ncd_write_field: zero length dimension in ',TRIM(Var),'. Ignoring' + call wrf_debug ( WARN , TRIM(msg)) + return + ENDIF + + call ExtOrder(MemoryOrder,Length,Status) + call ExtOrderStr(MemoryOrder,DimNames,RODimNames,Status) + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) 'Warning WRITE READ ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(DH%VarNames(NVar) == VarName ) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + write(msg,*) 'Warning 2 DRYRUNS 1 VARIABLE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%VarNames(NVar) == NO_NAME) then + DH%VarNames(NVar) = VarName + DH%NumVars = NVar + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) 'Warning TOO MANY VARIABLES in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + do j = 1,NDim + if(RODimNames(j) == NullName .or. RODimNames(j) == '') then + do i=1,MaxDims + if(DH%DimLengths(i) == Length(j)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else !look for input name and check if already defined + NotFound = .true. + do i=1,MaxDims + if (DH%DimNames(i) == RODimNames(j)) then + if (DH%DimLengths(i) == Length(j)) then + NotFound = .false. + exit + else + Status = WRF_WARN_DIMNAME_REDEFINED + write(msg,*) 'Warning DIM ',i,', NAME ',TRIM(DH%DimNames(i)),' REDEFINED by var ', & + TRIM(Var),' ',DH%DimLengths(i),Length(j) ,' in ', __FILE__ ,' line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + enddo + if (NotFound) then + do i=1,MaxDims + if (DH%DimLengths(i) == NO_DIM) then + DH%DimNames(i) = RODimNames(j) + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + endif + VDimIDs(j) = DH%DimIDs(i) + DH%VarDimLens(j,NVar) = Length(j) + enddo + VDimIDs(NDim+1) = DH%DimUnlimID + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + XType = NF_FLOAT + ELSE IF (FieldType == WRF_DOUBLE) THEN + Xtype = NF_DOUBLE + ELSE IF (FieldType == WRF_INTEGER) THEN + XType = NF_INT + ELSE IF (FieldType == WRF_LOGICAL) THEN + XType = NF_INT + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + + stat = NF_DEF_VAR(NCID,VarName,XType,NDim+1,VDimIDs,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + +#ifdef USE_NETCDF4_FEATURES + if(need_chunking) then + chunks(1:NDim) = Length(1:NDim) + chunks(NDim+1) = 1 + chunks(1) = (Length(1) + 1)/2 + chunks(2) = (Length(2) + 1)/2 + + block_size = 1 + do i = 1, NDim + block_size = block_size * chunks(i) + end do + + do while (block_size > cache_size) + chunks(1) = (chunks(1) + 1)/2 + chunks(2) = (chunks(2) + 1)/2 + + block_size = 1 + do i = 1, NDim + block_size = block_size * chunks(i) + end do + end do + +! write(unit=0, fmt='(2x, 3a,i6)') 'file: ', __FILE__, ', line: ', __LINE__ +! write(unit=0, fmt='(2x, 3a)') TRIM(VarName),':' +! write(unit=0, fmt='(10x, 2(a,i6))') 'length 1 = ', Length(1), ', chunk 1 = ', chunks(1) +! write(unit=0, fmt='(10x, 2(a,i6))') 'length 2 = ', Length(2), ', chunk 2 = ', chunks(2) +! write(unit=0, fmt='(10x, 2(a,i6))') 'length NDim+1 = ', Length(NDim+1), ', chunk NDim+1 = ', chunks(NDim+1) +! write(unit=0, fmt='(10x, a,i6)') 'compression_level = ', compression_level + + stat = NF_DEF_VAR_CHUNKING(NCID, VarID, NF_CHUNKED, chunks(1:NDim+1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF def chunking error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + stat = NF_DEF_VAR_DEFLATE(NCID, VarID, 1, 1, compression_level) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF def compression error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif +#endif + + DH%VarIDs(NVar) = VarID + stat = NF_PUT_ATT_INT(NCID,VarID,'FieldType',NF_INT,1,FieldType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call reorder(MemoryOrder,MemO) + call uppercase(MemO,UCMemO) + stat = NF_PUT_ATT_TEXT(NCID,VarID,'MemoryOrder',3,UCMemO) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) 'Warning VARIABLE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + VarID = DH%VarIDs(NVar) + do j=1,NDim + if(Length(j) /= DH%VarDimLens(j,NVar) .AND. DH%FileStatus /= WRF_FILE_OPENED_FOR_UPDATE ) then + Status = WRF_WARN_WRTLEN_NE_DRRUNLEN + write(msg,*) 'Warning LENGTH != DRY RUN LENGTH for |', & + VarName,'| dim ',j,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' LENGTH ',Length(j),' DRY RUN LENGTH ',DH%VarDimLens(j,NVar) + call wrf_debug ( WARN , TRIM(msg)) + return +!jm 010825 elseif(DomainStart(j) < MemoryStart(j)) then + elseif(PatchStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning DIMENSION ERROR for |',VarName, & + '| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,Length ,x1,x2,y1,y2,z1,z2) + call GetIndices(NDim,PatchStart, PatchEnd ,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + if (DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE) then + call TransposeToR4('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + else + call Transpose('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + end if + call FieldIO('write',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_write_field + +subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & + IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(out) :: Field(*) + integer ,intent(in) :: FieldType + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) , dimension (*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + character (3) :: MemoryOrder + character (NF_MAX_NAME) :: dimname + type(wrf_data_handle) ,pointer :: DH + integer :: NDim + integer :: NCID + character (VarNameLen) :: VarName + integer :: VarID + integer ,dimension(NVarDims) :: VCount + integer ,dimension(NVarDims) :: VStart + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + integer ,dimension(NVarDims) :: MemS + integer ,dimension(NVarDims) :: MemE + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(NVarDims) :: StoredLen + integer ,dimension(:,:,:,:) ,allocatable :: XField + integer :: NVar + integer :: j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + character (VarNameLen) :: Name + integer :: XType + integer :: StoredDim + integer :: NAtts + integer :: Len + integer :: stat + integer :: di + integer :: FType + + MemoryOrder = trim(adjustl(MemoryOrdIn)) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',TRIM(MemoryOrder),'| for |', & + TRIM(Var),'| in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',TRIM(DateStr),'| for |',TRIM(Var), & + '| in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +! jm it is okay to have a dry run read. means read is called between ofrb and ofrc. Just return. +! Status = WRF_WARN_DRYRUN_READ +! write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ +! call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_NO_ERR + RETURN + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + NCID = DH%NCID + +!jm Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + call ExtOrder(MemoryOrder,Length,Status) + stat = NF_INQ_VARID(NCID,VarName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__,' Varname ',Varname + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(NCID,VarID,Name,XType,StoredDim,VDimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(NCID,VarID,'FieldType',FType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif +! allow coercion between double and single prec real +!jm if(FieldType /= Ftype) then + if( (FieldType == WRF_REAL .OR. FieldType == WRF_DOUBLE) ) then + if ( .NOT. (Ftype == WRF_REAL .OR. Ftype == WRF_DOUBLE )) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else if(FieldType /= Ftype) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning REAL TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_DOUBLE) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning DOUBLE TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_INTEGER) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning INTEGER TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_LOGICAL) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning LOGICAL TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + END IF + + if(Status /= WRF_NO_ERR) then + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! NDim=0 for scalars. Handle read of old NDim=1 files. TBH: 20060502 + IF ( ( NDim == 0 ) .AND. ( StoredDim == 2 ) ) THEN + stat = NF_INQ_DIMNAME(NCID,VDimIDs(1),dimname) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + IF ( dimname(1:10) == 'ext_scalar' ) THEN + NDim = 1 + Length(1) = 1 + ENDIF + ENDIF + if(StoredDim /= NDim+1) then + Status = WRF_ERR_FATAL_BAD_VARIABLE_DIM + write(msg,*) 'Fatal error BAD VARIABLE DIMENSION in ext_ncd_read_field ',TRIM(Var),TRIM(DateStr) + call wrf_debug ( FATAL , msg) + write(msg,*) ' StoredDim ', StoredDim, ' .NE. NDim+1 ', NDim+1 + call wrf_debug ( FATAL , msg) + return + endif + do j=1,NDim + stat = NF_INQ_DIMLEN(NCID,VDimIDs(j),StoredLen(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(Length(j) > StoredLen(j)) then + Status = WRF_WARN_READ_PAST_EOF + write(msg,*) 'Warning READ PAST EOF in ext_ncd_read_field of ',TRIM(Var),Length(j),'>',StoredLen(j) + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Length(j) <= 0) then + Status = WRF_WARN_ZERO_LENGTH_READ + write(msg,*) 'Warning ZERO LENGTH READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DomainStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning dim ',j,' DomainStart (',DomainStart(j), & + ') < MemoryStart (',MemoryStart(j),') in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) +! return + endif + enddo + + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,StoredLen,x1,x2,y1,y2,z1,z2) +!jm call GetIndices(NDim,DomainStart,DomainEnd,i1,i2,j1,j2,k1,k2) + call GetIndices(NDim,PatchStart,PatchEnd,i1,i2,j1,j2,k1,k2) + + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call FieldIO('read',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call Transpose('read',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_read_field + +subroutine ext_ncd_inquire_opened( DataHandle, FileName , FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(inout) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + !call upgrade_filename(FileName) + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + FileStatus = WRF_FILE_NOT_OPENED + return + endif + if(trim(FileName) /= trim(DH%FileName)) then + FileStatus = WRF_FILE_NOT_OPENED + else + FileStatus = DH%FileStatus + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_opened + +subroutine ext_ncd_inquire_filename( Datahandle, FileName, FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + FileStatus = WRF_FILE_NOT_OPENED + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + FileName = trim(DH%FileName) + FileStatus = DH%FileStatus + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_filename + +subroutine ext_ncd_set_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: i + + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + DH%CurrentTime = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + return + endif + enddo + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_set_time + +subroutine ext_ncd_get_next_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + if(DH%CurrentTime >= DH%NumberTimes) then + Status = WRF_WARN_TIME_EOF + return + endif + DH%CurrentTime = DH%CurrentTime +1 + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'DH%FileStatus ',DH%FileStatus + call wrf_debug ( FATAL , msg) + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_time + +subroutine ext_ncd_get_previous_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + if(DH%CurrentTime.GT.0) then + DH%CurrentTime = DH%CurrentTime -1 + endif + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_previous_time + +subroutine ext_ncd_get_next_var(DataHandle, VarName, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: VarName + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + character (80) :: Name + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + + DH%CurrentVariable = DH%CurrentVariable +1 + if(DH%CurrentVariable > DH%NumVars) then + Status = WRF_WARN_VAR_EOF + return + endif + VarName = DH%VarNames(DH%CurrentVariable) + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_var + +subroutine ext_ncd_end_of_frame(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + return +end subroutine ext_ncd_end_of_frame + +! NOTE: For scalar variables NDim is set to zero and DomainStart and +! NOTE: DomainEnd are left unmodified. +subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder,Stagger,DomainStart,DomainEnd,WrfType,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Name + integer ,intent(out) :: NDim + character*(*) ,intent(out) :: MemoryOrder + character*(*) :: Stagger ! Dummy for now + integer ,dimension(*) ,intent(out) :: DomainStart, DomainEnd + integer ,intent(out) :: WrfType + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VarID + integer ,dimension(NVarDims) :: VDimIDs + integer :: j + integer :: stat + integer :: XType + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_INQ_VARID(DH%NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARTYPE(DH%NCID,VarID,XType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,VarID,'FieldType',WrfType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + select case (XType) + case (NF_BYTE) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BYTE IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_CHAR) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning CHAR IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_SHORT) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning SHORT IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_INT) + if(WrfType /= WRF_INTEGER .and. WrfType /= WRF_LOGICAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_FLOAT) + if(WrfType /= WRF_REAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_DOUBLE) + if(WrfType /= WRF_DOUBLE) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case default + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + end select + + stat = NF_GET_ATT_TEXT(DH%NCID,VarID,'MemoryOrder',MemoryOrder) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER ',TRIM(MemoryOrder),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARDIMID(DH%NCID,VarID,VDimIDs) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + do j = 1, NDim + DomainStart(j) = 1 + stat = NF_INQ_DIMLEN(DH%NCID,VDimIDs(j),DomainEnd(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_info + +subroutine ext_ncd_warning_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + + SELECT CASE (Code) + CASE (0) + ReturnString='No error' + Status=WRF_NO_ERR + return + CASE (-1) + ReturnString= 'File not found (or file is incomplete)' + Status=WRF_NO_ERR + return + CASE (-2) + ReturnString='Metadata not found' + Status=WRF_NO_ERR + return + CASE (-3) + ReturnString= 'Timestamp not found' + Status=WRF_NO_ERR + return + CASE (-4) + ReturnString= 'No more timestamps' + Status=WRF_NO_ERR + return + CASE (-5) + ReturnString= 'Variable not found' + Status=WRF_NO_ERR + return + CASE (-6) + ReturnString= 'No more variables for the current time' + Status=WRF_NO_ERR + return + CASE (-7) + ReturnString= 'Too many open files' + Status=WRF_NO_ERR + return + CASE (-8) + ReturnString= 'Data type mismatch' + Status=WRF_NO_ERR + return + CASE (-9) + ReturnString= 'Attempt to write read-only file' + Status=WRF_NO_ERR + return + CASE (-10) + ReturnString= 'Attempt to read write-only file' + Status=WRF_NO_ERR + return + CASE (-11) + ReturnString= 'Attempt to access unopened file' + Status=WRF_NO_ERR + return + CASE (-12) + ReturnString= 'Attempt to do 2 trainings for 1 variable' + Status=WRF_NO_ERR + return + CASE (-13) + ReturnString= 'Attempt to read past EOF' + Status=WRF_NO_ERR + return + CASE (-14) + ReturnString= 'Bad data handle' + Status=WRF_NO_ERR + return + CASE (-15) + ReturnString= 'Write length not equal to training length' + Status=WRF_NO_ERR + return + CASE (-16) + ReturnString= 'More dimensions requested than training' + Status=WRF_NO_ERR + return + CASE (-17) + ReturnString= 'Attempt to read more data than exists' + Status=WRF_NO_ERR + return + CASE (-18) + ReturnString= 'Input dimensions inconsistent' + Status=WRF_NO_ERR + return + CASE (-19) + ReturnString= 'Input MemoryOrder not recognized' + Status=WRF_NO_ERR + return + CASE (-20) + ReturnString= 'A dimension name with 2 different lengths' + Status=WRF_NO_ERR + return + CASE (-21) + ReturnString= 'String longer than provided storage' + Status=WRF_NO_ERR + return + CASE (-22) + ReturnString= 'Function not supportable' + Status=WRF_NO_ERR + return + CASE (-23) + ReturnString= 'Package implements this routine as NOOP' + Status=WRF_NO_ERR + return + +!netcdf-specific warning messages + CASE (-1007) + ReturnString= 'Bad data type' + Status=WRF_NO_ERR + return + CASE (-1008) + ReturnString= 'File not committed' + Status=WRF_NO_ERR + return + CASE (-1009) + ReturnString= 'File is opened for reading' + Status=WRF_NO_ERR + return + CASE (-1011) + ReturnString= 'Attempt to write metadata after open commit' + Status=WRF_NO_ERR + return + CASE (-1010) + ReturnString= 'I/O not initialized' + Status=WRF_NO_ERR + return + CASE (-1012) + ReturnString= 'Too many variables requested' + Status=WRF_NO_ERR + return + CASE (-1013) + ReturnString= 'Attempt to close file during a dry run' + Status=WRF_NO_ERR + return + CASE (-1014) + ReturnString= 'Date string not 19 characters in length' + Status=WRF_NO_ERR + return + CASE (-1015) + ReturnString= 'Attempt to read zero length words' + Status=WRF_NO_ERR + return + CASE (-1016) + ReturnString= 'Data type not found' + Status=WRF_NO_ERR + return + CASE (-1017) + ReturnString= 'Badly formatted date string' + Status=WRF_NO_ERR + return + CASE (-1018) + ReturnString= 'Attempt at read during a dry run' + Status=WRF_NO_ERR + return + CASE (-1019) + ReturnString= 'Attempt to get zero words' + Status=WRF_NO_ERR + return + CASE (-1020) + ReturnString= 'Attempt to put zero length words' + Status=WRF_NO_ERR + return + CASE (-1021) + ReturnString= 'NetCDF error' + Status=WRF_NO_ERR + return + CASE (-1022) + ReturnString= 'Requested length <= 1' + Status=WRF_NO_ERR + return + CASE (-1023) + ReturnString= 'More data available than requested' + Status=WRF_NO_ERR + return + CASE (-1024) + ReturnString= 'New date less than previous date' + Status=WRF_NO_ERR + return + + CASE DEFAULT + ReturnString= 'This warning code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this warning code.' + Status=WRF_NO_ERR + END SELECT + + return +end subroutine ext_ncd_warning_str + +!returns message string for all WRF and netCDF warning/error status codes +!Other i/o packages must provide their own routines to return their own status messages +subroutine ext_ncd_error_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + + SELECT CASE (Code) + CASE (-100) + ReturnString= 'Allocation Error' + Status=WRF_NO_ERR + return + CASE (-101) + ReturnString= 'Deallocation Error' + Status=WRF_NO_ERR + return + CASE (-102) + ReturnString= 'Bad File Status' + Status=WRF_NO_ERR + return + CASE (-1004) + ReturnString= 'Variable on disk is not 3D' + Status=WRF_NO_ERR + return + CASE (-1005) + ReturnString= 'Metadata on disk is not 1D' + Status=WRF_NO_ERR + return + CASE (-1006) + ReturnString= 'Time dimension too small' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This error code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this error code.' + Status=WRF_NO_ERR + END SELECT + + return +end subroutine ext_ncd_error_str diff --git a/libsrc/wrflib/wrf_io.f90 b/libsrc/wrflib/wrf_io.f90 new file mode 100644 index 0000000000..278249138e --- /dev/null +++ b/libsrc/wrflib/wrf_io.f90 @@ -0,0 +1,8169 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + +module wrf_data + + integer , parameter :: FATAL = 1 + integer , parameter :: WARN = 1 + integer , parameter :: WrfDataHandleMax = 99 + integer , parameter :: MaxDims = 2000 ! = NF_MAX_VARS + + + + integer , parameter :: MaxVars = 3000 + + integer , parameter :: MaxTimes = 10000 + integer , parameter :: DateStrLen = 19 + integer , parameter :: VarNameLen = 31 + integer , parameter :: NO_DIM = 0 + integer , parameter :: NVarDims = 4 + integer , parameter :: NMDVarDims = 2 + character (8) , parameter :: NO_NAME = 'NULL' + character (DateStrLen) , parameter :: ZeroDate = '0000-00-00-00:00:00' + integer, parameter :: WRF_FILE_NOT_OPENED = 100 + integer, parameter :: WRF_FILE_OPENED_NOT_COMMITTED = 101 + integer, parameter :: WRF_FILE_OPENED_FOR_WRITE = 102 + integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103 + integer, parameter :: WRF_REAL = 104 + integer, parameter :: WRF_DOUBLE = 105 + integer, parameter :: WRF_FLOAT=WRF_REAL + integer, parameter :: WRF_INTEGER = 106 + integer, parameter :: WRF_LOGICAL = 107 + integer, parameter :: WRF_COMPLEX = 108 + integer, parameter :: WRF_DOUBLE_COMPLEX = 109 + integer, parameter :: WRF_FILE_OPENED_FOR_UPDATE = 110 +! This bit is for backwards compatibility with old variants of these flags +! that are still being used in io_grib1 and io_phdf5. It should be removed! + integer, parameter :: WRF_FILE_OPENED_AND_COMMITTED = 102 + character (256) :: msg + logical :: WrfIOnotInitialized = .true. + type :: wrf_data_handle + character (255) :: FileName + integer :: FileStatus + integer :: Comm + integer :: NCID + logical :: Free + logical :: Write + character (5) :: TimesName + integer :: TimeIndex + integer :: CurrentTime !Only used for read + integer :: NumberTimes !Only used for read + character (DateStrLen), pointer :: Times(:) + integer :: TimesVarID + integer , pointer :: DimLengths(:) + integer , pointer :: DimIDs(:) + character (31) , pointer :: DimNames(:) + integer :: DimUnlimID + character (9) :: DimUnlimName + integer , dimension(NVarDims) :: DimID + integer , dimension(NVarDims) :: Dimension + integer , pointer :: MDVarIDs(:) + integer , pointer :: MDVarDimLens(:) + character (80) , pointer :: MDVarNames(:) + integer , pointer :: VarIDs(:) + integer , pointer :: VarDimLens(:,:) + character (VarNameLen), pointer :: VarNames(:) + integer :: CurrentVariable !Only used for read + integer :: NumVars +! first_operation is set to .TRUE. when a new handle is allocated +! or when open-for-write or open-for-read are committed. It is set +! to .FALSE. when the first field is read or written. + logical :: first_operation + logical :: R4OnOutput + logical :: nofill + logical :: use_netcdf_classic + end type wrf_data_handle + type(wrf_data_handle),target :: WrfDataHandles(WrfDataHandleMax) +end module wrf_data +module ext_ncd_support_routines + implicit none +CONTAINS +subroutine allocHandle(DataHandle,DH,Comm,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(out) :: DataHandle + type(wrf_data_handle),pointer :: DH + integer ,intent(IN) :: Comm + integer ,intent(out) :: Status + integer :: i + integer :: stat + do i=1,WrfDataHandleMax + if(WrfDataHandles(i)%Free) then + DH => WrfDataHandles(i) + DataHandle = i + allocate(DH%Times(MaxTimes), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 124 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimLengths(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 131 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimIDs(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimNames(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 145 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarDimLens(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 159 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 166 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 173 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarDimLens(NVarDims-1,MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 187 + call wrf_debug ( FATAL , msg) + return + endif + exit + endif + if(i==WrfDataHandleMax) then + Status = WRF_WARN_TOO_MANY_FILES + write(msg,*) 'Warning TOO MANY FILES in ',"wrf_io.F90",', line', 195 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) 'Did you call ext_ncd_ioinit?' + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + DH%Free =.false. + DH%Comm = Comm + DH%Write =.false. + DH%first_operation = .TRUE. + DH%R4OnOutput = .false. + DH%nofill = .false. + Status = WRF_NO_ERR +end subroutine allocHandle +subroutine deallocHandle(DataHandle, Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + IF ( DataHandle .GE. 1 .AND. DataHandle .LE. WrfDataHandleMax ) THEN + if(.NOT. WrfDataHandles(DataHandle)%Free) then + DH => WrfDataHandles(DataHandle) + deallocate(DH%Times, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 226 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimLengths, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 233 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 240 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 247 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 254 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 261 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 268 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 275 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 282 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 289 + call wrf_debug ( FATAL , msg) + return + endif + DH%Free =.TRUE. + endif + ENDIF + Status = WRF_NO_ERR +end subroutine deallocHandle +subroutine GetDH(DataHandle,DH,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + type(wrf_data_handle) ,pointer :: DH + integer ,intent(out) :: Status + if(DataHandle < 1 .or. DataHandle > WrfDataHandleMax) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + DH => WrfDataHandles(DataHandle) + if(DH%Free) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + Status = WRF_NO_ERR + return +end subroutine GetDH +subroutine DateCheck(Date,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Date + integer ,intent(out) :: Status + if(len(Date) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + else + Status = WRF_NO_ERR + endif + return +end subroutine DateCheck + +subroutine GetName(Element,Var,Name,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Name + integer ,intent(out) :: Status + character (VarNameLen) :: VarName + character (1) :: c + integer :: i + integer, parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + + VarName = Var + Name = 'MD___' + do i=1,len(Name) + c=Name(i:i) + if('A'<=c .and. c <='Z') Name(i:i)=achar(iachar(c)+upper_to_lower) + if(c=='-'.or.c==':') Name(i:i)='_' + enddo + Status = WRF_NO_ERR + return +end subroutine GetName + +subroutine GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: TimeIndex + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VStart(2) + integer :: VCount(2) + integer :: stat + integer :: i + + DH => WrfDataHandles(DataHandle) + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + Status = WRF_WARN_DATESTR_ERROR + write(msg,*) 'Warning DATE STRING ERROR in ',"wrf_io.F90",', line', 375 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(IO == 'write') then + TimeIndex = DH%TimeIndex + if(TimeIndex <= 0) then + TimeIndex = 1 + elseif(DateStr == DH%Times(TimeIndex)) then + Status = WRF_NO_ERR + return + else + TimeIndex = TimeIndex +1 + if(TimeIndex > MaxTimes) then + Status = WRF_WARN_TIME_EOF + write(msg,*) 'Warning TIME EOF in ',"wrf_io.F90",', line', 390 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + DH%TimeIndex = TimeIndex + DH%Times(TimeIndex) = DateStr + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = DateStrLen + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT(DH%NCID,DH%TimesVarID,VStart,VCount,DateStr) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 404 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + Status = WRF_NO_ERR + TimeIndex = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + write(msg,*) 'Warning TIME ',DateStr,' NOT FOUND in ',"wrf_io.F90",', line', 417 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + return +end subroutine GetTimeIndex + +subroutine GetDim(MemoryOrder,NDim,Status) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(out) :: NDim + integer ,intent(out) :: Status + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + NDim = 3 + case ('xy','yx','xs','xe','ys','ye','cc') + NDim = 2 + case ('z','c') + NDim = 1 + case ('0') ! NDim=0 for scalars. TBH: 20060502 + NDim = 0 + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine GetDim +subroutine GetIndices(NDim,Start,End,i1,i2,j1,j2,k1,k2) + integer ,intent(in) :: NDim + integer ,dimension(*),intent(in) :: Start,End + integer ,intent(out) :: i1,i2,j1,j2,k1,k2 + i1=1 + i2=1 + j1=1 + j2=1 + k1=1 + k2=1 + if(NDim == 0) return ! NDim=0 for scalars. TBH: 20060502 + i1 = Start(1) + i2 = End (1) + if(NDim == 1) return + j1 = Start(2) + j2 = End (2) + if(NDim == 2) return + k1 = Start(3) + k2 = End (3) + return +end subroutine GetIndices +logical function ZeroLengthHorzDim(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(in) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + logical zero_length + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + zero_length = .false. + select case (MemOrd) + case ('xsz','xez','ysz','yez','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy','yzx') + zero_length = temp(1) .lt. 1 .or. temp(3) .lt. 1 + case ('xy','yx','xyz','yxz') + zero_length = temp(1) .lt. 1 .or. temp(2) .lt. 1 + case ('zxy','zyx') + zero_length = temp(2) .lt. 1 .or. temp(3) .lt. 1 + case default + Status = WRF_WARN_BAD_MEMORYORDER + ZeroLengthHorzDim = .true. + return + end select + Status = WRF_NO_ERR + ZeroLengthHorzDim = zero_length + return +end function ZeroLengthHorzDim +subroutine ExtOrder(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(inout) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + Vector(2) = temp(3) + Vector(3) = temp(2) + case ('yxz') + Vector(1) = temp(2) + Vector(2) = temp(1) + case ('yzx') + Vector(1) = temp(3) + Vector(2) = temp(1) + Vector(3) = temp(2) + case ('zxy') + Vector(1) = temp(2) + Vector(2) = temp(3) + Vector(3) = temp(1) + case ('zyx') + Vector(1) = temp(3) + Vector(3) = temp(1) + case ('yx') + Vector(1) = temp(2) + Vector(2) = temp(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrder +subroutine ExtOrderStr(MemoryOrder,Vector,ROVector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + character*(*),dimension(*) ,intent(in) :: Vector + character(80),dimension(NVarDims),intent(out) :: ROVector + integer ,intent(out) :: Status + integer :: NDim + character*3 :: MemOrd + call GetDim(MemoryOrder,NDim,Status) + ROVector(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + ROVector(2) = Vector(3) + ROVector(3) = Vector(2) + case ('yxz') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case ('yzx') + ROVector(1) = Vector(3) + ROVector(2) = Vector(1) + ROVector(3) = Vector(2) + case ('zxy') + ROVector(1) = Vector(2) + ROVector(2) = Vector(3) + ROVector(3) = Vector(1) + case ('zyx') + ROVector(1) = Vector(3) + ROVector(3) = Vector(1) + case ('yx') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrderStr +subroutine LowerCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + integer :: i,N + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower) + enddo + return +end subroutine LowerCase +subroutine UpperCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: lower_to_upper =IACHAR('A')-IACHAR('a') + integer :: i,N + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c)+lower_to_upper) + enddo + return +end subroutine UpperCase +subroutine netcdf_err(err,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: err + integer ,intent(out) :: Status + character(len=80) :: errmsg + integer :: stat + if( err==NF_NOERR )then + Status = WRF_NO_ERR + else + errmsg = NF_STRERROR(err) + write(msg,*) 'NetCDF error: ',errmsg + call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_WARN_NETCDF + endif + return +end subroutine netcdf_err +subroutine FieldIO(IO,DataHandle,DateStr,Length,MemoryOrder & + ,FieldType,NCID,VarID,XField,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer,dimension(NVarDims),intent(in) :: Length + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: FieldType + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(*) ,intent(inout) :: XField + integer ,intent(out) :: Status + integer :: TimeIndex + integer :: NDim + integer,dimension(NVarDims) :: VStart + integer,dimension(NVarDims) :: VCount +! include 'wrf_io_flags.h' + call GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning in ',"wrf_io.F90",', line', 704 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' Bad time index for DateStr = ',DateStr + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + VStart(:) = 1 + VCount(:) = 1 + VStart(1:NDim) = 1 + VCount(1:NDim) = Length(1:NDim) + VStart(NDim+1) = TimeIndex + VCount(NDim+1) = 1 + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + call ext_ncd_RealFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_DOUBLE) THEN + call ext_ncd_DoubleFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_INTEGER) THEN + call ext_ncd_IntFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_LOGICAL) THEN + call ext_ncd_LogicalFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + if(Status /= WRF_NO_ERR) return + ELSE + write(6,*) 'WARNING---- some missing calls commented out' + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 731 + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + return +end subroutine FieldIO +subroutine Transpose(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + integer ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) +!jm 010827 integer ,intent(inout) :: XField(di,x1:x2,y1:y2,z1:z2) + integer ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + case ('xzy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yxz') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zxy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yzx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zyx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + end select + return +end subroutine Transpose +subroutine reorder (MemoryOrder,MemO) + character*(*) ,intent(in) :: MemoryOrder + character*3 ,intent(out) :: MemO + character*3 :: MemOrd + integer :: N,i,i1,i2,i3 + MemO = MemoryOrder + N = len_trim(MemoryOrder) + if(N == 1) return + call lowercase(MemoryOrder,MemOrd) +! never invert the boundary codes + select case ( MemOrd ) + case ( 'xsz','xez','ysz','yez' ) + return + case default + continue + end select + i1 = 1 + i3 = 1 + do i=2,N + if(ichar(MemOrd(i:i)) < ichar(MemOrd(i1:i1))) I1 = i + if(ichar(MemOrd(i:i)) > ichar(MemOrd(i3:i3))) I3 = i + enddo + if(N == 2) then + i2=i3 + else + i2 = 6-i1-i3 + endif + MemO(1:1) = MemoryOrder(i1:i1) + MemO(2:2) = MemoryOrder(i2:i2) + if(N == 3) MemO(3:3) = MemoryOrder(i3:i3) + if(MemOrd(i1:i1) == 's' .or. MemOrd(i1:i1) == 'e') then + MemO(1:N-1) = MemO(2:N) + MemO(N:N ) = MemoryOrder(i1:i1) + endif + return +end subroutine reorder +! Returns .TRUE. iff it is OK to write time-independent domain metadata to the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_put_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, first_output, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 846 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + first_output = ncd_is_first_operation( DataHandle ) + retval = .NOT. dryrun .AND. first_output + ENDIF + ncd_ok_to_put_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_put_dom_ti +! Returns .TRUE. iff it is OK to read time-independent domain metadata from the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_get_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 872 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + retval = .NOT. dryrun + ENDIF + ncd_ok_to_get_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_get_dom_ti +! Returns .TRUE. iff nothing has been read from or written to the file +! referenced by DataHandle. If DataHandle is invalid, .FALSE. is returned. +LOGICAL FUNCTION ncd_is_first_operation( DataHandle ) + USE wrf_data + INCLUDE 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + TYPE(wrf_data_handle) ,POINTER :: DH + INTEGER :: Status + LOGICAL :: retval + CALL GetDH( DataHandle, DH, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 895 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + retval = DH%first_operation + ENDIF + ncd_is_first_operation = retval + RETURN +END FUNCTION ncd_is_first_operation +subroutine upgrade_filename(FileName) + implicit none + character*(*), intent(inout) :: FileName + integer :: i + do i = 1, len(trim(FileName)) + if(FileName(i:i) == '-') then + FileName(i:i) = '_' + else if(FileName(i:i) == ':') then + FileName(i:i) = '_' + endif + enddo +end subroutine upgrade_filename +end module ext_ncd_support_routines +subroutine TransposeToR4(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + use ext_ncd_support_routines + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + real*8 ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) + real*4 ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) +!#define A-A1+1+(A2-A1+1)*((B-B1)+(C-C1)*(B2-B1+1)) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + case ('xzy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yxz') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zxy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yzx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zyx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + end select + return +end subroutine TransposeToR4 +subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), INTENT(IN) :: DatasetName + integer , INTENT(IN) :: Comm1, Comm2 + character *(*), INTENT(IN) :: SysDepInfo + integer , INTENT(OUT) :: DataHandle + integer , INTENT(OUT) :: Status + DataHandle = 0 ! dummy setting to quiet warning message + CALL ext_ncd_open_for_read_begin( DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status ) + IF ( Status .EQ. WRF_NO_ERR ) THEN + CALL ext_ncd_open_for_read_commit( DataHandle, Status ) + ENDIF + return +end subroutine ext_ncd_open_for_read +!ends training phase; switches internal flag to enable input +!must be paired with call to ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_read_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer, intent(in) :: DataHandle + integer, intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1013 + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1019 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_READ + DH%first_operation = .TRUE. + Status = WRF_NO_ERR + return +end subroutine ext_ncd_open_for_read_commit +subroutine ext_ncd_open_for_read_begin( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1064 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 1070 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_NOWRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1078 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1085 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1092 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 1098 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1105 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',"wrf_io.F90",', line', 1111 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1118 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',"wrf_io.F90",', line', 1124 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1133 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1140 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1149 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_update( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1204 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 1210 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_WRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1217 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1224 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1231 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 1237 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1244 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',"wrf_io.F90",', line', 1250 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1257 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',"wrf_io.F90",', line', 1263 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1272 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1279 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1288 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_FOR_UPDATE + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_update +SUBROUTINE ext_ncd_open_for_write_begin(FileName,Comm,IOComm,SysDepInfo,DataHandle,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(inout) :: FileName + integer ,intent(in) :: Comm + integer ,intent(in) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + character (7) :: Buffer + integer :: VDimIDs(2) + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_begin: ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1338 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1344 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + DH%TimeIndex = 0 + DH%Times = ZeroDate + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1374 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + stat = NF_DEF_DIM(DH%NCID,DH%DimUnlimName,NF_UNLIMITED,DH%DimUnlimID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1383 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarNames (1:MaxVars) = NO_NAME + DH%MDVarNames(1:MaxVars) = NO_NAME + do i=1,MaxDims + write(Buffer,FMT="('DIM',i4.4)") i + DH%DimNames (i) = Buffer + DH%DimLengths(i) = NO_DIM + enddo + DH%DimNames(1) = 'DateStrLen' + stat = NF_DEF_DIM(DH%NCID,DH%DimNames(1),DateStrLen,DH%DimIDs(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1398 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VDimIDs(1) = DH%DimIDs(1) + VDimIDs(2) = DH%DimUnlimID + stat = NF_DEF_VAR(DH%NCID,DH%TimesName,NF_CHAR,2,VDimIDs,DH%TimesVarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1407 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(1) = DateStrLen + if (index(SysDepInfo,'REAL_OUTPUT_SIZE=4') /= 0) then + DH%R4OnOutput = .true. + end if +!toggle on nofill mode + if (index(SysDepInfo,'NOFILL=.TRUE.') /= 0) then + DH%nofill = .true. + end if + return +end subroutine ext_ncd_open_for_write_begin +!stub +!opens a file for writing or coupler datastream for sending messages. +!no training phase for this version of the open stmt. +subroutine ext_ncd_open_for_write (DatasetName, Comm1, Comm2, & + SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), intent(in) ::DatasetName + integer , intent(in) ::Comm1, Comm2 + character *(*), intent(in) ::SysDepInfo + integer , intent(out) :: DataHandle + integer , intent(out) :: Status + Status=WRF_WARN_NOOP + DataHandle = 0 ! dummy setting to quiet warning message + return +end subroutine ext_ncd_open_for_write +SUBROUTINE ext_ncd_open_for_write_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + integer :: oldmode ! for nf_set_fill, not used + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_commit: ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1459 + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_open_for_write_commit ',"wrf_io.F90",', line', 1465 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if ( DH%nofill ) then + Status = NF_SET_FILL(DH%NCID,NF_NOFILL, oldmode ) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' from NF_SET_FILL ',"wrf_io.F90",', line', 1472 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + write(msg,*) 'Information: NOFILL being set for writing to ',TRIM(DH%FileName) + call wrf_debug ( WARN , TRIM(msg)) + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_commit ',"wrf_io.F90",', line', 1482 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + DH%first_operation = .TRUE. + return +end subroutine ext_ncd_open_for_write_commit +subroutine ext_ncd_ioclose(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_ioclose ',"wrf_io.F90",', line', 1504 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_ioclose ',"wrf_io.F90",', line', 1510 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_CLOSE + write(msg,*) 'Warning TRY TO CLOSE DRYRUN in ext_ncd_ioclose ',"wrf_io.F90",', line', 1514 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_ioclose ',"wrf_io.F90",', line', 1524 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_CLOSE(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_ioclose ',"wrf_io.F90",', line', 1532 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + CALL deallocHandle( DataHandle, Status ) + DH%Free=.true. + return +end subroutine ext_ncd_ioclose +subroutine ext_ncd_iosync( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_iosync ',"wrf_io.F90",', line', 1554 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_iosync ',"wrf_io.F90",', line', 1560 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ext_ncd_iosync ',"wrf_io.F90",', line', 1564 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_iosync ',"wrf_io.F90",', line', 1572 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_SYNC(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_iosync ',"wrf_io.F90",', line', 1579 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + return +end subroutine ext_ncd_iosync +subroutine ext_ncd_redef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1601 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 1607 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 1611 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',"wrf_io.F90",', line', 1619 + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 1623 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1630 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + return +end subroutine ext_ncd_redef +subroutine ext_ncd_enddef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1651 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 1657 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 1661 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',"wrf_io.F90",', line', 1667 + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 1671 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1678 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + return +end subroutine ext_ncd_enddef +subroutine ext_ncd_ioinit(SysDepInfo, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + CHARACTER*(*), INTENT(IN) :: SysDepInfo + INTEGER ,INTENT(INOUT) :: Status + WrfIOnotInitialized = .false. + WrfDataHandles(1:WrfDataHandleMax)%Free = .true. + WrfDataHandles(1:WrfDataHandleMax)%TimesName = 'Times' + WrfDataHandles(1:WrfDataHandleMax)%DimUnlimName = 'Time' + WrfDataHandles(1:WrfDataHandleMax)%FileStatus = WRF_FILE_NOT_OPENED + if(trim(SysDepInfo) == "use_netcdf_classic" ) then + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .true. + else + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .false. + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_ioinit +subroutine ext_ncd_inquiry (Inquiry, Result, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + character *(*), INTENT(IN) :: Inquiry + character *(*), INTENT(OUT) :: Result + integer ,INTENT(INOUT) :: Status + SELECT CASE (Inquiry) + CASE ("RANDOM_WRITE","RANDOM_READ","SEQUENTIAL_WRITE","SEQUENTIAL_READ") + Result='ALLOW' + CASE ("OPEN_READ","OPEN_COMMIT_WRITE") + Result='REQUIRE' + CASE ("OPEN_WRITE","OPEN_COMMIT_READ","PARALLEL_IO") + Result='NO' + CASE ("SELF_DESCRIBING","SUPPORT_METADATA","SUPPORT_3D_FIELDS") + Result='YES' + CASE ("MEDIUM") + Result ='FILE' + CASE DEFAULT + Result = 'No Result for that inquiry!' + END SELECT + Status=WRF_NO_ERR + return +end subroutine ext_ncd_inquiry +subroutine ext_ncd_ioexit(Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer , INTENT(INOUT) ::Status + integer :: error + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1749 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,WrfDataHandleMax + CALL deallocHandle( i , stat ) + enddo + return +end subroutine ext_ncd_ioexit +subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + real,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_REAL (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_real +subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + integer,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_integer +subroutine ext_ncd_get_dom_ti_double(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real*8,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + real*8,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_double +subroutine ext_ncd_get_dom_ti_logical(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + integer,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_logical +subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*),intent(out) :: Data + + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_ATT_TEXT(DH%NCID,NF_GLOBAL,Element,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_char +subroutine ext_ncd_put_dom_ti_real(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real ,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_REAL (DH%NCID,NF_GLOBAL,Element,NF_FLOAT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_REAL (DH%NCID,NF_GLOBAL,Element,NF_FLOAT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_real +subroutine ext_ncd_put_dom_ti_integer(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + integer,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_integer +subroutine ext_ncd_put_dom_ti_double(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real*8 ,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,NF_DOUBLE,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,NF_DOUBLE,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_double +subroutine ext_ncd_put_dom_ti_logical(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + logical,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 77 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 92 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 119 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 135 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_logical +subroutine ext_ncd_put_dom_ti_char(DataHandle,Element,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*),intent(in) :: Data + integer,parameter :: Count=1 + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_TEXT (DH%NCID,NF_GLOBAL,Element,len_trim(Data),Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_TEXT (DH%NCID,NF_GLOBAL,Element,len_trim(Data),Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_char +subroutine ext_ncd_put_var_ti_real(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_REAL(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_FLOAT,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_real +subroutine ext_ncd_put_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_FLOAT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_REAL (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_real +subroutine ext_ncd_put_var_ti_double(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_DOUBLE(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_DOUBLE,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_double +subroutine ext_ncd_put_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real*8,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_DOUBLE,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_DOUBLE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_double +subroutine ext_ncd_put_var_ti_integer(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_INT,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_integer +subroutine ext_ncd_put_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_INT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_INT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_integer +subroutine ext_ncd_put_var_ti_logical(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 99 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_INT,Count,Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 124 + call wrf_debug ( WARN , msg) + endif + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 132 + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_logical +subroutine ext_ncd_put_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_INT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 196 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_VARA_INT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 212 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_logical +subroutine ext_ncd_put_var_ti_char(DataHandle,Element,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(in) :: Data + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + if(len_trim(Data).le.0) then + stat = NF_PUT_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element),len_trim(null),null) + else + stat = NF_PUT_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element), len_trim(Data),trim(Data) ) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_char +subroutine ext_ncd_put_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + character*(*) ,intent(in) :: Data + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(len(Data) < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == len(Data)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),len(Data),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = len(Data) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = len(Data) + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_CHAR,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(len(Data) > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(len(Data) < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = len(Data) + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_char +subroutine ext_ncd_get_var_ti_real(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + real ,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_REAL(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_real +subroutine ext_ncd_get_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + real ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_REAL (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_real +subroutine ext_ncd_get_var_ti_double(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real*8 ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + real*8 ,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_DOUBLE(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_double +subroutine ext_ncd_get_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real*8 ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + real*8 ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_DOUBLE (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_double +subroutine ext_ncd_get_var_ti_integer(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + integer,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_integer +subroutine ext_ncd_get_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_INT (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_integer +subroutine ext_ncd_get_var_ti_logical(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + integer,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_logical +subroutine ext_ncd_get_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_INT (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_logical +subroutine ext_ncd_get_var_ti_char(DataHandle,Element,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Data + integer :: Count = 1 + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + if(XLen > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 137 + call wrf_debug ( WARN , msg) + return + endif + stat = NF_GET_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element), Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_char +subroutine ext_ncd_get_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Data + integer :: Count = 1 + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + character (80) ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Len1 + VCount(2) = 1 + if(Len1 > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 189 + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_VARA_TEXT (NCID,VarID,VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_char +subroutine ext_ncd_put_dom_td_real(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_real +subroutine ext_ncd_put_dom_td_integer(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_integer +subroutine ext_ncd_put_dom_td_double(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_double +subroutine ext_ncd_put_dom_td_logical(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_logical +subroutine ext_ncd_put_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Data + integer ,intent(out) :: Status + call ext_ncd_put_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_put_dom_td_char +subroutine ext_ncd_get_dom_td_real(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_real +subroutine ext_ncd_get_dom_td_integer(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_integer +subroutine ext_ncd_get_dom_td_double(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_double +subroutine ext_ncd_get_dom_td_logical(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_logical +subroutine ext_ncd_get_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(out) :: Data + integer ,intent(out) :: Status + call ext_ncd_get_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_get_dom_td_char +subroutine ext_ncd_write_field(DataHandle,DateStr,Var,Field,FieldTypeIn, & + Comm, IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(inout) :: Field(*) + integer ,intent(in) :: FieldTypeIn + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) ,dimension(*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + integer :: FieldType + character (3) :: MemoryOrder + type(wrf_data_handle) ,pointer :: DH + integer :: NCID + integer :: NDim + character (VarNameLen) :: VarName + character (3) :: MemO + character (3) :: UCMemO + integer :: VarID + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + character(80),dimension(NVarDims) :: RODimNames + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(:,:,:,:),allocatable :: XField + integer :: stat + integer :: NVar + integer :: i,j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + integer :: XType + integer :: di + character (80) :: NullName + logical :: NotFound + MemoryOrder = trim(adjustl(MemoryOrdIn)) + NullName=char(0) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',MemoryOrder,'| in ',"wrf_io.F90",', line', 2482 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',DateStr,'| in ',"wrf_io.F90",', line', 2489 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 2496 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NCID = DH%NCID + if ( DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE ) then + FieldType = WRF_REAL + else + FieldType = FieldTypeIn + end if + write(msg,*)'ext_ncd_write_field: called for ',TRIM(Var) +!jm 010827 Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + IF ( ZeroLengthHorzDim(MemoryOrder,Length,Status) ) THEN + write(msg,*)'ext_ncd_write_field: zero length dimension in ',TRIM(Var),'. Ignoring' + call wrf_debug ( WARN , TRIM(msg)) + return + ENDIF + call ExtOrder(MemoryOrder,Length,Status) + call ExtOrderStr(MemoryOrder,DimNames,RODimNames,Status) + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 2533 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) 'Warning WRITE READ ONLY FILE in ',"wrf_io.F90",', line', 2537 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(DH%VarNames(NVar) == VarName ) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + write(msg,*) 'Warning 2 DRYRUNS 1 VARIABLE in ',"wrf_io.F90",', line', 2543 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%VarNames(NVar) == NO_NAME) then + DH%VarNames(NVar) = VarName + DH%NumVars = NVar + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) 'Warning TOO MANY VARIABLES in ',"wrf_io.F90",', line', 2552 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + do j = 1,NDim + if(RODimNames(j) == NullName .or. RODimNames(j) == '') then + do i=1,MaxDims + if(DH%DimLengths(i) == Length(j)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2566 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',"wrf_io.F90",', line', 2574 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else !look for input name and check if already defined + NotFound = .true. + do i=1,MaxDims + if (DH%DimNames(i) == RODimNames(j)) then + if (DH%DimLengths(i) == Length(j)) then + NotFound = .false. + exit + else + Status = WRF_WARN_DIMNAME_REDEFINED + write(msg,*) 'Warning DIM ',i,', NAME ',TRIM(DH%DimNames(i)),' REDEFINED by var ', & + TRIM(Var),' ',DH%DimLengths(i),Length(j) ,' in ', "wrf_io.F90" ,' line', 2589 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + enddo + if (NotFound) then + do i=1,MaxDims + if (DH%DimLengths(i) == NO_DIM) then + DH%DimNames(i) = RODimNames(j) + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2602 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',"wrf_io.F90",', line', 2610 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + endif + VDimIDs(j) = DH%DimIDs(i) + DH%VarDimLens(j,NVar) = Length(j) + enddo + VDimIDs(NDim+1) = DH%DimUnlimID + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + XType = NF_FLOAT + ELSE IF (FieldType == WRF_DOUBLE) THEN + Xtype = NF_DOUBLE + ELSE IF (FieldType == WRF_INTEGER) THEN + XType = NF_INT + ELSE IF (FieldType == WRF_LOGICAL) THEN + XType = NF_INT + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 2633 + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + stat = NF_DEF_VAR(NCID,VarName,XType,NDim+1,VDimIDs,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error for ',TRIM(VarName),' in ',"wrf_io.F90",', line', 2641 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarIDs(NVar) = VarID + stat = NF_PUT_ATT_INT(NCID,VarID,'FieldType',NF_INT,1,FieldType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',"wrf_io.F90",', line', 2697 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call reorder(MemoryOrder,MemO) + call uppercase(MemO,UCMemO) + stat = NF_PUT_ATT_TEXT(NCID,VarID,'MemoryOrder',3,UCMemO) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',"wrf_io.F90",', line', 2706 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) 'Warning VARIABLE NOT FOUND in ',"wrf_io.F90",', line', 2716 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + VarID = DH%VarIDs(NVar) + do j=1,NDim + if(Length(j) /= DH%VarDimLens(j,NVar) .AND. DH%FileStatus /= WRF_FILE_OPENED_FOR_UPDATE ) then + Status = WRF_WARN_WRTLEN_NE_DRRUNLEN + write(msg,*) 'Warning LENGTH != DRY RUN LENGTH for |', & + VarName,'| dim ',j,' in ',"wrf_io.F90",', line', 2726 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' LENGTH ',Length(j),' DRY RUN LENGTH ',DH%VarDimLens(j,NVar) + call wrf_debug ( WARN , TRIM(msg)) + return +!jm 010825 elseif(DomainStart(j) < MemoryStart(j)) then + elseif(PatchStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning DIMENSION ERROR for |',VarName, & + '| in ',"wrf_io.F90",', line', 2735 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,Length ,x1,x2,y1,y2,z1,z2) + call GetIndices(NDim,PatchStart, PatchEnd ,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 2749 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + if (DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE) then + call TransposeToR4('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + else + call Transpose('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + end if + call FieldIO('write',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 2765 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 2772 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 2778 + call wrf_debug ( FATAL , TRIM(msg)) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_write_field +subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & + IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(out) :: Field(*) + integer ,intent(in) :: FieldType + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) , dimension (*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + character (3) :: MemoryOrder + character (NF_MAX_NAME) :: dimname + type(wrf_data_handle) ,pointer :: DH + integer :: NDim + integer :: NCID + character (VarNameLen) :: VarName + integer :: VarID + integer ,dimension(NVarDims) :: VCount + integer ,dimension(NVarDims) :: VStart + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + integer ,dimension(NVarDims) :: MemS + integer ,dimension(NVarDims) :: MemE + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(NVarDims) :: StoredLen + integer ,dimension(:,:,:,:) ,allocatable :: XField + integer :: NVar + integer :: j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + character (VarNameLen) :: Name + integer :: XType + integer :: StoredDim + integer :: NAtts + integer :: Len + integer :: stat + integer :: di + integer :: FType + MemoryOrder = trim(adjustl(MemoryOrdIn)) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',TRIM(MemoryOrder),'| for |', & + TRIM(Var),'| in ext_ncd_read_field ',"wrf_io.F90",', line', 2842 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',TRIM(DateStr),'| for |',TRIM(Var), & + '| in ext_ncd_read_field ',"wrf_io.F90",', line', 2849 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_read_field ',"wrf_io.F90",', line', 2856 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 2862 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +! jm it is okay to have a dry run read. means read is called between ofrb and ofrc. Just return. +! Status = WRF_WARN_DRYRUN_READ +! write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 2867 +! call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_NO_ERR + RETURN + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 2873 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + NCID = DH%NCID +!jm Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + call ExtOrder(MemoryOrder,Length,Status) + stat = NF_INQ_VARID(NCID,VarName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2884,' Varname ',Varname + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(NCID,VarID,Name,XType,StoredDim,VDimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2891 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(NCID,VarID,'FieldType',FType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2898 + call wrf_debug ( WARN , TRIM(msg)) + return + endif +! allow coercion between double and single prec real +!jm if(FieldType /= Ftype) then + if( (FieldType == WRF_REAL .OR. FieldType == WRF_DOUBLE) ) then + if ( .NOT. (Ftype == WRF_REAL .OR. Ftype == WRF_DOUBLE )) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 2907 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else if(FieldType /= Ftype) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 2913 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning REAL TYPE MISMATCH in ',"wrf_io.F90",', line', 2923 + endif + ELSE IF (FieldType == WRF_DOUBLE) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning DOUBLE TYPE MISMATCH in ',"wrf_io.F90",', line', 2929 + endif + ELSE IF (FieldType == WRF_INTEGER) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning INTEGER TYPE MISMATCH in ',"wrf_io.F90",', line', 2934 + endif + ELSE IF (FieldType == WRF_LOGICAL) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning LOGICAL TYPE MISMATCH in ',"wrf_io.F90",', line', 2939 + endif + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 2943 + END IF + if(Status /= WRF_NO_ERR) then + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! NDim=0 for scalars. Handle read of old NDim=1 files. TBH: 20060502 + IF ( ( NDim == 0 ) .AND. ( StoredDim == 2 ) ) THEN + stat = NF_INQ_DIMNAME(NCID,VDimIDs(1),dimname) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2955 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + IF ( dimname(1:10) == 'ext_scalar' ) THEN + NDim = 1 + Length(1) = 1 + ENDIF + ENDIF + if(StoredDim /= NDim+1) then + Status = WRF_ERR_FATAL_BAD_VARIABLE_DIM + write(msg,*) 'Fatal error BAD VARIABLE DIMENSION in ext_ncd_read_field ',TRIM(Var),TRIM(DateStr) + call wrf_debug ( FATAL , msg) + write(msg,*) ' StoredDim ', StoredDim, ' .NE. NDim+1 ', NDim+1 + call wrf_debug ( FATAL , msg) + return + endif + do j=1,NDim + stat = NF_INQ_DIMLEN(NCID,VDimIDs(j),StoredLen(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2976 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(Length(j) > StoredLen(j)) then + Status = WRF_WARN_READ_PAST_EOF + write(msg,*) 'Warning READ PAST EOF in ext_ncd_read_field of ',TRIM(Var),Length(j),'>',StoredLen(j) + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Length(j) <= 0) then + Status = WRF_WARN_ZERO_LENGTH_READ + write(msg,*) 'Warning ZERO LENGTH READ in ',"wrf_io.F90",', line', 2987 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DomainStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning dim ',j,' DomainStart (',DomainStart(j), & + ') < MemoryStart (',MemoryStart(j),') in ',"wrf_io.F90",', line', 2993 + call wrf_debug ( WARN , TRIM(msg)) +! return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,StoredLen,x1,x2,y1,y2,z1,z2) +!jm call GetIndices(NDim,DomainStart,DomainEnd,i1,i2,j1,j2,k1,k2) + call GetIndices(NDim,PatchStart,PatchEnd,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 3010 + call wrf_debug ( FATAL , msg) + return + endif + call FieldIO('read',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3017 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call Transpose('read',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 3027 + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3033 + call wrf_debug ( FATAL , msg) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_read_field +subroutine ext_ncd_inquire_opened( DataHandle, FileName , FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(inout) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + !call upgrade_filename(FileName) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + FileStatus = WRF_FILE_NOT_OPENED + return + endif + if(trim(FileName) /= trim(DH%FileName)) then + FileStatus = WRF_FILE_NOT_OPENED + else + FileStatus = DH%FileStatus + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_opened +subroutine ext_ncd_inquire_filename( Datahandle, FileName, FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + FileStatus = WRF_FILE_NOT_OPENED + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3080 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + FileName = trim(DH%FileName) + FileStatus = DH%FileStatus + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_filename +subroutine ext_ncd_set_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: i + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR in ',"wrf_io.F90",', line', 3103 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3109 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3115 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 3119 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3123 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + DH%CurrentTime = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + return + endif + enddo + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3140 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_set_time +subroutine ext_ncd_get_next_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3158 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3164 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3168 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3172 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + if(DH%CurrentTime >= DH%NumberTimes) then + Status = WRF_WARN_TIME_EOF + return + endif + DH%CurrentTime = DH%CurrentTime +1 + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'DH%FileStatus ',DH%FileStatus + call wrf_debug ( FATAL , msg) + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3187 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_time +subroutine ext_ncd_get_previous_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3205 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3211 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3215 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3219 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + if(DH%CurrentTime.GT.0) then + DH%CurrentTime = DH%CurrentTime -1 + endif + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3230 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_previous_time +subroutine ext_ncd_get_next_var(DataHandle, VarName, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: VarName + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + character (80) :: Name + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3251 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3257 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3261 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3265 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + DH%CurrentVariable = DH%CurrentVariable +1 + if(DH%CurrentVariable > DH%NumVars) then + Status = WRF_WARN_VAR_EOF + return + endif + VarName = DH%VarNames(DH%CurrentVariable) + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3278 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_var +subroutine ext_ncd_end_of_frame(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + return +end subroutine ext_ncd_end_of_frame +! NOTE: For scalar variables NDim is set to zero and DomainStart and +! NOTE: DomainEnd are left unmodified. +subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder,Stagger,DomainStart,DomainEnd,WrfType,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Name + integer ,intent(out) :: NDim + character*(*) ,intent(out) :: MemoryOrder + character*(*) :: Stagger ! Dummy for now + integer ,dimension(*) ,intent(out) :: DomainStart, DomainEnd + integer ,intent(out) :: WrfType + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VarID + integer ,dimension(NVarDims) :: VDimIDs + integer :: j + integer :: stat + integer :: XType + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3323 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3329 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3334 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3339 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_INQ_VARID(DH%NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3346 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARTYPE(DH%NCID,VarID,XType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3353 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,VarID,'FieldType',WrfType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3360 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + select case (XType) + case (NF_BYTE) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BYTE IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3367 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_CHAR) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning CHAR IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3372 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_SHORT) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning SHORT IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3377 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_INT) + if(WrfType /= WRF_INTEGER .and. WrfType /= WRF_LOGICAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3383 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_FLOAT) + if(WrfType /= WRF_REAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3390 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_DOUBLE) + if(WrfType /= WRF_DOUBLE) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3397 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case default + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 3403 + call wrf_debug ( WARN , TRIM(msg)) + return + end select + stat = NF_GET_ATT_TEXT(DH%NCID,VarID,'MemoryOrder',MemoryOrder) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3411 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER ',TRIM(MemoryOrder),' in ',"wrf_io.F90",', line', 3417 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARDIMID(DH%NCID,VarID,VDimIDs) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3424 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + do j = 1, NDim + DomainStart(j) = 1 + stat = NF_INQ_DIMLEN(DH%NCID,VDimIDs(j),DomainEnd(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3433 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3440 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_info +subroutine ext_ncd_warning_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + SELECT CASE (Code) + CASE (0) + ReturnString='No error' + Status=WRF_NO_ERR + return + CASE (-1) + ReturnString= 'File not found (or file is incomplete)' + Status=WRF_NO_ERR + return + CASE (-2) + ReturnString='Metadata not found' + Status=WRF_NO_ERR + return + CASE (-3) + ReturnString= 'Timestamp not found' + Status=WRF_NO_ERR + return + CASE (-4) + ReturnString= 'No more timestamps' + Status=WRF_NO_ERR + return + CASE (-5) + ReturnString= 'Variable not found' + Status=WRF_NO_ERR + return + CASE (-6) + ReturnString= 'No more variables for the current time' + Status=WRF_NO_ERR + return + CASE (-7) + ReturnString= 'Too many open files' + Status=WRF_NO_ERR + return + CASE (-8) + ReturnString= 'Data type mismatch' + Status=WRF_NO_ERR + return + CASE (-9) + ReturnString= 'Attempt to write read-only file' + Status=WRF_NO_ERR + return + CASE (-10) + ReturnString= 'Attempt to read write-only file' + Status=WRF_NO_ERR + return + CASE (-11) + ReturnString= 'Attempt to access unopened file' + Status=WRF_NO_ERR + return + CASE (-12) + ReturnString= 'Attempt to do 2 trainings for 1 variable' + Status=WRF_NO_ERR + return + CASE (-13) + ReturnString= 'Attempt to read past EOF' + Status=WRF_NO_ERR + return + CASE (-14) + ReturnString= 'Bad data handle' + Status=WRF_NO_ERR + return + CASE (-15) + ReturnString= 'Write length not equal to training length' + Status=WRF_NO_ERR + return + CASE (-16) + ReturnString= 'More dimensions requested than training' + Status=WRF_NO_ERR + return + CASE (-17) + ReturnString= 'Attempt to read more data than exists' + Status=WRF_NO_ERR + return + CASE (-18) + ReturnString= 'Input dimensions inconsistent' + Status=WRF_NO_ERR + return + CASE (-19) + ReturnString= 'Input MemoryOrder not recognized' + Status=WRF_NO_ERR + return + CASE (-20) + ReturnString= 'A dimension name with 2 different lengths' + Status=WRF_NO_ERR + return + CASE (-21) + ReturnString= 'String longer than provided storage' + Status=WRF_NO_ERR + return + CASE (-22) + ReturnString= 'Function not supportable' + Status=WRF_NO_ERR + return + CASE (-23) + ReturnString= 'Package implements this routine as NOOP' + Status=WRF_NO_ERR + return +!netcdf-specific warning messages + CASE (-1007) + ReturnString= 'Bad data type' + Status=WRF_NO_ERR + return + CASE (-1008) + ReturnString= 'File not committed' + Status=WRF_NO_ERR + return + CASE (-1009) + ReturnString= 'File is opened for reading' + Status=WRF_NO_ERR + return + CASE (-1011) + ReturnString= 'Attempt to write metadata after open commit' + Status=WRF_NO_ERR + return + CASE (-1010) + ReturnString= 'I/O not initialized' + Status=WRF_NO_ERR + return + CASE (-1012) + ReturnString= 'Too many variables requested' + Status=WRF_NO_ERR + return + CASE (-1013) + ReturnString= 'Attempt to close file during a dry run' + Status=WRF_NO_ERR + return + CASE (-1014) + ReturnString= 'Date string not 19 characters in length' + Status=WRF_NO_ERR + return + CASE (-1015) + ReturnString= 'Attempt to read zero length words' + Status=WRF_NO_ERR + return + CASE (-1016) + ReturnString= 'Data type not found' + Status=WRF_NO_ERR + return + CASE (-1017) + ReturnString= 'Badly formatted date string' + Status=WRF_NO_ERR + return + CASE (-1018) + ReturnString= 'Attempt at read during a dry run' + Status=WRF_NO_ERR + return + CASE (-1019) + ReturnString= 'Attempt to get zero words' + Status=WRF_NO_ERR + return + CASE (-1020) + ReturnString= 'Attempt to put zero length words' + Status=WRF_NO_ERR + return + CASE (-1021) + ReturnString= 'NetCDF error' + Status=WRF_NO_ERR + return + CASE (-1022) + ReturnString= 'Requested length <= 1' + Status=WRF_NO_ERR + return + CASE (-1023) + ReturnString= 'More data available than requested' + Status=WRF_NO_ERR + return + CASE (-1024) + ReturnString= 'New date less than previous date' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This warning code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this warning code.' + Status=WRF_NO_ERR + END SELECT + return +end subroutine ext_ncd_warning_str +!returns message string for all WRF and netCDF warning/error status codes +!Other i/o packages must provide their own routines to return their own status messages +subroutine ext_ncd_error_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + SELECT CASE (Code) + CASE (-100) + ReturnString= 'Allocation Error' + Status=WRF_NO_ERR + return + CASE (-101) + ReturnString= 'Deallocation Error' + Status=WRF_NO_ERR + return + CASE (-102) + ReturnString= 'Bad File Status' + Status=WRF_NO_ERR + return + CASE (-1004) + ReturnString= 'Variable on disk is not 3D' + Status=WRF_NO_ERR + return + CASE (-1005) + ReturnString= 'Metadata on disk is not 1D' + Status=WRF_NO_ERR + return + CASE (-1006) + ReturnString= 'Time dimension too small' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This error code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this error code.' + Status=WRF_NO_ERR + END SELECT + return +end subroutine ext_ncd_error_str diff --git a/libsrc/wrflib/wrf_io_flags.h b/libsrc/wrflib/wrf_io_flags.h new file mode 100644 index 0000000000..2048aff665 --- /dev/null +++ b/libsrc/wrflib/wrf_io_flags.h @@ -0,0 +1,15 @@ + integer, parameter :: WRF_FILE_NOT_OPENED = 100 + integer, parameter :: WRF_FILE_OPENED_NOT_COMMITTED = 101 + integer, parameter :: WRF_FILE_OPENED_FOR_WRITE = 102 + integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103 + integer, parameter :: WRF_REAL = 104 + integer, parameter :: WRF_DOUBLE = 105 + integer, parameter :: WRF_FLOAT=WRF_REAL + integer, parameter :: WRF_INTEGER = 106 + integer, parameter :: WRF_LOGICAL = 107 + integer, parameter :: WRF_COMPLEX = 108 + integer, parameter :: WRF_DOUBLE_COMPLEX = 109 + integer, parameter :: WRF_FILE_OPENED_FOR_UPDATE = 110 +! This bit is for backwards compatibility with old variants of these flags +! that are still being used in io_grib1 and io_phdf5. It should be removed! + integer, parameter :: WRF_FILE_OPENED_AND_COMMITTED = 102 diff --git a/libsrc/wrflib/wrf_status_codes.h b/libsrc/wrflib/wrf_status_codes.h new file mode 100644 index 0000000000..059d9ea719 --- /dev/null +++ b/libsrc/wrflib/wrf_status_codes.h @@ -0,0 +1,133 @@ + +!WRF Error and Warning messages (1-999) +!All i/o package-specific status codes you may want to add must be handled by your package (see below) +! WRF handles these and netCDF messages only + integer, parameter :: WRF_NO_ERR = 0 !no error + integer, parameter :: WRF_WARN_FILE_NF = -1 !file not found, or incomplete + integer, parameter :: WRF_WARN_MD_NF = -2 !metadata not found + integer, parameter :: WRF_WARN_TIME_NF = -3 !timestamp not found + integer, parameter :: WRF_WARN_TIME_EOF = -4 !no more timestamps + integer, parameter :: WRF_WARN_VAR_NF = -5 !variable not found + integer, parameter :: WRF_WARN_VAR_EOF = -6 !no more variables for the current time + integer, parameter :: WRF_WARN_TOO_MANY_FILES = -7 !too many open files + integer, parameter :: WRF_WARN_TYPE_MISMATCH = -8 !data type mismatch + integer, parameter :: WRF_WARN_WRITE_RONLY_FILE = -9 !attempt to write readonly file + integer, parameter :: WRF_WARN_READ_WONLY_FILE = -10 !attempt to read writeonly file + integer, parameter :: WRF_WARN_FILE_NOT_OPENED = -11 !attempt to access unopened file + integer, parameter :: WRF_WARN_2DRYRUNS_1VARIABLE = -12 !attempt to do 2 trainings for 1 variable + integer, parameter :: WRF_WARN_READ_PAST_EOF = -13 !attempt to read past EOF + integer, parameter :: WRF_WARN_BAD_DATA_HANDLE = -14 !bad data handle + integer, parameter :: WRF_WARN_WRTLEN_NE_DRRUNLEN = -15 !write length not equal to training length + integer, parameter :: WRF_WARN_TOO_MANY_DIMS = -16 !more dimensions requested than training + integer, parameter :: WRF_WARN_COUNT_TOO_LONG = -17 !attempt to read more data than exists + integer, parameter :: WRF_WARN_DIMENSION_ERROR = -18 !input dimension inconsistent + integer, parameter :: WRF_WARN_BAD_MEMORYORDER = -19 !input MemoryOrder not recognized + integer, parameter :: WRF_WARN_DIMNAME_REDEFINED = -20 !a dimension name with 2 different lengths + integer, parameter :: WRF_WARN_CHARSTR_GT_LENDATA = -21 !string longer than provided storage + integer, parameter :: WRF_WARN_NOTSUPPORTED = -22 !function not supportable + integer, parameter :: WRF_WARN_NOOP = -23 !package implements this routine as NOOP + +!Fatal errors + integer, parameter :: WRF_ERR_FATAL_ALLOCATION_ERROR = -100 !allocation error + integer, parameter :: WRF_ERR_FATAL_DEALLOCATION_ERR = -101 !dealloc error + integer, parameter :: WRF_ERR_FATAL_BAD_FILE_STATUS = -102 !bad file status + + +!Package specific errors (1000+) +!Netcdf status codes +!WRF will accept status codes of 1000+, but it is up to the package to handle +! and return the status to the user. + + integer, parameter :: WRF_ERR_FATAL_BAD_VARIABLE_DIM = -1004 + integer, parameter :: WRF_ERR_FATAL_MDVAR_DIM_NOT_1D = -1005 + integer, parameter :: WRF_ERR_FATAL_TOO_MANY_TIMES = -1006 + integer, parameter :: WRF_WARN_BAD_DATA_TYPE = -1007 !this code not in either spec? + integer, parameter :: WRF_WARN_FILE_NOT_COMMITTED = -1008 !this code not in either spec? + integer, parameter :: WRF_WARN_FILE_OPEN_FOR_READ = -1009 + integer, parameter :: WRF_IO_NOT_INITIALIZED = -1010 + integer, parameter :: WRF_WARN_MD_AFTER_OPEN = -1011 + integer, parameter :: WRF_WARN_TOO_MANY_VARIABLES = -1012 + integer, parameter :: WRF_WARN_DRYRUN_CLOSE = -1013 + integer, parameter :: WRF_WARN_DATESTR_BAD_LENGTH = -1014 + integer, parameter :: WRF_WARN_ZERO_LENGTH_READ = -1015 + integer, parameter :: WRF_WARN_DATA_TYPE_NOT_FOUND = -1016 + integer, parameter :: WRF_WARN_DATESTR_ERROR = -1017 + integer, parameter :: WRF_WARN_DRYRUN_READ = -1018 + integer, parameter :: WRF_WARN_ZERO_LENGTH_GET = -1019 + integer, parameter :: WRF_WARN_ZERO_LENGTH_PUT = -1020 + integer, parameter :: WRF_WARN_NETCDF = -1021 + integer, parameter :: WRF_WARN_LENGTH_LESS_THAN_1 = -1022 + integer, parameter :: WRF_WARN_MORE_DATA_IN_FILE = -1023 + integer, parameter :: WRF_WARN_DATE_LT_LAST_DATE = -1024 + +! For HDF5 only + integer, parameter :: WRF_HDF5_ERR_FILE = -200 + integer, parameter :: WRF_HDF5_ERR_MD = -201 + integer, parameter :: WRF_HDF5_ERR_TIME = -202 + integer, parameter :: WRF_HDF5_ERR_TIME_EOF = -203 + integer, parameter :: WRF_HDF5_ERR_MORE_DATA_IN_FILE = -204 + integer, parameter :: WRF_HDF5_ERR_DATE_LT_LAST_DATE = -205 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_FILES = -206 + integer, parameter :: WRF_HDF5_ERR_TYPE_MISMATCH = -207 + integer, parameter :: WRF_HDF5_ERR_LENGTH_LESS_THAN_1 = -208 + integer, parameter :: WRF_HDF5_ERR_WRITE_RONLY_FILE = -209 + integer, parameter :: WRF_HDF5_ERR_READ_WONLY_FILE = -210 + integer, parameter :: WRF_HDF5_ERR_FILE_NOT_OPENED = -211 + integer, parameter :: WRF_HDF5_ERR_DATESTR_ERROR = -212 + integer, parameter :: WRF_HDF5_ERR_DRYRUN_READ = -213 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_GET = -214 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_PUT = -215 + integer, parameter :: WRF_HDF5_ERR_2DRYRUNS_1VARIABLE = -216 + integer, parameter :: WRF_HDF5_ERR_DATA_TYPE_NOTFOUND = -217 + integer, parameter :: WRF_HDF5_ERR_READ_PAST_EOF = -218 + integer, parameter :: WRF_HDF5_ERR_BAD_DATA_HANDLE = -219 + integer, parameter :: WRF_HDF5_ERR_WRTLEN_NE_DRRUNLEN = -220 + integer, parameter :: WRF_HDF5_ERR_DRYRUN_CLOSE = -221 + integer, parameter :: WRF_HDF5_ERR_DATESTR_BAD_LENGTH = -222 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_READ = -223 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_DIMS = -224 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_VARIABLES = -225 + integer, parameter :: WRF_HDF5_ERR_COUNT_TOO_LONG = -226 + integer, parameter :: WRF_HDF5_ERR_DIMENSION_ERROR = -227 + integer, parameter :: WRF_HDF5_ERR_BAD_MEMORYORDER = -228 + integer, parameter :: WRF_HDF5_ERR_DIMNAME_REDEFINED = -229 + integer, parameter :: WRF_HDF5_ERR_MD_AFTER_OPEN = -230 + integer, parameter :: WRF_HDF5_ERR_CHARSTR_GT_LENDATA = -231 + integer, parameter :: WRF_HDF5_ERR_BAD_DATA_TYPE = -232 + integer, parameter :: WRF_HDF5_ERR_FILE_NOT_COMMITTED = -233 + + integer, parameter :: WRF_HDF5_ERR_ALLOCATION = -2001 + integer, parameter :: WRF_HDF5_ERR_DEALLOCATION = -2002 + integer, parameter :: WRF_HDF5_ERR_BAD_FILE_STATUS = -2003 + integer, parameter :: WRF_HDF5_ERR_BAD_VARIABLE_DIM = -2004 + integer, parameter :: WRF_HDF5_ERR_MDVAR_DIM_NOT_1D = -2005 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_TIMES = -2006 + integer, parameter :: WRF_HDF5_ERR_DATA_ID_NOTFOUND = -2007 + + integer, parameter :: WRF_HDF5_ERR_DATASPACE = -300 + integer, parameter :: WRF_HDF5_ERR_DATATYPE = -301 + integer, parameter :: WRF_HDF5_ERR_PROPERTY_LIST = -302 + + integer, parameter :: WRF_HDF5_ERR_DATASET_CREATE = -303 + integer, parameter :: WRF_HDF5_ERR_DATASET_READ = -304 + integer, parameter :: WRF_HDF5_ERR_DATASET_WRITE = -305 + integer, parameter :: WRF_HDF5_ERR_DATASET_OPEN = -306 + integer, parameter :: WRF_HDF5_ERR_DATASET_GENERAL = -307 + integer, parameter :: WRF_HDF5_ERR_GROUP = -308 + + integer, parameter :: WRF_HDF5_ERR_FILE_OPEN = -309 + integer, parameter :: WRF_HDF5_ERR_FILE_CREATE = -310 + integer, parameter :: WRF_HDF5_ERR_DATASET_CLOSE = -311 + integer, parameter :: WRF_HDF5_ERR_FILE_CLOSE = -312 + integer, parameter :: WRF_HDF5_ERR_CLOSE_GENERAL = -313 + + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_CREATE = -314 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_READ = -315 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_WRITE = -316 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_OPEN = -317 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_GENERAL = -318 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_CLOSE = -319 + + integer, parameter :: WRF_HDF5_ERR_OTHERS = -320 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_OTHERS = -321 + From 53f93f55abf270392f7d10069479623bfdde3529 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Mon, 15 Mar 2021 18:00:51 -0500 Subject: [PATCH 067/155] Remove the submodules fix and libsrc. --- .gitmodules | 6 ------ fix | 1 - libsrc | 1 - 3 files changed, 8 deletions(-) delete mode 160000 fix delete mode 160000 libsrc diff --git a/.gitmodules b/.gitmodules index 9eac6ee698..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +0,0 @@ -[submodule "fix"] - path = fix - url = gerrit:GSI-fix -[submodule "libsrc"] - path = libsrc - url = gerrit:GSI-libsrc diff --git a/fix b/fix deleted file mode 160000 index 82c9a46fab..0000000000 --- a/fix +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 82c9a46fabd8d04686589241c36381ab17810cfd diff --git a/libsrc b/libsrc deleted file mode 160000 index d179dcf245..0000000000 --- a/libsrc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d179dcf245a89fe29511e9cff271d2990debb872 From 6bc67d6a7d830aad5cfd9faf8f4361940e884e43 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Mon, 15 Mar 2021 18:05:32 -0500 Subject: [PATCH 068/155] Import libsrc/wrflib directly. --- libsrc/wrflib/CMakeLists.txt | 11 + libsrc/wrflib/ext_ncd_get_dom_ti.code | 157 + libsrc/wrflib/ext_ncd_get_var_td.code | 227 + libsrc/wrflib/ext_ncd_get_var_ti.code | 174 + libsrc/wrflib/ext_ncd_put_dom_ti.code | 164 + libsrc/wrflib/ext_ncd_put_var_td.code | 233 + libsrc/wrflib/ext_ncd_put_var_ti.code | 144 + libsrc/wrflib/field_routines.F90 | 175 + libsrc/wrflib/io_int_stubs.f90 | 157 + libsrc/wrflib/model_data_order.inc | 8 + libsrc/wrflib/module_driver_constants.F90 | 180 + libsrc/wrflib/module_machine.F90 | 175 + libsrc/wrflib/pack_utils.c | 390 + libsrc/wrflib/streams.h | 16 + libsrc/wrflib/transpose.code | 40 + libsrc/wrflib/wrf_io.F90.orig | 3685 ++++++++++ libsrc/wrflib/wrf_io.f90 | 8169 +++++++++++++++++++++ libsrc/wrflib/wrf_io_flags.h | 15 + libsrc/wrflib/wrf_status_codes.h | 133 + 19 files changed, 14253 insertions(+) create mode 100644 libsrc/wrflib/CMakeLists.txt create mode 100644 libsrc/wrflib/ext_ncd_get_dom_ti.code create mode 100644 libsrc/wrflib/ext_ncd_get_var_td.code create mode 100644 libsrc/wrflib/ext_ncd_get_var_ti.code create mode 100644 libsrc/wrflib/ext_ncd_put_dom_ti.code create mode 100644 libsrc/wrflib/ext_ncd_put_var_td.code create mode 100644 libsrc/wrflib/ext_ncd_put_var_ti.code create mode 100644 libsrc/wrflib/field_routines.F90 create mode 100755 libsrc/wrflib/io_int_stubs.f90 create mode 100644 libsrc/wrflib/model_data_order.inc create mode 100644 libsrc/wrflib/module_driver_constants.F90 create mode 100644 libsrc/wrflib/module_machine.F90 create mode 100644 libsrc/wrflib/pack_utils.c create mode 100644 libsrc/wrflib/streams.h create mode 100644 libsrc/wrflib/transpose.code create mode 100644 libsrc/wrflib/wrf_io.F90.orig create mode 100644 libsrc/wrflib/wrf_io.f90 create mode 100644 libsrc/wrflib/wrf_io_flags.h create mode 100644 libsrc/wrflib/wrf_status_codes.h diff --git a/libsrc/wrflib/CMakeLists.txt b/libsrc/wrflib/CMakeLists.txt new file mode 100644 index 0000000000..a7bb3ceb43 --- /dev/null +++ b/libsrc/wrflib/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.6) +file(GLOB WRFLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90) +file(GLOB WRFLIB_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +set_source_files_properties( ${WRFLIB_SRC} PROPERTIES COMPILE_FLAGS ${WRFLIB_Fortran_FLAGS} ) +set(WRFLIB_C_FLAGS "${WRFLIB_C_INCLUDES} -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") +set_source_files_properties( ${WRFLIB_C_SRC} PROPERTIES COMPILE_FLAGS ${WRFLIB_C_FLAGS} ) +set( wrflib "WRFLIB" CACHE INTERNAL "WRF Library for I/O" ) +include_directories(${NETCDF_INCLUDES}) +add_library( ${wrflib} STATIC ${WRFLIB_SRC} ${WRFLIB_C_SRC} ) +set_target_properties( ${wrflib} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} ) + diff --git a/libsrc/wrflib/ext_ncd_get_dom_ti.code b/libsrc/wrflib/ext_ncd_get_dom_ti.code new file mode 100644 index 0000000000..fe365f153c --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_dom_ti.code @@ -0,0 +1,157 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + TYPE_BUFFER + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,Buffer) +#else + Data = '' + stat = NF_GET_ATT_TEXT(DH%NCID,NF_GLOBAL,Element,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + COPY + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif +ENDIF + return diff --git a/libsrc/wrflib/ext_ncd_get_var_td.code b/libsrc/wrflib/ext_ncd_get_var_td.code new file mode 100644 index 0000000000..bd28dc38a3 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_var_td.code @@ -0,0 +1,227 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + TYPE_BUFFER ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = LENGTH + VCount(2) = 1 +#ifndef CHAR_TYPE + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE (NCID,VarID,VStart,VCount,Buffer) +#else + if(Len1 > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_VARA_TEXT (NCID,VarID,VStart,VCount,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +#ifndef CHAR_TYPE + COPY + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return diff --git a/libsrc/wrflib/ext_ncd_get_var_ti.code b/libsrc/wrflib/ext_ncd_get_var_ti.code new file mode 100644 index 0000000000..47a161ba99 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_get_var_ti.code @@ -0,0 +1,174 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + TYPE_OUTCOUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + TYPE_BUFFER + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_TYPE == NF_DOUBLE .OR. NF_TYPE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_TYPE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + endif +#ifndef CHAR_TYPE + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) +#else + if(XLen > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), Data ) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + endif + COPY +#ifndef CHAR_TYPE + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/ext_ncd_put_dom_ti.code b/libsrc/wrflib/ext_ncd_put_dom_ti.code new file mode 100644 index 0000000000..2d5b1a3e9e --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_dom_ti.code @@ -0,0 +1,164 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (DH%NCID,NF_GLOBAL,Element,ARGS) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif +ENDIF + return diff --git a/libsrc/wrflib/ext_ncd_put_var_td.code b/libsrc/wrflib/ext_ncd_put_var_td.code new file mode 100644 index 0000000000..750e1ecd37 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_var_td.code @@ -0,0 +1,233 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(LENGTH < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == LENGTH) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),LENGTH,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = LENGTH + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = LENGTH + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_TYPE,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + enddo + if(LENGTH > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(LENGTH < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = LENGTH + VCount(2) = 1 +#ifdef LOG + allocate(Buffer(LENGTH), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_ROUTINE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#else + stat = NF_ROUTINE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/ext_ncd_put_var_ti.code b/libsrc/wrflib/ext_ncd_put_var_ti.code new file mode 100644 index 0000000000..05bfc64ca3 --- /dev/null +++ b/libsrc/wrflib/ext_ncd_put_var_ti.code @@ -0,0 +1,144 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + TYPE_DATA + TYPE_COUNT + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo +#ifdef LOG + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo +#endif +#ifdef CHAR_TYPE + if(len_trim(Data).le.0) then + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element),len_trim(null),null) + else + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), ARGS ) + endif +#else + stat = NF_ROUTINE(DH%NCID,DH%VarIDs(NVar),trim(Element), ARGS ) +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif +#ifdef LOG + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif +#endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',__FILE__,' ',ROUTINE_TYPE,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return diff --git a/libsrc/wrflib/field_routines.F90 b/libsrc/wrflib/field_routines.F90 new file mode 100644 index 0000000000..cd9bcfa7bf --- /dev/null +++ b/libsrc/wrflib/field_routines.F90 @@ -0,0 +1,175 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- +subroutine ext_ncd_RealFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + real, dimension(*) ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_REAL(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_REAL(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_RealFieldIO + +subroutine ext_ncd_DoubleFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + real*8 ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_DoubleFieldIO + +subroutine ext_ncd_IntFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer ,dimension(NVarDims),intent(in) :: VStart + integer ,dimension(NVarDims),intent(in) :: VCount + integer ,intent(inout) :: Data + integer ,intent(out) :: Status + integer :: stat + + if(IO == 'write') then + stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Data) + else + stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Data) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + endif + return +end subroutine ext_ncd_IntFieldIO + +subroutine ext_ncd_LogicalFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(NVarDims) ,intent(in) :: VStart + integer,dimension(NVarDims) ,intent(in) :: VCount + logical,dimension(VCount(1),VCount(2),VCount(3)),intent(inout) :: Data + integer ,intent(out) :: Status + integer,dimension(:,:,:),allocatable :: Buffer + integer :: stat + integer :: i,j,k + + allocate(Buffer(VCount(1),VCount(2),VCount(3)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + if(IO == 'write') then + do k=1,VCount(3) + do j=1,VCount(2) + do i=1,VCount(1) + if(data(i,j,k)) then + Buffer(i,j,k)=1 + else + Buffer(i,j,k)=0 + endif + enddo + enddo + enddo + stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Buffer) + else + stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Buffer) + Data = Buffer == 1 + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , msg) + return + endif + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_LogicalFieldIO diff --git a/libsrc/wrflib/io_int_stubs.f90 b/libsrc/wrflib/io_int_stubs.f90 new file mode 100755 index 0000000000..83c580a57d --- /dev/null +++ b/libsrc/wrflib/io_int_stubs.f90 @@ -0,0 +1,157 @@ +! Stubs version of wrf io spi subroutines +! +!--- get_dom_ti_real +SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) + INTEGER , INTENT(IN) :: DataHandle + CHARACTER*(*) :: Element + REAL , INTENT(INOUT) :: Data(*) + INTEGER , INTENT(IN) :: Count + INTEGER , INTENT(INOUT) :: Outcount + INTEGER , INTENT(INOUT) :: Status + + write(6,*) 'Calling dummy 1' +RETURN +END SUBROUTINE ext_int_get_dom_ti_real + + +SUBROUTINE ext_int_get_dom_ti_integer ( DataHandle,Element, Data, Count, Outcount, Status ) + + write(6,*) 'Calling dummy 2' +RETURN +END SUBROUTINE ext_int_get_dom_ti_integer + + +!--- get_dom_ti_char +SUBROUTINE ext_int_get_dom_ti_char ( DataHandle,Element, Data, Status ) + write(6,*) 'Calling dummy 3' + +RETURN +END SUBROUTINE ext_int_get_dom_ti_char + + +!--- get_var_info +SUBROUTINE ext_int_get_var_info ( DataHandle , VarName , NDim , MemoryOrder , Stagger , & + DomainStart , DomainEnd , WrfType, Status ) + + write(6,*) 'Calling dummy 4' +RETURN +END SUBROUTINE ext_int_get_var_info + + +!--- read_field +SUBROUTINE ext_int_read_field ( DataHandle , DateStr , VarName , Field , FieldType , Comm , IOComm, & + DomainDesc , MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + write(6,*) 'Calling dummy 5' + RETURN + +END SUBROUTINE ext_int_read_field + + +!--- close +SUBROUTINE ext_int_ioclose ( DataHandle, Status ) + + write(6,*) 'Calling dummy 6' + RETURN +END SUBROUTINE ext_int_ioclose + + +!--- initialize +SUBROUTINE ext_int_ioinit( SysDepInfo, Status ) + + write(6,*) 'Calling dummy 7' +END SUBROUTINE ext_int_ioinit + + + +!--- open_for_read +SUBROUTINE ext_int_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & + DataHandle , Status ) + + write(6,*) 'Calling dummy 8' + RETURN +END SUBROUTINE ext_int_open_for_read + + + +!SUBROUTINE int_get_ti_header_c ( hdrbuf, hdrbufsize, n, itypesize, typesize, & +! DataHandle, Data, Count, code ) + +! write(6,*) 'Calling dummy 9' +!RETURN +!END SUBROUTINE int_get_ti_header_c + + +! NETCDF STUBS +!SUBROUTINE ext_ncd_ioinit(SysDepInfo, Status) + +!RETURN +!END SUBROUTINE ext_ncd_ioinit + + +!subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + +!RETURN +!END subroutine ext_ncd_open_for_read + + +!subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) + +!RETURN +!END subroutine ext_ncd_get_dom_ti_integer + + +!subroutine ext_ncd_ioclose(DataHandle, Status) + +! return +!end subroutine ext_ncd_ioclose + + +!subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) + +! return +!end subroutine ext_ncd_get_dom_ti_char + + +!subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,Status) + +! return +!end subroutine ext_ncd_get_dom_ti_real + + +!subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder, & +! Stagger,DomainStart,DomainEnd,WrfType,Status) + +! return +!end subroutine ext_ncd_get_var_info + + +!subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & +! IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & +! DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + +! return +!end subroutine ext_ncd_read_field + + +!subroutine wrf_error_fatal(massage) + +!stop +!end subroutine wrf_error_fatal + + +!subroutine int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, typesize, & +! DataHandle, Data, Count, code ) +! write(6,*) 'Calling dummy 10' +!RETURN +!END SUBROUTINE int_gen_ti_header_c + + + + + + + diff --git a/libsrc/wrflib/model_data_order.inc b/libsrc/wrflib/model_data_order.inc new file mode 100644 index 0000000000..91a5098b8f --- /dev/null +++ b/libsrc/wrflib/model_data_order.inc @@ -0,0 +1,8 @@ +!STARTOFREGISTRYGENERATEDINCLUDE 'inc/model_data_order.inc' +! +! WARNING This file is generated automatically by use_registry +! using the data base in the file named Registry. +! Do not edit. Your changes to this file will be lost. +! +INTEGER , PARAMETER :: model_data_order = DATA_ORDER_XZY +!ENDOFREGISTRYGENERATEDINCLUDE diff --git a/libsrc/wrflib/module_driver_constants.F90 b/libsrc/wrflib/module_driver_constants.F90 new file mode 100644 index 0000000000..e5e7f71872 --- /dev/null +++ b/libsrc/wrflib/module_driver_constants.F90 @@ -0,0 +1,180 @@ +!WRF:DRIVER_LAYER:CONSTANTS +! +! This MODULE contains all of the constants used in the model. These +! are separated by usage within the code. + +#define MAX_DOMAINS_F 21 +# define IWORDSIZE 4 +# define DWORDSIZE 8 +# define RWORDSIZE 4 +# define LWORDSIZE 4 + +MODULE module_driver_constants + + ! 0. The following tells the rest of the model what data ordering we are + ! using + + INTEGER , PARAMETER :: DATA_ORDER_XYZ = 1 + INTEGER , PARAMETER :: DATA_ORDER_YXZ = 2 + INTEGER , PARAMETER :: DATA_ORDER_ZXY = 3 + INTEGER , PARAMETER :: DATA_ORDER_ZYX = 4 + INTEGER , PARAMETER :: DATA_ORDER_XZY = 5 + INTEGER , PARAMETER :: DATA_ORDER_YZX = 6 + INTEGER , PARAMETER :: DATA_ORDER_XY = DATA_ORDER_XYZ + INTEGER , PARAMETER :: DATA_ORDER_YX = DATA_ORDER_YXZ + + +#include "model_data_order.inc" + + ! 1. Following are constants for use in defining maximal values for array + ! definitions. + ! + + ! The maximum number of levels in the model is how deeply the domains may + ! be nested. + + INTEGER , PARAMETER :: max_levels = 20 + + ! The maximum number of nests that can depend on a single parent and other way round + + INTEGER , PARAMETER :: max_nests = 20 + + ! The maximum number of parents that a nest can have (simplified assumption -> one only) + + INTEGER , PARAMETER :: max_parents = 1 + + ! The maximum number of domains is how many grids the model will be running. + + INTEGER , PARAMETER :: max_domains = ( MAX_DOMAINS_F - 1 ) / 2 + 1 + + ! The maximum number of nest move specifications allowed in a namelist + + INTEGER , PARAMETER :: max_moves = 50 + + ! The maximum number of eta levels + !DJW 140701 Increased from 501 to 1001 since I can imagine using more than + !501 total vertical levels across multiple nested domains. Now that the + !code is modified to allow specification of all domains eta_levels using a + !array of length max_eta, this will need to be larger. I'll also add a check + !in module_initialize_real to ensure we don't exceed this value. + + INTEGER , PARAMETER :: max_eta = 1001 + + ! The maximum number of ocean levels in the 3d U Miami ocean. + + INTEGER , PARAMETER :: max_ocean = 501 + + ! The maximum number of pressure levels to interpolate to, for diagnostics + + INTEGER , PARAMETER :: max_plevs = 100 + + ! The maximum number of height levels to interpolate to, for diagnostics + + INTEGER , PARAMETER :: max_zlevs = 100 + + ! The maximum number of trackchem + + INTEGER , PARAMETER :: max_trackchem = 100 + + ! The maximum number of outer iterations (for DA minimisation) + + INTEGER , PARAMETER :: max_outer_iterations = 100 + + ! The maximum number of instruments (for radiance DA) + + INTEGER , PARAMETER :: max_instruments = 30 + + ! The maximum number of obs indexes (for conventional DA obs) + + INTEGER , PARAMETER :: num_ob_indexes = 28 + + + ! The maximum number of bogus storms + + INTEGER , PARAMETER :: max_bogus = 5 + + ! The maximum number of fields that can be sent or received in coupled mode + + INTEGER , PARAMETER :: max_cplfld = 20 + + ! The maximum number of domains used by the external model with which wrf is communicating in coupled mode + + INTEGER , PARAMETER :: max_extdomains = 5 + + ! 2. Following related to driver level data structures for DM_PARALLEL communications + +#ifdef DM_PARALLEL + INTEGER , PARAMETER :: max_comms = 1024 +#else + INTEGER , PARAMETER :: max_comms = 1 +#endif + + ! 3. Following is information related to the file I/O. + + ! These are the bounds of the available FORTRAN logical unit numbers for the file I/O. + ! Only logical unit numbers within these bounds will be chosen for I/O unit numbers. + + INTEGER , PARAMETER :: min_file_unit = 10 + INTEGER , PARAMETER :: max_file_unit = 99 + + ! 4. Unfortunately, the following definition is needed here (rather + ! than the more logical place in share/module_model_constants.F) + ! for the namelist reads in frame/module_configure.F, and for some + ! conversions in share/set_timekeeping.F + ! Actually, using it here will mean that we don't need to set it + ! in share/module_model_constants.F, since this file will be + ! included (USEd) in: + ! frame/module_configure.F + ! which will be USEd in: + ! share/module_bc.F + ! which will be USEd in: + ! phys/module_radiation_driver.F + ! which is the other important place for it to be, and where + ! it is passed as a subroutine parameter to any physics subroutine. + ! + ! P2SI is the number of SI seconds in an planetary solar day + ! divided by the number of SI seconds in an earth solar day +#if defined MARS + ! For Mars, P2SI = 88775.2/86400. + REAL , PARAMETER :: P2SI = 1.0274907 +#elif defined TITAN + ! For Titan, P2SI = 1378080.0/86400. + REAL , PARAMETER :: P2SI = 15.95 +#else + ! Default for Earth + REAL , PARAMETER :: P2SI = 1.0 +#endif + CONTAINS + SUBROUTINE init_module_driver_constants + END SUBROUTINE init_module_driver_constants + END MODULE module_driver_constants + +! routines that external packages can call to get at WRF stuff that isn't available +! through argument lists; since they are external we don't want them using WRF +! modules unnecessarily (complicates the build even more) + SUBROUTINE inquire_of_wrf_data_order_xyz( data_order ) + USE module_driver_constants, ONLY : DATA_ORDER_XYZ + IMPLICIT NONE + INTEGER, INTENT(OUT) :: data_order + data_order = DATA_ORDER_XYZ + END SUBROUTINE inquire_of_wrf_data_order_xyz + + SUBROUTINE inquire_of_wrf_data_order_xzy( data_order ) + USE module_driver_constants, ONLY : DATA_ORDER_XZY + IMPLICIT NONE + INTEGER, INTENT(OUT) :: data_order + data_order = DATA_ORDER_XZY + END SUBROUTINE inquire_of_wrf_data_order_xzy + + SUBROUTINE inquire_of_wrf_iwordsize( iwordsz ) + IMPLICIT NONE + INTEGER, INTENT(OUT) :: iwordsz + iwordsz = IWORDSIZE + END SUBROUTINE inquire_of_wrf_iwordsize + + SUBROUTINE inquire_of_wrf_rwordsize( rwordsz ) + IMPLICIT NONE + INTEGER, INTENT(OUT) :: rwordsz + rwordsz = RWORDSIZE + END SUBROUTINE inquire_of_wrf_rwordsize + diff --git a/libsrc/wrflib/module_machine.F90 b/libsrc/wrflib/module_machine.F90 new file mode 100644 index 0000000000..1888337f39 --- /dev/null +++ b/libsrc/wrflib/module_machine.F90 @@ -0,0 +1,175 @@ +!WRF:DRIVER_LAYER:DECOMPOSITION +! +# define IWORDSIZE 4 +# define DWORDSIZE 8 +# define RWORDSIZE 4 +# define LWORDSIZE 4 + +MODULE module_machine + + USE module_driver_constants + + ! Machine characteristics and utilities here. + + ! Tile strategy defined constants + INTEGER, PARAMETER :: TILE_NONE = 0, TILE_X = 1, TILE_Y = 2, TILE_XY = 3 + + CONTAINS + + RECURSIVE SUBROUTINE rlocproc(p,maxi,nproc,ml,mr,ret) + IMPLICIT NONE + INTEGER, INTENT(IN) :: p, maxi, nproc, ml, mr + INTEGER, INTENT(OUT) :: ret + INTEGER :: width, rem, ret2, bl, br, mid, adjust, & + p_r, maxi_r, nproc_r, zero + adjust = 0 + rem = mod( maxi, nproc ) + width = maxi / nproc + mid = maxi / 2 + IF ( rem>0 .AND. (((mod(rem,2).EQ.0).OR.(rem.GT.2)).OR.(p.LE.mid))) THEN + width = width + 1 + END IF + IF ( p.LE.mid .AND. mod(rem,2).NE.0 ) THEN + adjust = adjust + 1 + END IF + bl = max(width,ml) ; + br = max(width,mr) ; + IF (pmaxi-br-1) THEN + ret = nproc-1 + ELSE + p_r = p - bl + maxi_r = maxi-bl-br+adjust + nproc_r = max(nproc-2,1) + zero = 0 + CALL rlocproc( p_r, maxi_r, nproc_r, zero, zero, ret2 ) ! Recursive + ret = ret2 + 1 + END IF + RETURN + END SUBROUTINE rlocproc + + INTEGER FUNCTION locproc( i, m, numpart ) + implicit none + integer, intent(in) :: i, m, numpart + integer :: retval, ii, im, inumpart, zero + ii = i + im = m + inumpart = numpart + zero = 0 + CALL rlocproc( ii, im, inumpart, zero, zero, retval ) + locproc = retval + RETURN + END FUNCTION locproc + + SUBROUTINE patchmap( res, y, x, py, px ) + implicit none + INTEGER, INTENT(IN) :: y, x, py, px + INTEGER, DIMENSION(x,y), INTENT(OUT) :: res + INTEGER :: i, j, p_min, p_maj + DO j = 0,y-1 + p_maj = locproc( j, y, py ) + DO i = 0,x-1 + p_min = locproc( i, x, px ) + res(i+1,j+1) = p_min + px*p_maj + END DO + END DO + RETURN + END SUBROUTINE patchmap + + SUBROUTINE region_bounds( region_start, region_end, & + num_p, p, & + patch_start, patch_end ) + ! 1-D decomposition routine: Given starting and ending indices of a + ! vector, the number of patches dividing the vector, and the number of + ! the patch, give the start and ending indices of the patch within the + ! vector. This will work with tiles too. Implementation note. This is + ! implemented somewhat inefficiently, now, with a loop, so we can use the + ! locproc function above, which returns processor number for a given + ! index, whereas what we want is index for a given processor number. + ! With a little thought and a lot of debugging, we can come up with a + ! direct expression for what we want. For time being, we loop... + ! Remember that processor numbering starts with zero. + + IMPLICIT NONE + INTEGER, INTENT(IN) :: region_start, region_end, num_p, p + INTEGER, INTENT(OUT) :: patch_start, patch_end + INTEGER :: offset, i + patch_end = -999999999 + patch_start = 999999999 + offset = region_start + do i = 0, region_end - offset + if ( locproc( i, region_end-region_start+1, num_p ) == p ) then + patch_end = max(patch_end,i) + patch_start = min(patch_start,i) + endif + enddo + patch_start = patch_start + offset + patch_end = patch_end + offset + RETURN + END SUBROUTINE region_bounds + + SUBROUTINE least_aspect( nparts, minparts_y, minparts_x, nparts_y, nparts_x ) + IMPLICIT NONE + ! Input data. + INTEGER, INTENT(IN) :: nparts, & + minparts_y, minparts_x + ! Output data. + INTEGER, INTENT(OUT) :: nparts_y, nparts_x + ! Local data. + INTEGER :: x, y, mini + mini = 2*nparts + nparts_y = 1 + nparts_x = nparts + DO y = 1, nparts + IF ( mod( nparts, y ) .eq. 0 ) THEN + x = nparts / y + IF ( abs( y-x ) .LT. mini & + .AND. y .GE. minparts_y & + .AND. x .GE. minparts_x ) THEN + mini = abs( y-x ) + nparts_y = y + nparts_x = x + END IF + END IF + END DO + END SUBROUTINE least_aspect + + SUBROUTINE init_module_machine + RETURN + END SUBROUTINE init_module_machine + +END MODULE module_machine + +SUBROUTINE wrf_sizeof_integer( retval ) + IMPLICIT NONE + INTEGER retval +! IWORDSIZE is defined by CPP + retval = IWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_integer + +SUBROUTINE wrf_sizeof_real( retval ) + IMPLICIT NONE + INTEGER retval +! RWORDSIZE is defined by CPP + retval = RWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_real + +SUBROUTINE wrf_sizeof_doubleprecision( retval ) + IMPLICIT NONE + INTEGER retval +! DWORDSIZE is defined by CPP + retval = DWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_doubleprecision + +SUBROUTINE wrf_sizeof_logical( retval ) + IMPLICIT NONE + INTEGER retval +! LWORDSIZE is defined by CPP + retval = LWORDSIZE + RETURN +END SUBROUTINE wrf_sizeof_logical + diff --git a/libsrc/wrflib/pack_utils.c b/libsrc/wrflib/pack_utils.c new file mode 100644 index 0000000000..3caa8cc04f --- /dev/null +++ b/libsrc/wrflib/pack_utils.c @@ -0,0 +1,390 @@ +#ifndef MS_SUA +# include +# include +#endif +#include +#include "streams.h" + +#ifndef CRAY +# ifdef NOUNDERSCORE +# define INT_PACK_DATA int_pack_data +# define INT_GET_TI_HEADER_C int_get_ti_header_c +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field +# define PERTURB_REAL perturb_real +# define INSPECT_HEADER inspect_header +# define RESET_MASK reset_mask +# define SET_MASK set_mask +# define GET_MASK get_mask +# else +# ifdef F2CSTYLE +# define INT_PACK_DATA int_pack_data__ +# define INT_GET_TI_HEADER_C int_get_ti_header_c__ +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c__ +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c__ +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c__ +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c__ +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field__ +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field__ +# define PERTURB_REAL perturb_real__ +# define INSPECT_HEADER inspect_header__ +# define RESET_MASK reset_mask__ +# define SET_MASK set_mask__ +# define GET_MASK get_mask__ +# else +# define INT_PACK_DATA int_pack_data_ +# define INT_GET_TI_HEADER_C int_get_ti_header_c_ +# define INT_GEN_TI_HEADER_C int_gen_ti_header_c_ +# define ADD_TO_BUFSIZE_FOR_FIELD_C add_to_bufsize_for_field_c_ +# define STORE_PIECE_OF_FIELD_C store_piece_of_field_c_ +# define RETRIEVE_PIECES_OF_FIELD_C retrieve_pieces_of_field_c_ +# define INIT_STORE_PIECE_OF_FIELD init_store_piece_of_field_ +# define INIT_RETRIEVE_PIECES_OF_FIELD init_retrieve_pieces_of_field_ +# define PERTURB_REAL perturb_real_ +# define INSPECT_HEADER inspect_header_ +# define RESET_MASK reset_mask_ +# define SET_MASK set_mask_ +# define GET_MASK get_mask_ +# endif +# endif +#endif + +#ifdef MEMCPY_FOR_BCOPY +# define bcopy(A,B,C) memcpy((B),(A),(C)) +#endif + +/* CALL int_pack_data ( hdrbuf , hdrbufsiz * inttypesize , int_local_output_buffer, int_local_output_cursor ) */ + +void INT_PACK_DATA ( unsigned char *buf , int *ninbytes , unsigned char *obuf, int *cursor ) +{ + int i, lcurs ; + lcurs = *cursor - 1 ; + for ( i = 0 ; i < *ninbytes ; i++ ) + { + obuf[lcurs++] = buf[i] ; + } + *cursor = lcurs+1 ; +} + +int +INT_GEN_TI_HEADER_C ( char * hdrbuf, int * hdrbufsize, /* hdrbufsize is in bytes */ + int * itypesize, int * typesize, + int * DataHandle, char * Data, + int * Count, int * code ) +{ + int i ; + char * p ; + p = hdrbuf ; + p += sizeof(int) ; + bcopy( code, p, sizeof(int) ) ; p += sizeof(int) ; /* 2 */ + bcopy( DataHandle, p, sizeof(int) ) ; p += sizeof(int) ; /* 3 */ + bcopy( typesize, p, sizeof(int) ) ; p += sizeof(int) ; /* 4 */ + bcopy( Count, p, sizeof(int) ) ; p += sizeof(int) ; /* 5 */ + bcopy( Data, p, *Count * *typesize ) ; p += *Count * *typesize ; /* 6++ */ + *hdrbufsize = (int) (p - hdrbuf) ; + bcopy( hdrbufsize, hdrbuf, sizeof(int) ) ; + return(0) ; +} + +int +INT_GET_TI_HEADER_C ( char * hdrbuf, int * hdrbufsize, int * n, /* hdrbufsize and n are in bytes */ + int * itypesize, int * typesize, + int * DataHandle, char * Data, + int * Count, int * code ) +{ + int i ; + char * p ; + p = hdrbuf ; + bcopy( p, hdrbufsize, sizeof(int) ) ; p += sizeof(int) ; /* 1 */ + bcopy( p, code, sizeof(int) ) ; p += sizeof(int) ; /* 2 */ + bcopy( p, DataHandle, sizeof(int) ) ; p += sizeof(int) ; /* 3 */ + bcopy( p, typesize, sizeof(int) ) ; p += sizeof(int) ; /* 4 */ + bcopy( p, Count, sizeof(int) ) ; p += sizeof(int) ; /* 5 */ + if ( *Count * *typesize > 0 ) { + bcopy( p, Data, *Count * *typesize ) ; p += *Count * *typesize ; /* 6++ */ + } + *n = (int)( p - hdrbuf ) ; + return(0) ; +} + +#define MAX_FLDS 2000 +static char fld_name[MAX_FLDS][256] ; +static char *fld_cache[MAX_FLDS] ; +static int fld_curs[MAX_FLDS] ; +static int fld_bufsize[MAX_FLDS] ; +static int fld = 0 ; +static int numflds = 0 ; +static int frst = 1 ; + +int INIT_STORE_PIECE_OF_FIELD () +{ + int i ; + if ( frst ) { + for ( i = 0 ; i < MAX_FLDS ; i++ ) { + fld_cache[i] = NULL ; + } + frst = 0 ; + } + numflds = 0 ; + for ( i = 0 ; i < MAX_FLDS ; i++ ) { + strcpy( fld_name[i], "" ) ; + if ( fld_cache[i] != NULL ) free( fld_cache[i] ) ; + fld_cache[i] = NULL ; + fld_curs[i] = 0 ; + fld_bufsize[i] = 0 ; + } + return(0) ; +} + +int INIT_RETRIEVE_PIECES_OF_FIELD () +{ + fld = 0 ; + return(0) ; +} + +int +ADD_TO_BUFSIZE_FOR_FIELD_C ( int varname[], int * chunksize ) +{ + int i, n ; + int found ; + char vname[256] ; + + n = varname[0] ; + for ( i = 1; i <= n ; i++ ) { vname[i-1] = varname[i] ; } + vname[n] = '\0' ; + + found = -1 ; + for ( i = 0 ; i < numflds ; i++ ) { if ( !strcmp( fld_name[i], vname ) ) { found = i ; break ; } } + if ( found == -1 ) { + found = numflds++ ; + strcpy( fld_name[found], vname ) ; + fld_bufsize[found] = *chunksize ; + } + else + { + fld_bufsize[found] += *chunksize ; + } + if ( fld_cache[found] != NULL ) { free( fld_cache[found] ) ; } + fld_cache[found] = NULL ; + return(0) ; +} + +int +STORE_PIECE_OF_FIELD_C ( char * buf , int varname[], int * chunksize, int *retval ) +{ + int i, n ; + int found ; + char vname[256] ; + + n = varname[0] ; + for ( i = 1; i <= n ; i++ ) { vname[i-1] = varname[i] ; } + vname[n] = '\0' ; + + found = -1 ; + for ( i = 0 ; i < numflds ; i++ ) { if ( !strcmp( fld_name[i], vname ) ) { found = i ; break ; } } + if ( found == -1 ) { +#ifndef MS_SUA + fprintf(stderr,"frame/pack_utils.c: field (%s) not found; was not set up with add_to_bufsize_for_field\n",vname ) ; +#endif + *retval = 1 ; + return(0) ; + } + + if ( fld_cache[found] == NULL ) { + fld_cache[found] = (char *) malloc( fld_bufsize[found] ) ; + fld_curs[found] = 0 ; + } + + if ( fld_curs[found] + *chunksize > fld_bufsize[found] ) { +#ifndef MS_SUA + fprintf(stderr, +"frame/pack_utils.c: %s would overwrite %d + %d > %d [%d]\n",vname, fld_curs[found], *chunksize, fld_bufsize[found], found ) ; +#endif + *retval = 1 ; + return(0) ; + } + + bcopy( buf, fld_cache[found]+fld_curs[found], *chunksize ) ; + fld_curs[found] += *chunksize ; + *retval = 0 ; + return(0) ; +} + +int +RETRIEVE_PIECES_OF_FIELD_C ( char * buf , int varname[], int * insize, int * outsize, int *retval ) +{ + int i, n ; + int found ; + char vname[256] ; + + if ( fld < numflds ) { +#ifndef MS_SUA + if ( fld_curs[fld] > *insize ) { + fprintf(stderr,"retrieve: fld_curs[%d] (%d) > *insize (%d)\n",fld,fld_curs[fld], *insize ) ; + } +#endif + *outsize = ( fld_curs[fld] <= *insize ) ? fld_curs[fld] : *insize ; + bcopy( fld_cache[fld], buf, *outsize ) ; + varname[0] = (int) strlen( fld_name[fld] ) ; + for ( i = 1 ; i <= varname[0] ; i++ ) varname[i] = fld_name[fld][i-1] ; + if ( fld_cache[fld] != NULL ) free ( fld_cache[fld] ) ; + fld_cache[fld] = NULL ; + fld_bufsize[fld] = 0 ; + fld++ ; + *retval = 0 ; + } + else { + numflds = 0 ; + *retval = -1 ; + } + return(0) ; +} + +#define INDEX_2(A,B,NB) ( (B) + (A)*(NB) ) +#define INDEX_3(A,B,C) INDEX_2( (A), INDEX_2( (B), (C), (me[1]-ms[1]+1) ), (me[1]-ms[1]+1)*(me[0]-ms[0]+1) ) +/* flip low order bit of fp number */ +int +PERTURB_REAL ( float * field, int ds[], int de[], int ms[], int me[], int ps[], int pe[] ) +{ + int i,j,k ; + int le ; /* index of little end */ + float x = 2.0 ; + unsigned int y ; + unsigned char a[4], *p ; + if ( sizeof(float) != 4 ) return(-1) ; + /* check endianness of machine */ + bcopy ( &x, a, 4 ) ; + le = 0 ; + if ( a[0] == 0x40 ) le = 3 ; + for ( k = ps[2]-ms[2] ; k <= pe[2]-ms[2] ; k++ ) + for ( j = ps[1]-ms[1] ; j <= pe[1]-ms[1] ; j++ ) + for ( i = ps[0]-ms[0] ; i <= pe[0]-ms[0] ; i++ ) + { + /* do not change zeros */ + if ( field[ INDEX_3(k,j,i) ] != 0.0 ) { + p = (unsigned char *)&(field[ INDEX_3(k,j,i) ] ) ; + if ( *(p+le) & 1 ) { *(p+le) &= 0x7e ; } + else { *(p+le) |= 1 ; } + } + } + return(0) ; +} + +int INSPECT_HEADER ( char * buf, int * sz, int * line ) +{ + int i ; +#ifndef MS_SUA + fprintf(stderr,"INSPECT_HEADER: line = %d ", *line ) ; + if ( buf != NULL && sz != NULL ) { + for ( i = 0 ; i < *sz && i < 256 ; i++ ) { if ( (buf[i] >= 'a' && buf[i] <= 'z') || buf[i] == '_' || + (buf[i] >= 'A' && buf[i] <= 'Z') || + (buf[i] >= '0' && buf[i] <= '9') ) fprintf(stderr,"%c",buf[i]) ; + } + fprintf(stderr,"\n") ; + } +#endif + return(0) ; +} + +/* note that these work the same as the routines in tools/misc.c, but are Fortran callable. + They must be kept in sync, functionally. */ + +void +RESET_MASK ( unsigned int * mask , int *e ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; + n = 1 ; + m = ~( n << *e % (8*sizeof(int)-1) ) ; + if ( w >= 0 && w < IO_MASK_SIZE ) { + mask[w] &= m ; + } +} + +void +SET_MASK ( unsigned int * mask , int *e ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; + n = 1 ; + m = ( n << *e % (8*sizeof(int)-1) ) ; + if ( w >= 0 && w < IO_MASK_SIZE ) { + mask[w] |= m ; + } +} + +/* this is slightly different from in tools dir since it returns result as argument, not function */ +/* definition of IO_MASK_SIZE comes from build and must be uniform with frame/module_domain_type.F and + version of this function in tools dir */ +void +GET_MASK ( unsigned int * mask , int *e , int * retval ) +{ + int w ; + unsigned int m, n ; + + w = *e / (8*sizeof(int)-1) ; /* 8 is number of bits per byte */ + if ( w >= 0 && w < IO_MASK_SIZE ) { + m = mask[w] ; + n = ( 1 << *e % (8*sizeof(int)-1) ) ;; + *retval = ( (m & n) != 0 ) ; + } else { + *retval = 0 ; + } +} + +#ifdef WRAP_MALLOC +# ifndef WRAP_MALLOC_ALIGNMENT +# define WRAP_MALLOC_ALIGNMENT 128 +# endif +# define _XOPEN_SOURCE 600 +# include +void *malloc(size_t size) +{ + void *tmp; + if (posix_memalign(&tmp, WRAP_MALLOC_ALIGNMENT, size) == 0) + return tmp; + else { + errno = ENOMEM; + return NULL; + } +} +#endif + +#ifndef DM_PARALLEL +# ifndef CRAY +# ifdef NOUNDERSCORE +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock +# else +# ifdef F2CSTYLE +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock__ +# else +# define RSL_INTERNAL_MICROCLOCK rsl_internal_microclock_ +# endif +# endif +# endif +# if !defined(MS_SUA) && !defined(_WIN32) +# include +int RSL_INTERNAL_MICROCLOCK () +{ + struct timeval tb ; + struct timezone tzp ; + int isec ; /* seconds */ + int usec ; /* microseconds */ + int msecs ; + gettimeofday( &tb, &tzp ) ; + isec = tb.tv_sec ; + usec = tb.tv_usec ; + msecs = 1000000 * isec + usec ; + return(msecs) ; +} +# endif +#endif + diff --git a/libsrc/wrflib/streams.h b/libsrc/wrflib/streams.h new file mode 100644 index 0000000000..645b02d855 --- /dev/null +++ b/libsrc/wrflib/streams.h @@ -0,0 +1,16 @@ +#ifndef MAX_HISTORY +# define MAX_HISTORY 12 +#endif +#ifndef IWORDSIZE +# define IWORDSIZE 4 +#endif +#define HISTORY_STREAM 0 +#define INPUT_STREAM ((HISTORY_STREAM)+(MAX_HISTORY)) +#if 0 + max streams is MAX_HISTORY plus equal number of input streams plus 1 restart + 1 boundary +#endif +#define MAX_STREAMS (2*(MAX_HISTORY)+2) +#define BOUNDARY_STREAM (2*(MAX_HISTORY)+1) +#define RESTART_STREAM (2*(MAX_HISTORY)+2) +#define IO_MASK_SIZE ((MAX_STREAMS)/(IWORDSIZE*8)+1) + diff --git a/libsrc/wrflib/transpose.code b/libsrc/wrflib/transpose.code new file mode 100644 index 0000000000..746be42fcb --- /dev/null +++ b/libsrc/wrflib/transpose.code @@ -0,0 +1,40 @@ + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 + +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + DFIELD = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = DFIELD + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + + return diff --git a/libsrc/wrflib/wrf_io.F90.orig b/libsrc/wrflib/wrf_io.F90.orig new file mode 100644 index 0000000000..4288b98e68 --- /dev/null +++ b/libsrc/wrflib/wrf_io.F90.orig @@ -0,0 +1,3685 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + +module wrf_data + + integer , parameter :: FATAL = 1 + integer , parameter :: WARN = 1 + integer , parameter :: WrfDataHandleMax = 99 + integer , parameter :: MaxDims = 2000 ! = NF_MAX_VARS +#if(WRF_CHEM == 1) + integer , parameter :: MaxVars = 10000 +#else + integer , parameter :: MaxVars = 3000 +#endif + integer , parameter :: MaxTimes = 10000 + integer , parameter :: DateStrLen = 19 + integer , parameter :: VarNameLen = 31 + integer , parameter :: NO_DIM = 0 + integer , parameter :: NVarDims = 4 + integer , parameter :: NMDVarDims = 2 + character (8) , parameter :: NO_NAME = 'NULL' + character (DateStrLen) , parameter :: ZeroDate = '0000-00-00-00:00:00' + +#include "wrf_io_flags.h" + + character (256) :: msg + logical :: WrfIOnotInitialized = .true. + + type :: wrf_data_handle + character (255) :: FileName + integer :: FileStatus + integer :: Comm + integer :: NCID + logical :: Free + logical :: Write + character (5) :: TimesName + integer :: TimeIndex + integer :: CurrentTime !Only used for read + integer :: NumberTimes !Only used for read + character (DateStrLen), pointer :: Times(:) + integer :: TimesVarID + integer , pointer :: DimLengths(:) + integer , pointer :: DimIDs(:) + character (31) , pointer :: DimNames(:) + integer :: DimUnlimID + character (9) :: DimUnlimName + integer , dimension(NVarDims) :: DimID + integer , dimension(NVarDims) :: Dimension + integer , pointer :: MDVarIDs(:) + integer , pointer :: MDVarDimLens(:) + character (80) , pointer :: MDVarNames(:) + integer , pointer :: VarIDs(:) + integer , pointer :: VarDimLens(:,:) + character (VarNameLen), pointer :: VarNames(:) + integer :: CurrentVariable !Only used for read + integer :: NumVars +! first_operation is set to .TRUE. when a new handle is allocated +! or when open-for-write or open-for-read are committed. It is set +! to .FALSE. when the first field is read or written. + logical :: first_operation + logical :: R4OnOutput + logical :: nofill + logical :: use_netcdf_classic + end type wrf_data_handle + type(wrf_data_handle),target :: WrfDataHandles(WrfDataHandleMax) +end module wrf_data + +module ext_ncd_support_routines + + implicit none + +CONTAINS + +subroutine allocHandle(DataHandle,DH,Comm,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(out) :: DataHandle + type(wrf_data_handle),pointer :: DH + integer ,intent(IN) :: Comm + integer ,intent(out) :: Status + integer :: i + integer :: stat + + do i=1,WrfDataHandleMax + if(WrfDataHandles(i)%Free) then + DH => WrfDataHandles(i) + DataHandle = i + allocate(DH%Times(MaxTimes), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimLengths(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimIDs(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimNames(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarDimLens(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarDimLens(NVarDims-1,MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + exit + endif + if(i==WrfDataHandleMax) then + Status = WRF_WARN_TOO_MANY_FILES + write(msg,*) 'Warning TOO MANY FILES in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) 'Did you call ext_ncd_ioinit?' + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + DH%Free =.false. + DH%Comm = Comm + DH%Write =.false. + DH%first_operation = .TRUE. + DH%R4OnOutput = .false. + DH%nofill = .false. + Status = WRF_NO_ERR +end subroutine allocHandle + +subroutine deallocHandle(DataHandle, Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + + IF ( DataHandle .GE. 1 .AND. DataHandle .LE. WrfDataHandleMax ) THEN + if(.NOT. WrfDataHandles(DataHandle)%Free) then + DH => WrfDataHandles(DataHandle) + deallocate(DH%Times, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimLengths, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + DH%Free =.TRUE. + endif + ENDIF + Status = WRF_NO_ERR +end subroutine deallocHandle + +subroutine GetDH(DataHandle,DH,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + type(wrf_data_handle) ,pointer :: DH + integer ,intent(out) :: Status + + if(DataHandle < 1 .or. DataHandle > WrfDataHandleMax) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + DH => WrfDataHandles(DataHandle) + if(DH%Free) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + Status = WRF_NO_ERR + return +end subroutine GetDH + +subroutine DateCheck(Date,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Date + integer ,intent(out) :: Status + + if(len(Date) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + else + Status = WRF_NO_ERR + endif + return +end subroutine DateCheck + +subroutine GetName(Element,Var,Name,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Name + integer ,intent(out) :: Status + character (VarNameLen) :: VarName + character (1) :: c + integer :: i + integer, parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + + VarName = Var + Name = 'MD___'//trim(Element)//VarName + do i=1,len(Name) + c=Name(i:i) + if('A'<=c .and. c <='Z') Name(i:i)=achar(iachar(c)+upper_to_lower) + if(c=='-'.or.c==':') Name(i:i)='_' + enddo + Status = WRF_NO_ERR + return +end subroutine GetName + +subroutine GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: TimeIndex + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VStart(2) + integer :: VCount(2) + integer :: stat + integer :: i + + DH => WrfDataHandles(DataHandle) + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + Status = WRF_WARN_DATESTR_ERROR + write(msg,*) 'Warning DATE STRING ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(IO == 'write') then + TimeIndex = DH%TimeIndex + if(TimeIndex <= 0) then + TimeIndex = 1 + elseif(DateStr == DH%Times(TimeIndex)) then + Status = WRF_NO_ERR + return + else + TimeIndex = TimeIndex +1 + if(TimeIndex > MaxTimes) then + Status = WRF_WARN_TIME_EOF + write(msg,*) 'Warning TIME EOF in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + DH%TimeIndex = TimeIndex + DH%Times(TimeIndex) = DateStr + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = DateStrLen + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT(DH%NCID,DH%TimesVarID,VStart,VCount,DateStr) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + Status = WRF_NO_ERR + TimeIndex = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + write(msg,*) 'Warning TIME ',DateStr,' NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + return +end subroutine GetTimeIndex + +subroutine GetDim(MemoryOrder,NDim,Status) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(out) :: NDim + integer ,intent(out) :: Status + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + NDim = 3 + case ('xy','yx','xs','xe','ys','ye','cc') + NDim = 2 + case ('z','c') + NDim = 1 + case ('0') ! NDim=0 for scalars. TBH: 20060502 + NDim = 0 + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine GetDim + +#ifdef USE_NETCDF4_FEATURES +subroutine set_chunking(MemoryOrder,need_chunking) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + logical ,intent(out) :: need_chunking + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + if(len(MemOrd) >= 2) then + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + need_chunking = .true. + case ('xy','yx') + need_chunking = .true. + case default + need_chunking = .false. + return + end select + endif +end subroutine set_chunking +#endif + +subroutine GetIndices(NDim,Start,End,i1,i2,j1,j2,k1,k2) + integer ,intent(in) :: NDim + integer ,dimension(*),intent(in) :: Start,End + integer ,intent(out) :: i1,i2,j1,j2,k1,k2 + + i1=1 + i2=1 + j1=1 + j2=1 + k1=1 + k2=1 + if(NDim == 0) return ! NDim=0 for scalars. TBH: 20060502 + i1 = Start(1) + i2 = End (1) + if(NDim == 1) return + j1 = Start(2) + j2 = End (2) + if(NDim == 2) return + k1 = Start(3) + k2 = End (3) + return +end subroutine GetIndices + +logical function ZeroLengthHorzDim(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(in) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + logical zero_length + + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + zero_length = .false. + select case (MemOrd) + case ('xsz','xez','ysz','yez','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy','yzx') + zero_length = temp(1) .lt. 1 .or. temp(3) .lt. 1 + case ('xy','yx','xyz','yxz') + zero_length = temp(1) .lt. 1 .or. temp(2) .lt. 1 + case ('zxy','zyx') + zero_length = temp(2) .lt. 1 .or. temp(3) .lt. 1 + case default + Status = WRF_WARN_BAD_MEMORYORDER + ZeroLengthHorzDim = .true. + return + end select + Status = WRF_NO_ERR + ZeroLengthHorzDim = zero_length + return +end function ZeroLengthHorzDim + +subroutine ExtOrder(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(inout) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + Vector(2) = temp(3) + Vector(3) = temp(2) + case ('yxz') + Vector(1) = temp(2) + Vector(2) = temp(1) + case ('yzx') + Vector(1) = temp(3) + Vector(2) = temp(1) + Vector(3) = temp(2) + case ('zxy') + Vector(1) = temp(2) + Vector(2) = temp(3) + Vector(3) = temp(1) + case ('zyx') + Vector(1) = temp(3) + Vector(3) = temp(1) + case ('yx') + Vector(1) = temp(2) + Vector(2) = temp(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrder + +subroutine ExtOrderStr(MemoryOrder,Vector,ROVector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + character*(*),dimension(*) ,intent(in) :: Vector + character(80),dimension(NVarDims),intent(out) :: ROVector + integer ,intent(out) :: Status + integer :: NDim + character*3 :: MemOrd + + call GetDim(MemoryOrder,NDim,Status) + ROVector(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + ROVector(2) = Vector(3) + ROVector(3) = Vector(2) + case ('yxz') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case ('yzx') + ROVector(1) = Vector(3) + ROVector(2) = Vector(1) + ROVector(3) = Vector(2) + case ('zxy') + ROVector(1) = Vector(2) + ROVector(2) = Vector(3) + ROVector(3) = Vector(1) + case ('zyx') + ROVector(1) = Vector(3) + ROVector(3) = Vector(1) + case ('yx') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrderStr + + +subroutine LowerCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + integer :: i,N + + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower) + enddo + return +end subroutine LowerCase + +subroutine UpperCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: lower_to_upper =IACHAR('A')-IACHAR('a') + integer :: i,N + + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c)+lower_to_upper) + enddo + return +end subroutine UpperCase + +subroutine netcdf_err(err,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: err + integer ,intent(out) :: Status + character(len=80) :: errmsg + integer :: stat + + if( err==NF_NOERR )then + Status = WRF_NO_ERR + else + errmsg = NF_STRERROR(err) + write(msg,*) 'NetCDF error: ',errmsg + call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_WARN_NETCDF + endif + return +end subroutine netcdf_err + +subroutine FieldIO(IO,DataHandle,DateStr,Length,MemoryOrder & + ,FieldType,NCID,VarID,XField,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer,dimension(NVarDims),intent(in) :: Length + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: FieldType + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(*) ,intent(inout) :: XField + integer ,intent(out) :: Status + integer :: TimeIndex + integer :: NDim + integer,dimension(NVarDims) :: VStart + integer,dimension(NVarDims) :: VCount +! include 'wrf_io_flags.h' + + call GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' Bad time index for DateStr = ',DateStr + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + VStart(:) = 1 + VCount(:) = 1 + VStart(1:NDim) = 1 + VCount(1:NDim) = Length(1:NDim) + VStart(NDim+1) = TimeIndex + VCount(NDim+1) = 1 + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + call ext_ncd_RealFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_DOUBLE) THEN + call ext_ncd_DoubleFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_INTEGER) THEN + call ext_ncd_IntFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_LOGICAL) THEN + call ext_ncd_LogicalFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + if(Status /= WRF_NO_ERR) return + ELSE + write(6,*) 'WARNING---- some missing calls commented out' + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + + return +end subroutine FieldIO + +subroutine Transpose(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + integer ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) +!jm 010827 integer ,intent(inout) :: XField(di,x1:x2,y1:y2,z1:z2) + integer ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + +#define XDEX(A,B,C) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + + case ('xzy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,k,j)) +#include "transpose.code" + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,j,k)) +#include "transpose.code" + case ('yxz') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + case ('zxy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,i,j)) +#include "transpose.code" + case ('yzx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,k,i)) +#include "transpose.code" + case ('zyx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,j,i)) +#include "transpose.code" + case ('yx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + end select + return +end subroutine Transpose + +subroutine reorder (MemoryOrder,MemO) + character*(*) ,intent(in) :: MemoryOrder + character*3 ,intent(out) :: MemO + character*3 :: MemOrd + integer :: N,i,i1,i2,i3 + + MemO = MemoryOrder + N = len_trim(MemoryOrder) + if(N == 1) return + call lowercase(MemoryOrder,MemOrd) +! never invert the boundary codes + select case ( MemOrd ) + case ( 'xsz','xez','ysz','yez' ) + return + case default + continue + end select + i1 = 1 + i3 = 1 + do i=2,N + if(ichar(MemOrd(i:i)) < ichar(MemOrd(i1:i1))) I1 = i + if(ichar(MemOrd(i:i)) > ichar(MemOrd(i3:i3))) I3 = i + enddo + if(N == 2) then + i2=i3 + else + i2 = 6-i1-i3 + endif + MemO(1:1) = MemoryOrder(i1:i1) + MemO(2:2) = MemoryOrder(i2:i2) + if(N == 3) MemO(3:3) = MemoryOrder(i3:i3) + if(MemOrd(i1:i1) == 's' .or. MemOrd(i1:i1) == 'e') then + MemO(1:N-1) = MemO(2:N) + MemO(N:N ) = MemoryOrder(i1:i1) + endif + return +end subroutine reorder + +! Returns .TRUE. iff it is OK to write time-independent domain metadata to the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_put_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, first_output, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + first_output = ncd_is_first_operation( DataHandle ) + retval = .NOT. dryrun .AND. first_output + ENDIF + ncd_ok_to_put_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_put_dom_ti + +! Returns .TRUE. iff it is OK to read time-independent domain metadata from the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_get_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + retval = .NOT. dryrun + ENDIF + ncd_ok_to_get_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_get_dom_ti + +! Returns .TRUE. iff nothing has been read from or written to the file +! referenced by DataHandle. If DataHandle is invalid, .FALSE. is returned. +LOGICAL FUNCTION ncd_is_first_operation( DataHandle ) + USE wrf_data + INCLUDE 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + TYPE(wrf_data_handle) ,POINTER :: DH + INTEGER :: Status + LOGICAL :: retval + CALL GetDH( DataHandle, DH, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__, & + ', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + retval = DH%first_operation + ENDIF + ncd_is_first_operation = retval + RETURN +END FUNCTION ncd_is_first_operation + +subroutine upgrade_filename(FileName) + implicit none + + character*(*), intent(inout) :: FileName + integer :: i + + do i = 1, len(trim(FileName)) + if(FileName(i:i) == '-') then + FileName(i:i) = '_' + else if(FileName(i:i) == ':') then + FileName(i:i) = '_' + endif + enddo + +end subroutine upgrade_filename + +end module ext_ncd_support_routines + +subroutine TransposeToR4(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + + use ext_ncd_support_routines + + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + real*8 ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) + real*4 ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + +!#define XDEX(A,B,C) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + + case ('xzy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,k,j)) +#include "transpose.code" + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(i,j,k)) +#include "transpose.code" + case ('yxz') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + case ('zxy') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,i,j)) +#include "transpose.code" + case ('yzx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,k,i)) +#include "transpose.code" + case ('zyx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(k,j,i)) +#include "transpose.code" + case ('yx') +#undef DFIELD +#define DFIELD XField(1:di,XDEX(j,i,k)) +#include "transpose.code" + end select + return +end subroutine TransposeToR4 + +subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), INTENT(IN) :: DatasetName + integer , INTENT(IN) :: Comm1, Comm2 + character *(*), INTENT(IN) :: SysDepInfo + integer , INTENT(OUT) :: DataHandle + integer , INTENT(OUT) :: Status + DataHandle = 0 ! dummy setting to quiet warning message + CALL ext_ncd_open_for_read_begin( DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status ) + IF ( Status .EQ. WRF_NO_ERR ) THEN + CALL ext_ncd_open_for_read_commit( DataHandle, Status ) + ENDIF + return +end subroutine ext_ncd_open_for_read + +!ends training phase; switches internal flag to enable input +!must be paired with call to ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_read_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer, intent(in) :: DataHandle + integer, intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_READ + DH%first_operation = .TRUE. + Status = WRF_NO_ERR + return +end subroutine ext_ncd_open_for_read_commit + +subroutine ext_ncd_open_for_read_begin( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + +#ifdef USE_NETCDF4_FEATURES + integer :: open_mode +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + stat = NF_OPEN(FileName, NF_NOWRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_read_begin + +subroutine ext_ncd_open_for_update( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + +#ifdef USE_NETCDF4_FEATURES + integer :: open_mode +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_WRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_FOR_UPDATE + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_update + + +SUBROUTINE ext_ncd_open_for_write_begin(FileName,Comm,IOComm,SysDepInfo,DataHandle,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(inout) :: FileName + integer ,intent(in) :: Comm + integer ,intent(in) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + character (7) :: Buffer + integer :: VDimIDs(2) + +#ifdef USE_NETCDF4_FEATURES + integer :: create_mode + integer, parameter :: cache_size = 32, & + cache_nelem = 37, & + cache_preemption = 100 +#endif + + !call upgrade_filename(FileName) + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_begin: ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + DH%TimeIndex = 0 + DH%Times = ZeroDate +#ifdef USE_NETCDF4_FEATURES +! create_mode = IOR(nf_netcdf4, nf_classic_model) + if ( DH%use_netcdf_classic ) then + write(msg,*) 'output will be in classic NetCDF format' + call wrf_debug ( WARN , TRIM(msg)) +#ifdef WRFIO_NCD_NO_LARGE_FILE_SUPPORT + stat = NF_CREATE(FileName, NF_CLOBBER, DH%NCID) +#else + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) +#endif + else + create_mode = nf_netcdf4 + stat = NF_CREATE(FileName, create_mode, DH%NCID) + stat = NF_SET_CHUNK_CACHE(cache_size, cache_nelem, cache_preemption) + endif +#else +#ifdef WRFIO_NCD_NO_LARGE_FILE_SUPPORT + stat = NF_CREATE(FileName, NF_CLOBBER, DH%NCID) +#else + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) +#endif +#endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + stat = NF_DEF_DIM(DH%NCID,DH%DimUnlimName,NF_UNLIMITED,DH%DimUnlimID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarNames (1:MaxVars) = NO_NAME + DH%MDVarNames(1:MaxVars) = NO_NAME + do i=1,MaxDims + write(Buffer,FMT="('DIM',i4.4)") i + DH%DimNames (i) = Buffer + DH%DimLengths(i) = NO_DIM + enddo + DH%DimNames(1) = 'DateStrLen' + stat = NF_DEF_DIM(DH%NCID,DH%DimNames(1),DateStrLen,DH%DimIDs(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VDimIDs(1) = DH%DimIDs(1) + VDimIDs(2) = DH%DimUnlimID + stat = NF_DEF_VAR(DH%NCID,DH%TimesName,NF_CHAR,2,VDimIDs,DH%TimesVarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(1) = DateStrLen + + if (index(SysDepInfo,'REAL_OUTPUT_SIZE=4') /= 0) then + DH%R4OnOutput = .true. + end if +!toggle on nofill mode + if (index(SysDepInfo,'NOFILL=.TRUE.') /= 0) then + DH%nofill = .true. + end if + + return +end subroutine ext_ncd_open_for_write_begin + +!stub +!opens a file for writing or coupler datastream for sending messages. +!no training phase for this version of the open stmt. +subroutine ext_ncd_open_for_write (DatasetName, Comm1, Comm2, & + SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), intent(in) ::DatasetName + integer , intent(in) ::Comm1, Comm2 + character *(*), intent(in) ::SysDepInfo + integer , intent(out) :: DataHandle + integer , intent(out) :: Status + Status=WRF_WARN_NOOP + DataHandle = 0 ! dummy setting to quiet warning message + return +end subroutine ext_ncd_open_for_write + +SUBROUTINE ext_ncd_open_for_write_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + integer :: oldmode ! for nf_set_fill, not used + + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_commit: ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_open_for_write_commit ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if ( DH%nofill ) then + Status = NF_SET_FILL(DH%NCID,NF_NOFILL, oldmode ) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' from NF_SET_FILL ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + write(msg,*) 'Information: NOFILL being set for writing to ',TRIM(DH%FileName) + call wrf_debug ( WARN , TRIM(msg)) + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_commit ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + DH%first_operation = .TRUE. + return +end subroutine ext_ncd_open_for_write_commit + +subroutine ext_ncd_ioclose(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_CLOSE + write(msg,*) 'Warning TRY TO CLOSE DRYRUN in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + + stat = NF_CLOSE(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_ioclose ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + CALL deallocHandle( DataHandle, Status ) + DH%Free=.true. + return +end subroutine ext_ncd_ioclose + +subroutine ext_ncd_iosync( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_SYNC(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_iosync ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + return +end subroutine ext_ncd_iosync + + + +subroutine ext_ncd_redef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + return +end subroutine ext_ncd_redef + +subroutine ext_ncd_enddef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + return +end subroutine ext_ncd_enddef + +subroutine ext_ncd_ioinit(SysDepInfo, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + CHARACTER*(*), INTENT(IN) :: SysDepInfo + INTEGER ,INTENT(INOUT) :: Status + + WrfIOnotInitialized = .false. + WrfDataHandles(1:WrfDataHandleMax)%Free = .true. + WrfDataHandles(1:WrfDataHandleMax)%TimesName = 'Times' + WrfDataHandles(1:WrfDataHandleMax)%DimUnlimName = 'Time' + WrfDataHandles(1:WrfDataHandleMax)%FileStatus = WRF_FILE_NOT_OPENED + if(trim(SysDepInfo) == "use_netcdf_classic" ) then + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .true. + else + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .false. + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_ioinit + + +subroutine ext_ncd_inquiry (Inquiry, Result, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + character *(*), INTENT(IN) :: Inquiry + character *(*), INTENT(OUT) :: Result + integer ,INTENT(INOUT) :: Status + SELECT CASE (Inquiry) + CASE ("RANDOM_WRITE","RANDOM_READ","SEQUENTIAL_WRITE","SEQUENTIAL_READ") + Result='ALLOW' + CASE ("OPEN_READ","OPEN_COMMIT_WRITE") + Result='REQUIRE' + CASE ("OPEN_WRITE","OPEN_COMMIT_READ","PARALLEL_IO") + Result='NO' + CASE ("SELF_DESCRIBING","SUPPORT_METADATA","SUPPORT_3D_FIELDS") + Result='YES' + CASE ("MEDIUM") + Result ='FILE' + CASE DEFAULT + Result = 'No Result for that inquiry!' + END SELECT + Status=WRF_NO_ERR + return +end subroutine ext_ncd_inquiry + + + + +subroutine ext_ncd_ioexit(Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer , INTENT(INOUT) ::Status + integer :: error + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + do i=1,WrfDataHandleMax + CALL deallocHandle( i , stat ) + enddo + return +end subroutine ext_ncd_ioexit + +subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,OutCount,Status) +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real,intent(out) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCOunt +#define TYPE_BUFFER real,allocatable :: Buffer(:) +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_ATT_REAL +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_real + +subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_integer + +subroutine ext_ncd_get_dom_ti_double(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8,intent(out) :: Data(*) +#define TYPE_BUFFER real*8,allocatable :: Buffer(:) +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_ATT_DOUBLE +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_double + +subroutine ext_ncd_get_dom_ti_logical(DataHandle,Element,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(Len,Count)) = Buffer(1:min(Len,Count))==1 +#include "ext_ncd_get_dom_ti.code" +end subroutine ext_ncd_get_dom_ti_logical + +subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef TYPE_BUFFER +#undef NF_TYPE +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*),intent(out) :: Data +#define TYPE_COUNT +#define TYPE_OUTCOUNT +#define TYPE_BUFFER +#define NF_TYPE NF_CHAR +#define CHAR_TYPE +#include "ext_ncd_get_dom_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_dom_ti_char + +subroutine ext_ncd_put_dom_ti_real(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_REAL +#define ARGS NF_FLOAT,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_real + +subroutine ext_ncd_put_dom_ti_integer(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_integer + +subroutine ext_ncd_put_dom_ti_double(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_DOUBLE +#define ARGS NF_DOUBLE,Count,Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_double + +subroutine ext_ncd_put_dom_ti_logical(DataHandle,Element,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(in) :: Data(*) +#define TYPE_COUNT integer,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Buffer +#define LOG +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_logical + +subroutine ext_ncd_put_dom_ti_char(DataHandle,Element,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*),intent(in) :: Data +#define TYPE_COUNT integer,parameter :: Count=1 +#define NF_ROUTINE NF_PUT_ATT_TEXT +#define ARGS len_trim(Data),Data +#include "ext_ncd_put_dom_ti.code" +end subroutine ext_ncd_put_dom_ti_char + +subroutine ext_ncd_put_var_ti_real(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_REAL +#define ARGS NF_FLOAT,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_real + +subroutine ext_ncd_put_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_REAL +#define NF_TYPE NF_FLOAT +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_real + +subroutine ext_ncd_put_var_ti_double(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_DOUBLE +#define ARGS NF_DOUBLE,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_double + +subroutine ext_ncd_put_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_DOUBLE +#define NF_TYPE NF_DOUBLE +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_double + +subroutine ext_ncd_put_var_ti_integer(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define ARGS NF_INT,Count,Data +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_integer + +subroutine ext_ncd_put_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_INT +#define NF_TYPE NF_INT +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_integer + +subroutine ext_ncd_put_var_ti_logical(DataHandle,Element,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_ATT_INT +#define LOG +#define ARGS NF_INT,Count,Buffer +#include "ext_ncd_put_var_ti.code" +end subroutine ext_ncd_put_var_ti_logical + +subroutine ext_ncd_put_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical ,intent(in) :: Data(*) +#define TYPE_COUNT integer ,intent(in) :: Count +#define NF_ROUTINE NF_PUT_VARA_INT +#define NF_TYPE NF_INT +#define LOG +#define LENGTH Count +#define ARG +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_logical + +subroutine ext_ncd_put_var_ti_char(DataHandle,Element,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef ARGS +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(in) :: Data +#define TYPE_COUNT +#define NF_ROUTINE NF_PUT_ATT_TEXT +#define ARGS len_trim(Data),trim(Data) +#define CHAR_TYPE +#include "ext_ncd_put_var_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_put_var_ti_char + +subroutine ext_ncd_put_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_COUNT +#undef NF_ROUTINE +#undef NF_TYPE +#undef LENGTH +#undef ARG +#undef LOG +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(in) :: Data +#define TYPE_COUNT +#define NF_ROUTINE NF_PUT_VARA_TEXT +#define NF_TYPE NF_CHAR +#define LENGTH len(Data) +#include "ext_ncd_put_var_td.code" +end subroutine ext_ncd_put_var_td_char + +subroutine ext_ncd_get_var_ti_real(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(out) :: Data(*) +#define TYPE_BUFFER real ,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_ATT_REAL +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_real + +subroutine ext_ncd_get_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'REAL' +#define TYPE_DATA real ,intent(out) :: Data(*) +#define TYPE_BUFFER real +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_FLOAT +#define NF_ROUTINE NF_GET_VARA_REAL +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_real + +subroutine ext_ncd_get_var_ti_double(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(out) :: Data(*) +#define TYPE_BUFFER real*8 ,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_ATT_DOUBLE +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_double + +subroutine ext_ncd_get_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'DOUBLE' +#define TYPE_DATA real*8 ,intent(out) :: Data(*) +#define TYPE_BUFFER real*8 +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_DOUBLE +#define NF_ROUTINE NF_GET_VARA_DOUBLE +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_double + +subroutine ext_ncd_get_var_ti_integer(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_integer + +subroutine ext_ncd_get_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'INTEGER' +#define TYPE_DATA integer,intent(out) :: Data(*) +#define TYPE_BUFFER integer +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_VARA_INT +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_integer + +subroutine ext_ncd_get_var_ti_logical(DataHandle,Element,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer,allocatable :: Buffer(:) +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_ATT_INT +#define COPY Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count))==1 +#include "ext_ncd_get_var_ti.code" +end subroutine ext_ncd_get_var_ti_logical + +subroutine ext_ncd_get_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#undef COPY +#define ROUTINE_TYPE 'LOGICAL' +#define TYPE_DATA logical,intent(out) :: Data(*) +#define TYPE_BUFFER integer +#define TYPE_COUNT integer,intent(in) :: Count +#define TYPE_OUTCOUNT integer,intent(out) :: OutCount +#define NF_TYPE NF_INT +#define NF_ROUTINE NF_GET_VARA_INT +#define LENGTH min(Count,Len1) +#define COPY Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count))==1 +#include "ext_ncd_get_var_td.code" +end subroutine ext_ncd_get_var_td_logical + +subroutine ext_ncd_get_var_ti_char(DataHandle,Element,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef COPY +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(out) :: Data +#define TYPE_BUFFER +#define TYPE_COUNT integer :: Count = 1 +#define TYPE_OUTCOUNT +#define NF_TYPE NF_CHAR +#define NF_ROUTINE NF_GET_ATT_TEXT +#define COPY +#define CHAR_TYPE +#include "ext_ncd_get_var_ti.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_var_ti_char + +subroutine ext_ncd_get_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +#undef ROUTINE_TYPE +#undef TYPE_DATA +#undef TYPE_BUFFER +#undef TYPE_COUNT +#undef TYPE_OUTCOUNT +#undef NF_TYPE +#undef NF_ROUTINE +#undef LENGTH +#define ROUTINE_TYPE 'CHAR' +#define TYPE_DATA character*(*) ,intent(out) :: Data +#define TYPE_BUFFER character (80) +#define TYPE_COUNT integer :: Count = 1 +#define TYPE_OUTCOUNT +#define NF_TYPE NF_CHAR +#define NF_ROUTINE NF_GET_VARA_TEXT +#define LENGTH Len1 +#define CHAR_TYPE +#include "ext_ncd_get_var_td.code" +#undef CHAR_TYPE +end subroutine ext_ncd_get_var_td_char + +subroutine ext_ncd_put_dom_td_real(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_real + +subroutine ext_ncd_put_dom_td_integer(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_integer + +subroutine ext_ncd_put_dom_td_double(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_double + +subroutine ext_ncd_put_dom_td_logical(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_logical + +subroutine ext_ncd_put_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Data + integer ,intent(out) :: Status + + call ext_ncd_put_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_put_dom_td_char + +subroutine ext_ncd_get_dom_td_real(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_real + +subroutine ext_ncd_get_dom_td_integer(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_integer + +subroutine ext_ncd_get_dom_td_double(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_double + +subroutine ext_ncd_get_dom_td_logical(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_logical + +subroutine ext_ncd_get_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(out) :: Data + integer ,intent(out) :: Status + call ext_ncd_get_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_get_dom_td_char + +subroutine ext_ncd_write_field(DataHandle,DateStr,Var,Field,FieldTypeIn, & + Comm, IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(inout) :: Field(*) + integer ,intent(in) :: FieldTypeIn + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) ,dimension(*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + integer :: FieldType + character (3) :: MemoryOrder + type(wrf_data_handle) ,pointer :: DH + integer :: NCID + integer :: NDim + character (VarNameLen) :: VarName + character (3) :: MemO + character (3) :: UCMemO + integer :: VarID + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + character(80),dimension(NVarDims) :: RODimNames + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(:,:,:,:),allocatable :: XField + integer :: stat + integer :: NVar + integer :: i,j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + integer :: XType + integer :: di + character (80) :: NullName + logical :: NotFound + +#ifdef USE_NETCDF4_FEATURES + integer, parameter :: cache_size = 32000000 + integer,dimension(NVarDims) :: chunks + logical :: need_chunking + integer :: compression_level + integer :: block_size +#endif + + MemoryOrder = trim(adjustl(MemoryOrdIn)) + NullName=char(0) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',MemoryOrder,'| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',DateStr,'| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NCID = DH%NCID + +#ifdef USE_NETCDF4_FEATURES +if ( .not. DH%use_netcdf_classic ) then + call set_chunking(MemoryOrder,need_chunking) + compression_level = 2 +else + need_chunking = .false. +endif +#endif + + if ( DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE ) then + FieldType = WRF_REAL + else + FieldType = FieldTypeIn + end if + + write(msg,*)'ext_ncd_write_field: called for ',TRIM(Var) + +!jm 010827 Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + + IF ( ZeroLengthHorzDim(MemoryOrder,Length,Status) ) THEN + write(msg,*)'ext_ncd_write_field: zero length dimension in ',TRIM(Var),'. Ignoring' + call wrf_debug ( WARN , TRIM(msg)) + return + ENDIF + + call ExtOrder(MemoryOrder,Length,Status) + call ExtOrderStr(MemoryOrder,DimNames,RODimNames,Status) + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) 'Warning WRITE READ ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(DH%VarNames(NVar) == VarName ) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + write(msg,*) 'Warning 2 DRYRUNS 1 VARIABLE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%VarNames(NVar) == NO_NAME) then + DH%VarNames(NVar) = VarName + DH%NumVars = NVar + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) 'Warning TOO MANY VARIABLES in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + do j = 1,NDim + if(RODimNames(j) == NullName .or. RODimNames(j) == '') then + do i=1,MaxDims + if(DH%DimLengths(i) == Length(j)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else !look for input name and check if already defined + NotFound = .true. + do i=1,MaxDims + if (DH%DimNames(i) == RODimNames(j)) then + if (DH%DimLengths(i) == Length(j)) then + NotFound = .false. + exit + else + Status = WRF_WARN_DIMNAME_REDEFINED + write(msg,*) 'Warning DIM ',i,', NAME ',TRIM(DH%DimNames(i)),' REDEFINED by var ', & + TRIM(Var),' ',DH%DimLengths(i),Length(j) ,' in ', __FILE__ ,' line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + enddo + if (NotFound) then + do i=1,MaxDims + if (DH%DimLengths(i) == NO_DIM) then + DH%DimNames(i) = RODimNames(j) + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + endif + VDimIDs(j) = DH%DimIDs(i) + DH%VarDimLens(j,NVar) = Length(j) + enddo + VDimIDs(NDim+1) = DH%DimUnlimID + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + XType = NF_FLOAT + ELSE IF (FieldType == WRF_DOUBLE) THEN + Xtype = NF_DOUBLE + ELSE IF (FieldType == WRF_INTEGER) THEN + XType = NF_INT + ELSE IF (FieldType == WRF_LOGICAL) THEN + XType = NF_INT + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + + stat = NF_DEF_VAR(NCID,VarName,XType,NDim+1,VDimIDs,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + +#ifdef USE_NETCDF4_FEATURES + if(need_chunking) then + chunks(1:NDim) = Length(1:NDim) + chunks(NDim+1) = 1 + chunks(1) = (Length(1) + 1)/2 + chunks(2) = (Length(2) + 1)/2 + + block_size = 1 + do i = 1, NDim + block_size = block_size * chunks(i) + end do + + do while (block_size > cache_size) + chunks(1) = (chunks(1) + 1)/2 + chunks(2) = (chunks(2) + 1)/2 + + block_size = 1 + do i = 1, NDim + block_size = block_size * chunks(i) + end do + end do + +! write(unit=0, fmt='(2x, 3a,i6)') 'file: ', __FILE__, ', line: ', __LINE__ +! write(unit=0, fmt='(2x, 3a)') TRIM(VarName),':' +! write(unit=0, fmt='(10x, 2(a,i6))') 'length 1 = ', Length(1), ', chunk 1 = ', chunks(1) +! write(unit=0, fmt='(10x, 2(a,i6))') 'length 2 = ', Length(2), ', chunk 2 = ', chunks(2) +! write(unit=0, fmt='(10x, 2(a,i6))') 'length NDim+1 = ', Length(NDim+1), ', chunk NDim+1 = ', chunks(NDim+1) +! write(unit=0, fmt='(10x, a,i6)') 'compression_level = ', compression_level + + stat = NF_DEF_VAR_CHUNKING(NCID, VarID, NF_CHUNKED, chunks(1:NDim+1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF def chunking error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + stat = NF_DEF_VAR_DEFLATE(NCID, VarID, 1, 1, compression_level) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF def compression error for ',TRIM(VarName),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif +#endif + + DH%VarIDs(NVar) = VarID + stat = NF_PUT_ATT_INT(NCID,VarID,'FieldType',NF_INT,1,FieldType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call reorder(MemoryOrder,MemO) + call uppercase(MemO,UCMemO) + stat = NF_PUT_ATT_TEXT(NCID,VarID,'MemoryOrder',3,UCMemO) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) 'Warning VARIABLE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + VarID = DH%VarIDs(NVar) + do j=1,NDim + if(Length(j) /= DH%VarDimLens(j,NVar) .AND. DH%FileStatus /= WRF_FILE_OPENED_FOR_UPDATE ) then + Status = WRF_WARN_WRTLEN_NE_DRRUNLEN + write(msg,*) 'Warning LENGTH != DRY RUN LENGTH for |', & + VarName,'| dim ',j,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' LENGTH ',Length(j),' DRY RUN LENGTH ',DH%VarDimLens(j,NVar) + call wrf_debug ( WARN , TRIM(msg)) + return +!jm 010825 elseif(DomainStart(j) < MemoryStart(j)) then + elseif(PatchStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning DIMENSION ERROR for |',VarName, & + '| in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,Length ,x1,x2,y1,y2,z1,z2) + call GetIndices(NDim,PatchStart, PatchEnd ,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + if (DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE) then + call TransposeToR4('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + else + call Transpose('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + end if + call FieldIO('write',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , TRIM(msg)) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_write_field + +subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & + IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(out) :: Field(*) + integer ,intent(in) :: FieldType + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) , dimension (*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + character (3) :: MemoryOrder + character (NF_MAX_NAME) :: dimname + type(wrf_data_handle) ,pointer :: DH + integer :: NDim + integer :: NCID + character (VarNameLen) :: VarName + integer :: VarID + integer ,dimension(NVarDims) :: VCount + integer ,dimension(NVarDims) :: VStart + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + integer ,dimension(NVarDims) :: MemS + integer ,dimension(NVarDims) :: MemE + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(NVarDims) :: StoredLen + integer ,dimension(:,:,:,:) ,allocatable :: XField + integer :: NVar + integer :: j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + character (VarNameLen) :: Name + integer :: XType + integer :: StoredDim + integer :: NAtts + integer :: Len + integer :: stat + integer :: di + integer :: FType + + MemoryOrder = trim(adjustl(MemoryOrdIn)) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',TRIM(MemoryOrder),'| for |', & + TRIM(Var),'| in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',TRIM(DateStr),'| for |',TRIM(Var), & + '| in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_read_field ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +! jm it is okay to have a dry run read. means read is called between ofrb and ofrc. Just return. +! Status = WRF_WARN_DRYRUN_READ +! write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ +! call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_NO_ERR + RETURN + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + NCID = DH%NCID + +!jm Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + call ExtOrder(MemoryOrder,Length,Status) + stat = NF_INQ_VARID(NCID,VarName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__,' Varname ',Varname + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(NCID,VarID,Name,XType,StoredDim,VDimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(NCID,VarID,'FieldType',FType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif +! allow coercion between double and single prec real +!jm if(FieldType /= Ftype) then + if( (FieldType == WRF_REAL .OR. FieldType == WRF_DOUBLE) ) then + if ( .NOT. (Ftype == WRF_REAL .OR. Ftype == WRF_DOUBLE )) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else if(FieldType /= Ftype) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning REAL TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_DOUBLE) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning DOUBLE TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_INTEGER) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning INTEGER TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE IF (FieldType == WRF_LOGICAL) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning LOGICAL TYPE MISMATCH in ',__FILE__,', line', __LINE__ + endif + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + END IF + + if(Status /= WRF_NO_ERR) then + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! NDim=0 for scalars. Handle read of old NDim=1 files. TBH: 20060502 + IF ( ( NDim == 0 ) .AND. ( StoredDim == 2 ) ) THEN + stat = NF_INQ_DIMNAME(NCID,VDimIDs(1),dimname) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + IF ( dimname(1:10) == 'ext_scalar' ) THEN + NDim = 1 + Length(1) = 1 + ENDIF + ENDIF + if(StoredDim /= NDim+1) then + Status = WRF_ERR_FATAL_BAD_VARIABLE_DIM + write(msg,*) 'Fatal error BAD VARIABLE DIMENSION in ext_ncd_read_field ',TRIM(Var),TRIM(DateStr) + call wrf_debug ( FATAL , msg) + write(msg,*) ' StoredDim ', StoredDim, ' .NE. NDim+1 ', NDim+1 + call wrf_debug ( FATAL , msg) + return + endif + do j=1,NDim + stat = NF_INQ_DIMLEN(NCID,VDimIDs(j),StoredLen(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(Length(j) > StoredLen(j)) then + Status = WRF_WARN_READ_PAST_EOF + write(msg,*) 'Warning READ PAST EOF in ext_ncd_read_field of ',TRIM(Var),Length(j),'>',StoredLen(j) + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Length(j) <= 0) then + Status = WRF_WARN_ZERO_LENGTH_READ + write(msg,*) 'Warning ZERO LENGTH READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DomainStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning dim ',j,' DomainStart (',DomainStart(j), & + ') < MemoryStart (',MemoryStart(j),') in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) +! return + endif + enddo + + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,StoredLen,x1,x2,y1,y2,z1,z2) +!jm call GetIndices(NDim,DomainStart,DomainEnd,i1,i2,j1,j2,k1,k2) + call GetIndices(NDim,PatchStart,PatchEnd,i1,i2,j1,j2,k1,k2) + + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + call FieldIO('read',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call Transpose('read',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_read_field + +subroutine ext_ncd_inquire_opened( DataHandle, FileName , FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(inout) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + !call upgrade_filename(FileName) + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + FileStatus = WRF_FILE_NOT_OPENED + return + endif + if(trim(FileName) /= trim(DH%FileName)) then + FileStatus = WRF_FILE_NOT_OPENED + else + FileStatus = DH%FileStatus + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_opened + +subroutine ext_ncd_inquire_filename( Datahandle, FileName, FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + FileStatus = WRF_FILE_NOT_OPENED + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + FileName = trim(DH%FileName) + FileStatus = DH%FileStatus + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_filename + +subroutine ext_ncd_set_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: i + + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + DH%CurrentTime = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + return + endif + enddo + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_set_time + +subroutine ext_ncd_get_next_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + if(DH%CurrentTime >= DH%NumberTimes) then + Status = WRF_WARN_TIME_EOF + return + endif + DH%CurrentTime = DH%CurrentTime +1 + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'DH%FileStatus ',DH%FileStatus + call wrf_debug ( FATAL , msg) + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_time + +subroutine ext_ncd_get_previous_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + if(DH%CurrentTime.GT.0) then + DH%CurrentTime = DH%CurrentTime -1 + endif + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_previous_time + +subroutine ext_ncd_get_next_var(DataHandle, VarName, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: VarName + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + character (80) :: Name + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + + DH%CurrentVariable = DH%CurrentVariable +1 + if(DH%CurrentVariable > DH%NumVars) then + Status = WRF_WARN_VAR_EOF + return + endif + VarName = DH%VarNames(DH%CurrentVariable) + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_var + +subroutine ext_ncd_end_of_frame(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + + call GetDH(DataHandle,DH,Status) + return +end subroutine ext_ncd_end_of_frame + +! NOTE: For scalar variables NDim is set to zero and DomainStart and +! NOTE: DomainEnd are left unmodified. +subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder,Stagger,DomainStart,DomainEnd,WrfType,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Name + integer ,intent(out) :: NDim + character*(*) ,intent(out) :: MemoryOrder + character*(*) :: Stagger ! Dummy for now + integer ,dimension(*) ,intent(out) :: DomainStart, DomainEnd + integer ,intent(out) :: WrfType + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VarID + integer ,dimension(NVarDims) :: VDimIDs + integer :: j + integer :: stat + integer :: XType + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_INQ_VARID(DH%NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARTYPE(DH%NCID,VarID,XType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,VarID,'FieldType',WrfType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + select case (XType) + case (NF_BYTE) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BYTE IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_CHAR) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning CHAR IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_SHORT) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning SHORT IS BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_INT) + if(WrfType /= WRF_INTEGER .and. WrfType /= WRF_LOGICAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_FLOAT) + if(WrfType /= WRF_REAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_DOUBLE) + if(WrfType /= WRF_DOUBLE) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case default + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + end select + + stat = NF_GET_ATT_TEXT(DH%NCID,VarID,'MemoryOrder',MemoryOrder) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER ',TRIM(MemoryOrder),' in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARDIMID(DH%NCID,VarID,VDimIDs) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + do j = 1, NDim + DomainStart(j) = 1 + stat = NF_INQ_DIMLEN(DH%NCID,VDimIDs(j),DomainEnd(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__ + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',__FILE__,', line', __LINE__ + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_info + +subroutine ext_ncd_warning_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + + SELECT CASE (Code) + CASE (0) + ReturnString='No error' + Status=WRF_NO_ERR + return + CASE (-1) + ReturnString= 'File not found (or file is incomplete)' + Status=WRF_NO_ERR + return + CASE (-2) + ReturnString='Metadata not found' + Status=WRF_NO_ERR + return + CASE (-3) + ReturnString= 'Timestamp not found' + Status=WRF_NO_ERR + return + CASE (-4) + ReturnString= 'No more timestamps' + Status=WRF_NO_ERR + return + CASE (-5) + ReturnString= 'Variable not found' + Status=WRF_NO_ERR + return + CASE (-6) + ReturnString= 'No more variables for the current time' + Status=WRF_NO_ERR + return + CASE (-7) + ReturnString= 'Too many open files' + Status=WRF_NO_ERR + return + CASE (-8) + ReturnString= 'Data type mismatch' + Status=WRF_NO_ERR + return + CASE (-9) + ReturnString= 'Attempt to write read-only file' + Status=WRF_NO_ERR + return + CASE (-10) + ReturnString= 'Attempt to read write-only file' + Status=WRF_NO_ERR + return + CASE (-11) + ReturnString= 'Attempt to access unopened file' + Status=WRF_NO_ERR + return + CASE (-12) + ReturnString= 'Attempt to do 2 trainings for 1 variable' + Status=WRF_NO_ERR + return + CASE (-13) + ReturnString= 'Attempt to read past EOF' + Status=WRF_NO_ERR + return + CASE (-14) + ReturnString= 'Bad data handle' + Status=WRF_NO_ERR + return + CASE (-15) + ReturnString= 'Write length not equal to training length' + Status=WRF_NO_ERR + return + CASE (-16) + ReturnString= 'More dimensions requested than training' + Status=WRF_NO_ERR + return + CASE (-17) + ReturnString= 'Attempt to read more data than exists' + Status=WRF_NO_ERR + return + CASE (-18) + ReturnString= 'Input dimensions inconsistent' + Status=WRF_NO_ERR + return + CASE (-19) + ReturnString= 'Input MemoryOrder not recognized' + Status=WRF_NO_ERR + return + CASE (-20) + ReturnString= 'A dimension name with 2 different lengths' + Status=WRF_NO_ERR + return + CASE (-21) + ReturnString= 'String longer than provided storage' + Status=WRF_NO_ERR + return + CASE (-22) + ReturnString= 'Function not supportable' + Status=WRF_NO_ERR + return + CASE (-23) + ReturnString= 'Package implements this routine as NOOP' + Status=WRF_NO_ERR + return + +!netcdf-specific warning messages + CASE (-1007) + ReturnString= 'Bad data type' + Status=WRF_NO_ERR + return + CASE (-1008) + ReturnString= 'File not committed' + Status=WRF_NO_ERR + return + CASE (-1009) + ReturnString= 'File is opened for reading' + Status=WRF_NO_ERR + return + CASE (-1011) + ReturnString= 'Attempt to write metadata after open commit' + Status=WRF_NO_ERR + return + CASE (-1010) + ReturnString= 'I/O not initialized' + Status=WRF_NO_ERR + return + CASE (-1012) + ReturnString= 'Too many variables requested' + Status=WRF_NO_ERR + return + CASE (-1013) + ReturnString= 'Attempt to close file during a dry run' + Status=WRF_NO_ERR + return + CASE (-1014) + ReturnString= 'Date string not 19 characters in length' + Status=WRF_NO_ERR + return + CASE (-1015) + ReturnString= 'Attempt to read zero length words' + Status=WRF_NO_ERR + return + CASE (-1016) + ReturnString= 'Data type not found' + Status=WRF_NO_ERR + return + CASE (-1017) + ReturnString= 'Badly formatted date string' + Status=WRF_NO_ERR + return + CASE (-1018) + ReturnString= 'Attempt at read during a dry run' + Status=WRF_NO_ERR + return + CASE (-1019) + ReturnString= 'Attempt to get zero words' + Status=WRF_NO_ERR + return + CASE (-1020) + ReturnString= 'Attempt to put zero length words' + Status=WRF_NO_ERR + return + CASE (-1021) + ReturnString= 'NetCDF error' + Status=WRF_NO_ERR + return + CASE (-1022) + ReturnString= 'Requested length <= 1' + Status=WRF_NO_ERR + return + CASE (-1023) + ReturnString= 'More data available than requested' + Status=WRF_NO_ERR + return + CASE (-1024) + ReturnString= 'New date less than previous date' + Status=WRF_NO_ERR + return + + CASE DEFAULT + ReturnString= 'This warning code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this warning code.' + Status=WRF_NO_ERR + END SELECT + + return +end subroutine ext_ncd_warning_str + +!returns message string for all WRF and netCDF warning/error status codes +!Other i/o packages must provide their own routines to return their own status messages +subroutine ext_ncd_error_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + + SELECT CASE (Code) + CASE (-100) + ReturnString= 'Allocation Error' + Status=WRF_NO_ERR + return + CASE (-101) + ReturnString= 'Deallocation Error' + Status=WRF_NO_ERR + return + CASE (-102) + ReturnString= 'Bad File Status' + Status=WRF_NO_ERR + return + CASE (-1004) + ReturnString= 'Variable on disk is not 3D' + Status=WRF_NO_ERR + return + CASE (-1005) + ReturnString= 'Metadata on disk is not 1D' + Status=WRF_NO_ERR + return + CASE (-1006) + ReturnString= 'Time dimension too small' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This error code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this error code.' + Status=WRF_NO_ERR + END SELECT + + return +end subroutine ext_ncd_error_str diff --git a/libsrc/wrflib/wrf_io.f90 b/libsrc/wrflib/wrf_io.f90 new file mode 100644 index 0000000000..278249138e --- /dev/null +++ b/libsrc/wrflib/wrf_io.f90 @@ -0,0 +1,8169 @@ +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + +module wrf_data + + integer , parameter :: FATAL = 1 + integer , parameter :: WARN = 1 + integer , parameter :: WrfDataHandleMax = 99 + integer , parameter :: MaxDims = 2000 ! = NF_MAX_VARS + + + + integer , parameter :: MaxVars = 3000 + + integer , parameter :: MaxTimes = 10000 + integer , parameter :: DateStrLen = 19 + integer , parameter :: VarNameLen = 31 + integer , parameter :: NO_DIM = 0 + integer , parameter :: NVarDims = 4 + integer , parameter :: NMDVarDims = 2 + character (8) , parameter :: NO_NAME = 'NULL' + character (DateStrLen) , parameter :: ZeroDate = '0000-00-00-00:00:00' + integer, parameter :: WRF_FILE_NOT_OPENED = 100 + integer, parameter :: WRF_FILE_OPENED_NOT_COMMITTED = 101 + integer, parameter :: WRF_FILE_OPENED_FOR_WRITE = 102 + integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103 + integer, parameter :: WRF_REAL = 104 + integer, parameter :: WRF_DOUBLE = 105 + integer, parameter :: WRF_FLOAT=WRF_REAL + integer, parameter :: WRF_INTEGER = 106 + integer, parameter :: WRF_LOGICAL = 107 + integer, parameter :: WRF_COMPLEX = 108 + integer, parameter :: WRF_DOUBLE_COMPLEX = 109 + integer, parameter :: WRF_FILE_OPENED_FOR_UPDATE = 110 +! This bit is for backwards compatibility with old variants of these flags +! that are still being used in io_grib1 and io_phdf5. It should be removed! + integer, parameter :: WRF_FILE_OPENED_AND_COMMITTED = 102 + character (256) :: msg + logical :: WrfIOnotInitialized = .true. + type :: wrf_data_handle + character (255) :: FileName + integer :: FileStatus + integer :: Comm + integer :: NCID + logical :: Free + logical :: Write + character (5) :: TimesName + integer :: TimeIndex + integer :: CurrentTime !Only used for read + integer :: NumberTimes !Only used for read + character (DateStrLen), pointer :: Times(:) + integer :: TimesVarID + integer , pointer :: DimLengths(:) + integer , pointer :: DimIDs(:) + character (31) , pointer :: DimNames(:) + integer :: DimUnlimID + character (9) :: DimUnlimName + integer , dimension(NVarDims) :: DimID + integer , dimension(NVarDims) :: Dimension + integer , pointer :: MDVarIDs(:) + integer , pointer :: MDVarDimLens(:) + character (80) , pointer :: MDVarNames(:) + integer , pointer :: VarIDs(:) + integer , pointer :: VarDimLens(:,:) + character (VarNameLen), pointer :: VarNames(:) + integer :: CurrentVariable !Only used for read + integer :: NumVars +! first_operation is set to .TRUE. when a new handle is allocated +! or when open-for-write or open-for-read are committed. It is set +! to .FALSE. when the first field is read or written. + logical :: first_operation + logical :: R4OnOutput + logical :: nofill + logical :: use_netcdf_classic + end type wrf_data_handle + type(wrf_data_handle),target :: WrfDataHandles(WrfDataHandleMax) +end module wrf_data +module ext_ncd_support_routines + implicit none +CONTAINS +subroutine allocHandle(DataHandle,DH,Comm,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(out) :: DataHandle + type(wrf_data_handle),pointer :: DH + integer ,intent(IN) :: Comm + integer ,intent(out) :: Status + integer :: i + integer :: stat + do i=1,WrfDataHandleMax + if(WrfDataHandles(i)%Free) then + DH => WrfDataHandles(i) + DataHandle = i + allocate(DH%Times(MaxTimes), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 124 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimLengths(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 131 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimIDs(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%DimNames(MaxDims), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 145 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarDimLens(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 159 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%MDVarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 166 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarIDs(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 173 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarDimLens(NVarDims-1,MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + allocate(DH%VarNames(MaxVars), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 187 + call wrf_debug ( FATAL , msg) + return + endif + exit + endif + if(i==WrfDataHandleMax) then + Status = WRF_WARN_TOO_MANY_FILES + write(msg,*) 'Warning TOO MANY FILES in ',"wrf_io.F90",', line', 195 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) 'Did you call ext_ncd_ioinit?' + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + DH%Free =.false. + DH%Comm = Comm + DH%Write =.false. + DH%first_operation = .TRUE. + DH%R4OnOutput = .false. + DH%nofill = .false. + Status = WRF_NO_ERR +end subroutine allocHandle +subroutine deallocHandle(DataHandle, Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + IF ( DataHandle .GE. 1 .AND. DataHandle .LE. WrfDataHandleMax ) THEN + if(.NOT. WrfDataHandles(DataHandle)%Free) then + DH => WrfDataHandles(DataHandle) + deallocate(DH%Times, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 226 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimLengths, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 233 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 240 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%DimNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 247 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 254 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 261 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%MDVarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 268 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarIDs, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 275 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarDimLens, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 282 + call wrf_debug ( FATAL , msg) + return + endif + deallocate(DH%VarNames, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 289 + call wrf_debug ( FATAL , msg) + return + endif + DH%Free =.TRUE. + endif + ENDIF + Status = WRF_NO_ERR +end subroutine deallocHandle +subroutine GetDH(DataHandle,DH,Status) + use wrf_data + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + type(wrf_data_handle) ,pointer :: DH + integer ,intent(out) :: Status + if(DataHandle < 1 .or. DataHandle > WrfDataHandleMax) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + DH => WrfDataHandles(DataHandle) + if(DH%Free) then + Status = WRF_WARN_BAD_DATA_HANDLE + return + endif + Status = WRF_NO_ERR + return +end subroutine GetDH +subroutine DateCheck(Date,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Date + integer ,intent(out) :: Status + if(len(Date) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + else + Status = WRF_NO_ERR + endif + return +end subroutine DateCheck + +subroutine GetName(Element,Var,Name,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Name + integer ,intent(out) :: Status + character (VarNameLen) :: VarName + character (1) :: c + integer :: i + integer, parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + + VarName = Var + Name = 'MD___' + do i=1,len(Name) + c=Name(i:i) + if('A'<=c .and. c <='Z') Name(i:i)=achar(iachar(c)+upper_to_lower) + if(c=='-'.or.c==':') Name(i:i)='_' + enddo + Status = WRF_NO_ERR + return +end subroutine GetName + +subroutine GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: TimeIndex + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VStart(2) + integer :: VCount(2) + integer :: stat + integer :: i + + DH => WrfDataHandles(DataHandle) + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + Status = WRF_WARN_DATESTR_ERROR + write(msg,*) 'Warning DATE STRING ERROR in ',"wrf_io.F90",', line', 375 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(IO == 'write') then + TimeIndex = DH%TimeIndex + if(TimeIndex <= 0) then + TimeIndex = 1 + elseif(DateStr == DH%Times(TimeIndex)) then + Status = WRF_NO_ERR + return + else + TimeIndex = TimeIndex +1 + if(TimeIndex > MaxTimes) then + Status = WRF_WARN_TIME_EOF + write(msg,*) 'Warning TIME EOF in ',"wrf_io.F90",', line', 390 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + DH%TimeIndex = TimeIndex + DH%Times(TimeIndex) = DateStr + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = DateStrLen + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT(DH%NCID,DH%TimesVarID,VStart,VCount,DateStr) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 404 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + Status = WRF_NO_ERR + TimeIndex = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + write(msg,*) 'Warning TIME ',DateStr,' NOT FOUND in ',"wrf_io.F90",', line', 417 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + return +end subroutine GetTimeIndex + +subroutine GetDim(MemoryOrder,NDim,Status) + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(out) :: NDim + integer ,intent(out) :: Status + character*3 :: MemOrd + + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xzy','yxz','yzx','zxy','zyx','xsz','xez','ysz','yez') + NDim = 3 + case ('xy','yx','xs','xe','ys','ye','cc') + NDim = 2 + case ('z','c') + NDim = 1 + case ('0') ! NDim=0 for scalars. TBH: 20060502 + NDim = 0 + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine GetDim +subroutine GetIndices(NDim,Start,End,i1,i2,j1,j2,k1,k2) + integer ,intent(in) :: NDim + integer ,dimension(*),intent(in) :: Start,End + integer ,intent(out) :: i1,i2,j1,j2,k1,k2 + i1=1 + i2=1 + j1=1 + j2=1 + k1=1 + k2=1 + if(NDim == 0) return ! NDim=0 for scalars. TBH: 20060502 + i1 = Start(1) + i2 = End (1) + if(NDim == 1) return + j1 = Start(2) + j2 = End (2) + if(NDim == 2) return + k1 = Start(3) + k2 = End (3) + return +end subroutine GetIndices +logical function ZeroLengthHorzDim(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(in) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + logical zero_length + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + zero_length = .false. + select case (MemOrd) + case ('xsz','xez','ysz','yez','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy','yzx') + zero_length = temp(1) .lt. 1 .or. temp(3) .lt. 1 + case ('xy','yx','xyz','yxz') + zero_length = temp(1) .lt. 1 .or. temp(2) .lt. 1 + case ('zxy','zyx') + zero_length = temp(2) .lt. 1 .or. temp(3) .lt. 1 + case default + Status = WRF_WARN_BAD_MEMORYORDER + ZeroLengthHorzDim = .true. + return + end select + Status = WRF_NO_ERR + ZeroLengthHorzDim = zero_length + return +end function ZeroLengthHorzDim +subroutine ExtOrder(MemoryOrder,Vector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + integer,dimension(*) ,intent(inout) :: Vector + integer ,intent(out) :: Status + integer :: NDim + integer,dimension(NVarDims) :: temp + character*3 :: MemOrd + call GetDim(MemoryOrder,NDim,Status) + temp(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + Vector(2) = temp(3) + Vector(3) = temp(2) + case ('yxz') + Vector(1) = temp(2) + Vector(2) = temp(1) + case ('yzx') + Vector(1) = temp(3) + Vector(2) = temp(1) + Vector(3) = temp(2) + case ('zxy') + Vector(1) = temp(2) + Vector(2) = temp(3) + Vector(3) = temp(1) + case ('zyx') + Vector(1) = temp(3) + Vector(3) = temp(1) + case ('yx') + Vector(1) = temp(2) + Vector(2) = temp(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrder +subroutine ExtOrderStr(MemoryOrder,Vector,ROVector,Status) + use wrf_data + include 'wrf_status_codes.h' + character*(*) ,intent(in) :: MemoryOrder + character*(*),dimension(*) ,intent(in) :: Vector + character(80),dimension(NVarDims),intent(out) :: ROVector + integer ,intent(out) :: Status + integer :: NDim + character*3 :: MemOrd + call GetDim(MemoryOrder,NDim,Status) + ROVector(1:NDim) = Vector(1:NDim) + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c') + continue + case ('0') + continue ! NDim=0 for scalars. TBH: 20060502 + case ('xzy') + ROVector(2) = Vector(3) + ROVector(3) = Vector(2) + case ('yxz') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case ('yzx') + ROVector(1) = Vector(3) + ROVector(2) = Vector(1) + ROVector(3) = Vector(2) + case ('zxy') + ROVector(1) = Vector(2) + ROVector(2) = Vector(3) + ROVector(3) = Vector(1) + case ('zyx') + ROVector(1) = Vector(3) + ROVector(3) = Vector(1) + case ('yx') + ROVector(1) = Vector(2) + ROVector(2) = Vector(1) + case default + Status = WRF_WARN_BAD_MEMORYORDER + return + end select + Status = WRF_NO_ERR + return +end subroutine ExtOrderStr +subroutine LowerCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: upper_to_lower =IACHAR('a')-IACHAR('A') + integer :: i,N + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower) + enddo + return +end subroutine LowerCase +subroutine UpperCase(MemoryOrder,MemOrd) + character*(*) ,intent(in) :: MemoryOrder + character*(*) ,intent(out) :: MemOrd + character*1 :: c + integer ,parameter :: lower_to_upper =IACHAR('A')-IACHAR('a') + integer :: i,N + MemOrd = ' ' + N = len(MemoryOrder) + MemOrd(1:N) = MemoryOrder(1:N) + do i=1,N + c = MemoryOrder(i:i) + if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c)+lower_to_upper) + enddo + return +end subroutine UpperCase +subroutine netcdf_err(err,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: err + integer ,intent(out) :: Status + character(len=80) :: errmsg + integer :: stat + if( err==NF_NOERR )then + Status = WRF_NO_ERR + else + errmsg = NF_STRERROR(err) + write(msg,*) 'NetCDF error: ',errmsg + call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_WARN_NETCDF + endif + return +end subroutine netcdf_err +subroutine FieldIO(IO,DataHandle,DateStr,Length,MemoryOrder & + ,FieldType,NCID,VarID,XField,Status) + use wrf_data + include 'wrf_status_codes.h' + include 'netcdf.inc' + character (*) ,intent(in) :: IO + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer,dimension(NVarDims),intent(in) :: Length + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: FieldType + integer ,intent(in) :: NCID + integer ,intent(in) :: VarID + integer,dimension(*) ,intent(inout) :: XField + integer ,intent(out) :: Status + integer :: TimeIndex + integer :: NDim + integer,dimension(NVarDims) :: VStart + integer,dimension(NVarDims) :: VCount +! include 'wrf_io_flags.h' + call GetTimeIndex(IO,DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning in ',"wrf_io.F90",', line', 704 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' Bad time index for DateStr = ',DateStr + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + VStart(:) = 1 + VCount(:) = 1 + VStart(1:NDim) = 1 + VCount(1:NDim) = Length(1:NDim) + VStart(NDim+1) = TimeIndex + VCount(NDim+1) = 1 + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + call ext_ncd_RealFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_DOUBLE) THEN + call ext_ncd_DoubleFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_INTEGER) THEN + call ext_ncd_IntFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + ELSE IF (FieldType == WRF_LOGICAL) THEN + call ext_ncd_LogicalFieldIO (IO,NCID,VarID,VStart,VCount,XField,Status) + if(Status /= WRF_NO_ERR) return + ELSE + write(6,*) 'WARNING---- some missing calls commented out' + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 731 + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + return +end subroutine FieldIO +subroutine Transpose(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + integer ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) +!jm 010827 integer ,intent(inout) :: XField(di,x1:x2,y1:y2,z1:z2) + integer ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + case ('xzy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yxz') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zxy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yzx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zyx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + end select + return +end subroutine Transpose +subroutine reorder (MemoryOrder,MemO) + character*(*) ,intent(in) :: MemoryOrder + character*3 ,intent(out) :: MemO + character*3 :: MemOrd + integer :: N,i,i1,i2,i3 + MemO = MemoryOrder + N = len_trim(MemoryOrder) + if(N == 1) return + call lowercase(MemoryOrder,MemOrd) +! never invert the boundary codes + select case ( MemOrd ) + case ( 'xsz','xez','ysz','yez' ) + return + case default + continue + end select + i1 = 1 + i3 = 1 + do i=2,N + if(ichar(MemOrd(i:i)) < ichar(MemOrd(i1:i1))) I1 = i + if(ichar(MemOrd(i:i)) > ichar(MemOrd(i3:i3))) I3 = i + enddo + if(N == 2) then + i2=i3 + else + i2 = 6-i1-i3 + endif + MemO(1:1) = MemoryOrder(i1:i1) + MemO(2:2) = MemoryOrder(i2:i2) + if(N == 3) MemO(3:3) = MemoryOrder(i3:i3) + if(MemOrd(i1:i1) == 's' .or. MemOrd(i1:i1) == 'e') then + MemO(1:N-1) = MemO(2:N) + MemO(N:N ) = MemoryOrder(i1:i1) + endif + return +end subroutine reorder +! Returns .TRUE. iff it is OK to write time-independent domain metadata to the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_put_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, first_output, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 846 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + first_output = ncd_is_first_operation( DataHandle ) + retval = .NOT. dryrun .AND. first_output + ENDIF + ncd_ok_to_put_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_put_dom_ti +! Returns .TRUE. iff it is OK to read time-independent domain metadata from the +! file referenced by DataHandle. If DataHandle is invalid, .FALSE. is +! returned. +LOGICAL FUNCTION ncd_ok_to_get_dom_ti( DataHandle ) + USE wrf_data + include 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + CHARACTER*80 :: fname + INTEGER :: filestate + INTEGER :: Status + LOGICAL :: dryrun, retval + call ext_ncd_inquire_filename( DataHandle, fname, filestate, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 872 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + dryrun = ( filestate .EQ. WRF_FILE_OPENED_NOT_COMMITTED ) + retval = .NOT. dryrun + ENDIF + ncd_ok_to_get_dom_ti = retval + RETURN +END FUNCTION ncd_ok_to_get_dom_ti +! Returns .TRUE. iff nothing has been read from or written to the file +! referenced by DataHandle. If DataHandle is invalid, .FALSE. is returned. +LOGICAL FUNCTION ncd_is_first_operation( DataHandle ) + USE wrf_data + INCLUDE 'wrf_status_codes.h' + INTEGER, INTENT(IN) :: DataHandle + TYPE(wrf_data_handle) ,POINTER :: DH + INTEGER :: Status + LOGICAL :: retval + CALL GetDH( DataHandle, DH, Status ) + IF ( Status /= WRF_NO_ERR ) THEN + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90", & + ', line', 895 + call wrf_debug ( WARN , TRIM(msg) ) + retval = .FALSE. + ELSE + retval = DH%first_operation + ENDIF + ncd_is_first_operation = retval + RETURN +END FUNCTION ncd_is_first_operation +subroutine upgrade_filename(FileName) + implicit none + character*(*), intent(inout) :: FileName + integer :: i + do i = 1, len(trim(FileName)) + if(FileName(i:i) == '-') then + FileName(i:i) = '_' + else if(FileName(i:i) == ':') then + FileName(i:i) = '_' + endif + enddo +end subroutine upgrade_filename +end module ext_ncd_support_routines +subroutine TransposeToR4(IO,MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + use ext_ncd_support_routines + character*(*) ,intent(in) :: IO + character*(*) ,intent(in) :: MemoryOrder + integer ,intent(in) :: l1,l2,m1,m2,n1,n2 + integer ,intent(in) :: di + integer ,intent(in) :: x1,x2,y1,y2,z1,z2 + integer ,intent(in) :: i1,i2,j1,j2,k1,k2 + real*8 ,intent(inout) :: Field(di,l1:l2,m1:m2,n1:n2) + real*4 ,intent(inout) :: XField(di,(i2-i1+1)*(j2-j1+1)*(k2-k1+1)) + character*3 :: MemOrd + character*3 :: MemO + integer ,parameter :: MaxUpperCase=IACHAR('Z') + integer :: i,j,k,ix,jx,kx + call LowerCase(MemoryOrder,MemOrd) + select case (MemOrd) +!#define A-A1+1+(A2-A1+1)*((B-B1)+(C-C1)*(B2-B1+1)) A-A ## 1+1+(A ## 2-A ## 1+1)*((B-B ## 1)+(C-C ## 1)*(B ## 2-B ## 1+1)) +! define(`XDEX',($1-``$1''1+1+(``$1''2-``$1''1+1)*(($2-``$2''1)+($3-``$3''1)*(``$2''2-``$2''1+1)))) + case ('xzy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((k-k1)+(j-j1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('xyz','xsz','xez','ysz','yez','xy','xs','xe','ys','ye','z','c','0') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,i-i1+1+(i2-i1+1)*((j-j1)+(k-k1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yxz') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zxy') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((i-i1)+(j-j1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yzx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((k-k1)+(i-i1)*(k2-k1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('zyx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,k-k1+1+(k2-k1+1)*((j-j1)+(i-i1)*(j2-j1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + case ('yx') + ix=0 + jx=0 + kx=0 + call reorder(MemoryOrder,MemO) + if(IACHAR(MemO(1:1)) > MaxUpperCase) ix=i2+i1 + if(IACHAR(MemO(2:2)) > MaxUpperCase) jx=j2+j1 + if(IACHAR(MemO(3:3)) > MaxUpperCase) kx=k2+k1 +! pjj/cray + if(IO == 'write') then +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) = Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) + enddo + enddo + enddo +!$OMP END PARALLEL DO +else +!!dir$ concurrent +!$OMP PARALLEL DO SCHEDULE(RUNTIME) PRIVATE(i,j,k) + do k=k1,k2 + do j=j1,j2 +!!dir$ prefervector +!!dir$ concurrent +!cdir select(vector) + do i=i1,i2 + Field(1:di,abs(ix-i),abs(jx-j),abs(kx-k)) = XField(1:di,j-j1+1+(j2-j1+1)*((i-i1)+(k-k1)*(i2-i1+1))) + enddo + enddo + enddo +!$OMP END PARALLEL DO +endif + return + end select + return +end subroutine TransposeToR4 +subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), INTENT(IN) :: DatasetName + integer , INTENT(IN) :: Comm1, Comm2 + character *(*), INTENT(IN) :: SysDepInfo + integer , INTENT(OUT) :: DataHandle + integer , INTENT(OUT) :: Status + DataHandle = 0 ! dummy setting to quiet warning message + CALL ext_ncd_open_for_read_begin( DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status ) + IF ( Status .EQ. WRF_NO_ERR ) THEN + CALL ext_ncd_open_for_read_commit( DataHandle, Status ) + ENDIF + return +end subroutine ext_ncd_open_for_read +!ends training phase; switches internal flag to enable input +!must be paired with call to ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_read_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer, intent(in) :: DataHandle + integer, intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1013 + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1019 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_READ + DH%first_operation = .TRUE. + Status = WRF_NO_ERR + return +end subroutine ext_ncd_open_for_read_commit +subroutine ext_ncd_open_for_read_begin( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1064 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 1070 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_NOWRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1078 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1085 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1092 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 1098 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1105 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',"wrf_io.F90",', line', 1111 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1118 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',"wrf_io.F90",', line', 1124 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1133 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1140 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1149 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_read_begin +subroutine ext_ncd_open_for_update( FileName, Comm, IOComm, SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(INOUT) :: FileName + integer ,intent(IN) :: Comm + integer ,intent(IN) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: VarID + integer :: StoredDim + integer :: NAtts + integer :: DimIDs(2) + integer :: VStart(2) + integer :: VLen(2) + integer :: TotalNumVars + integer :: NumVars + integer :: i + character (NF_MAX_NAME) :: Name + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1204 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 1210 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_OPEN(FileName, NF_WRITE, DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1217 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARID(DH%NCID,DH%TimesName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1224 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(DH%NCID,VarID,DH%TimesName, XType, StoredDim, DimIDs, NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1231 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 1237 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(1),VLen(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1244 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(1) /= DateStrLen) then + Status = WRF_WARN_DATESTR_BAD_LENGTH + write(msg,*) 'Warning DATESTR BAD LENGTH in ',"wrf_io.F90",', line', 1250 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_DIMLEN(DH%NCID,DimIDs(2),VLen(2)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1257 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(VLen(2) > MaxTimes) then + Status = WRF_ERR_FATAL_TOO_MANY_TIMES + write(msg,*) 'Fatal TOO MANY TIME VALUES in ',"wrf_io.F90",', line', 1263 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + VStart(1) = 1 + VStart(2) = 1 + stat = NF_GET_VARA_TEXT(DH%NCID,VarID,VStart,VLen,DH%Times) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1272 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_NVARS(DH%NCID,TotalNumVars) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1279 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NumVars = 0 + do i=1,TotalNumVars + stat = NF_INQ_VARNAME(DH%NCID,i,Name) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1288 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Name(1:5) /= 'md___' .and. Name /= DH%TimesName) then + NumVars = NumVars+1 + DH%VarNames(NumVars) = Name + DH%VarIDs(NumVars) = i + endif + enddo + DH%NumVars = NumVars + DH%NumberTimes = VLen(2) + DH%FileStatus = WRF_FILE_OPENED_FOR_UPDATE + DH%FileName = trim(FileName) + DH%CurrentVariable = 0 + DH%CurrentTime = 0 + DH%TimesVarID = VarID + DH%TimeIndex = 0 + return +end subroutine ext_ncd_open_for_update +SUBROUTINE ext_ncd_open_for_write_begin(FileName,Comm,IOComm,SysDepInfo,DataHandle,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character*(*) ,intent(inout) :: FileName + integer ,intent(in) :: Comm + integer ,intent(in) :: IOComm + character*(*) ,intent(in) :: SysDepInfo + integer ,intent(out) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + character (7) :: Buffer + integer :: VDimIDs(2) + !call upgrade_filename(FileName) + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_begin: ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1338 + call wrf_debug ( FATAL , msg) + return + endif + call allocHandle(DataHandle,DH,Comm,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Fatal ALLOCATION ERROR in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1344 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + DH%TimeIndex = 0 + DH%Times = ZeroDate + stat = NF_CREATE(FileName, IOR(NF_CLOBBER,NF_64BIT_OFFSET), DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1374 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + DH%FileName = trim(FileName) + stat = NF_DEF_DIM(DH%NCID,DH%DimUnlimName,NF_UNLIMITED,DH%DimUnlimID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1383 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarNames (1:MaxVars) = NO_NAME + DH%MDVarNames(1:MaxVars) = NO_NAME + do i=1,MaxDims + write(Buffer,FMT="('DIM',i4.4)") i + DH%DimNames (i) = Buffer + DH%DimLengths(i) = NO_DIM + enddo + DH%DimNames(1) = 'DateStrLen' + stat = NF_DEF_DIM(DH%NCID,DH%DimNames(1),DateStrLen,DH%DimIDs(1)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1398 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VDimIDs(1) = DH%DimIDs(1) + VDimIDs(2) = DH%DimUnlimID + stat = NF_DEF_VAR(DH%NCID,DH%TimesName,NF_CHAR,2,VDimIDs,DH%TimesVarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_begin ',"wrf_io.F90",', line', 1407 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(1) = DateStrLen + if (index(SysDepInfo,'REAL_OUTPUT_SIZE=4') /= 0) then + DH%R4OnOutput = .true. + end if +!toggle on nofill mode + if (index(SysDepInfo,'NOFILL=.TRUE.') /= 0) then + DH%nofill = .true. + end if + return +end subroutine ext_ncd_open_for_write_begin +!stub +!opens a file for writing or coupler datastream for sending messages. +!no training phase for this version of the open stmt. +subroutine ext_ncd_open_for_write (DatasetName, Comm1, Comm2, & + SysDepInfo, DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + character *(*), intent(in) ::DatasetName + integer , intent(in) ::Comm1, Comm2 + character *(*), intent(in) ::SysDepInfo + integer , intent(out) :: DataHandle + integer , intent(out) :: Status + Status=WRF_WARN_NOOP + DataHandle = 0 ! dummy setting to quiet warning message + return +end subroutine ext_ncd_open_for_write +SUBROUTINE ext_ncd_open_for_write_commit(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + integer :: oldmode ! for nf_set_fill, not used + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_open_for_write_commit: ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1459 + call wrf_debug ( FATAL , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_open_for_write_commit ',"wrf_io.F90",', line', 1465 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if ( DH%nofill ) then + Status = NF_SET_FILL(DH%NCID,NF_NOFILL, oldmode ) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' from NF_SET_FILL ',"wrf_io.F90",', line', 1472 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + write(msg,*) 'Information: NOFILL being set for writing to ',TRIM(DH%FileName) + call wrf_debug ( WARN , TRIM(msg)) + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_open_for_write_commit ',"wrf_io.F90",', line', 1482 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + DH%first_operation = .TRUE. + return +end subroutine ext_ncd_open_for_write_commit +subroutine ext_ncd_ioclose(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_ioclose ',"wrf_io.F90",', line', 1504 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_ioclose ',"wrf_io.F90",', line', 1510 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_CLOSE + write(msg,*) 'Warning TRY TO CLOSE DRYRUN in ext_ncd_ioclose ',"wrf_io.F90",', line', 1514 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_ioclose ',"wrf_io.F90",', line', 1524 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_CLOSE(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_ioclose ',"wrf_io.F90",', line', 1532 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + CALL deallocHandle( DataHandle, Status ) + DH%Free=.true. + return +end subroutine ext_ncd_ioclose +subroutine ext_ncd_iosync( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_iosync ',"wrf_io.F90",', line', 1554 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ext_ncd_iosync ',"wrf_io.F90",', line', 1560 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ext_ncd_iosync ',"wrf_io.F90",', line', 1564 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + continue + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ext_ncd_iosync ',"wrf_io.F90",', line', 1572 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_SYNC(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ext_ncd_iosync ',"wrf_io.F90",', line', 1579 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + return +end subroutine ext_ncd_iosync +subroutine ext_ncd_redef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1601 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 1607 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 1611 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',"wrf_io.F90",', line', 1619 + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 1623 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1630 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_NOT_COMMITTED + return +end subroutine ext_ncd_redef +subroutine ext_ncd_enddef( DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle),pointer :: DH + integer :: stat + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 1651 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 1657 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 1661 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + continue + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_FILE_OPEN_FOR_READ + write(msg,*) 'Warning FILE OPEN FOR READ in ',"wrf_io.F90",', line', 1667 + call wrf_debug ( WARN , TRIM(msg)) + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 1671 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 1678 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%FileStatus = WRF_FILE_OPENED_FOR_WRITE + return +end subroutine ext_ncd_enddef +subroutine ext_ncd_ioinit(SysDepInfo, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + CHARACTER*(*), INTENT(IN) :: SysDepInfo + INTEGER ,INTENT(INOUT) :: Status + WrfIOnotInitialized = .false. + WrfDataHandles(1:WrfDataHandleMax)%Free = .true. + WrfDataHandles(1:WrfDataHandleMax)%TimesName = 'Times' + WrfDataHandles(1:WrfDataHandleMax)%DimUnlimName = 'Time' + WrfDataHandles(1:WrfDataHandleMax)%FileStatus = WRF_FILE_NOT_OPENED + if(trim(SysDepInfo) == "use_netcdf_classic" ) then + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .true. + else + WrfDataHandles(1:WrfDataHandleMax)%use_netcdf_classic = .false. + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_ioinit +subroutine ext_ncd_inquiry (Inquiry, Result, Status) + use wrf_data + implicit none + include 'wrf_status_codes.h' + character *(*), INTENT(IN) :: Inquiry + character *(*), INTENT(OUT) :: Result + integer ,INTENT(INOUT) :: Status + SELECT CASE (Inquiry) + CASE ("RANDOM_WRITE","RANDOM_READ","SEQUENTIAL_WRITE","SEQUENTIAL_READ") + Result='ALLOW' + CASE ("OPEN_READ","OPEN_COMMIT_WRITE") + Result='REQUIRE' + CASE ("OPEN_WRITE","OPEN_COMMIT_READ","PARALLEL_IO") + Result='NO' + CASE ("SELF_DESCRIBING","SUPPORT_METADATA","SUPPORT_3D_FIELDS") + Result='YES' + CASE ("MEDIUM") + Result ='FILE' + CASE DEFAULT + Result = 'No Result for that inquiry!' + END SELECT + Status=WRF_NO_ERR + return +end subroutine ext_ncd_inquiry +subroutine ext_ncd_ioexit(Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer , INTENT(INOUT) ::Status + integer :: error + type(wrf_data_handle),pointer :: DH + integer :: i + integer :: stat + if(WrfIOnotInitialized) then + Status = WRF_IO_NOT_INITIALIZED + write(msg,*) 'ext_ncd_ioinit was not called ',"wrf_io.F90",', line', 1749 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,WrfDataHandleMax + CALL deallocHandle( i , stat ) + enddo + return +end subroutine ext_ncd_ioexit +subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + real,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_REAL (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','REAL',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_real +subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + integer,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','INTEGER',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_integer +subroutine ext_ncd_get_dom_ti_double(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real*8,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + real*8,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','DOUBLE',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_double +subroutine ext_ncd_get_dom_ti_logical(DataHandle,Element,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCOunt + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + integer,allocatable :: Buffer(:) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Len), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 116 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len,Count)) = Buffer(1:min(Len,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= WRF_NO_ERR) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 138 + call wrf_debug ( FATAL , msg) + return + endif + if(Len > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','LOGICAL',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_logical +subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*),intent(out) :: Data + + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XType + integer :: Len + integer :: stat + + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 57 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to read time-independent domain metadata. +IF ( ncd_ok_to_get_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 66 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 71 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WRITE ONLY FILE in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 76 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_ATT(DH%NCID,NF_GLOBAL,Element, XType, Len) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 83,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 91 + call wrf_debug ( WARN , msg) + return + endif + else + if( XType/=NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 99 + call wrf_debug ( WARN , msg) + return + endif + endif + if(Len<=0) then + Status = WRF_WARN_LENGTH_LESS_THAN_1 + write(msg,*) & +'Warning LENGTH < 1 in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 107 + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_ATT_TEXT(DH%NCID,NF_GLOBAL,Element,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_dom_ti.code",' ','CHAR',', line', 153 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_get_dom_ti_char +subroutine ext_ncd_put_dom_ti_real(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real ,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_REAL (DH%NCID,NF_GLOBAL,Element,NF_FLOAT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_REAL (DH%NCID,NF_GLOBAL,Element,NF_FLOAT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','REAL',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_real +subroutine ext_ncd_put_dom_ti_integer(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + integer,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','INTEGER',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_integer +subroutine ext_ncd_put_dom_ti_double(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + real*8 ,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,NF_DOUBLE,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_DOUBLE (DH%NCID,NF_GLOBAL,Element,NF_DOUBLE,Count,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','DOUBLE',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_double +subroutine ext_ncd_put_dom_ti_logical(DataHandle,Element,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + logical,intent(in) :: Data(*) + integer,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 77 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 92 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 119 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 135 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','LOGICAL',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_logical +subroutine ext_ncd_put_dom_ti_char(DataHandle,Element,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*),intent(in) :: Data + integer,parameter :: Count=1 + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 56 + call wrf_debug ( WARN , msg) + return + endif +! Do nothing unless it is time to write time-independent domain metadata. +IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 65 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + STATUS = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 70 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + stat = NF_PUT_ATT_TEXT (DH%NCID,NF_GLOBAL,Element,len_trim(Data),Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 101,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_REDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 110,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_PUT_ATT_TEXT (DH%NCID,NF_GLOBAL,Element,len_trim(Data),Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_ENDDEF(DH%NCID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 153,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_dom_ti.code",' ','CHAR',', line', 160 + call wrf_debug ( FATAL , msg) + endif +ENDIF + return +end subroutine ext_ncd_put_dom_ti_char +subroutine ext_ncd_put_var_ti_real(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_REAL(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_FLOAT,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','REAL',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_real +subroutine ext_ncd_put_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_FLOAT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_REAL (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','REAL',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_real +subroutine ext_ncd_put_var_ti_double(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_DOUBLE(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_DOUBLE,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','DOUBLE',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_double +subroutine ext_ncd_put_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real*8,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_DOUBLE,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_DOUBLE (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','DOUBLE',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_double +subroutine ext_ncd_put_var_ti_integer(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_PUT_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_INT,Count,Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','INTEGER',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_integer +subroutine ext_ncd_put_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_INT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + stat = NF_PUT_VARA_INT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','INTEGER',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_integer +subroutine ext_ncd_put_var_ti_logical(DataHandle,Element,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 99 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), NF_INT,Count,Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 124 + call wrf_debug ( WARN , msg) + endif + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 132 + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','LOGICAL',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_logical +subroutine ext_ncd_put_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == Count) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Count,DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = Count + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = Count + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_INT,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(Count > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(Count < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Count + VCount(2) = 1 + allocate(Buffer(Count), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 196 + call wrf_debug ( FATAL , msg) + return + endif + do i=1,Count + if(data(i)) then + Buffer(i)=1 + else + Buffer(i)=0 + endif + enddo + stat = NF_PUT_VARA_INT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Buffer) + deallocate(Buffer, STAT=stat2) + if(stat2/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 212 + call wrf_debug ( FATAL , msg) + return + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','LOGICAL',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_logical +subroutine ext_ncd_put_var_ti_char(DataHandle,Element,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(in) :: Data + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: NVar + character*1 :: null + null=char(0) + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 61 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 68 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 73 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_MD_AFTER_OPEN + write(msg,*) & +'Warning WRITE METADATA AFTER OPEN in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 78 + call wrf_debug ( WARN , msg) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(TRIM(DH%VarNames(NVar)) == TRIM(VarName)) then + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 88 & + ,NVar,VarName + call wrf_debug ( WARN , msg) + return + endif + enddo + if(len_trim(Data).le.0) then + stat = NF_PUT_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element),len_trim(null),null) + else + stat = NF_PUT_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element), len_trim(Data),trim(Data) ) + endif + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error for Var ',TRIM(Var),& + ' Element ',trim(Element),' in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 124 + call wrf_debug ( WARN , msg) + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_ti.code",' ','CHAR',', line', 140 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_ti_char +subroutine ext_ncd_put_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + character*(*) ,intent(in) :: Data + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + integer :: stat + integer :: stat2 + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 67 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 74 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 82 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 89 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) & +'Warning WRITE READ ONLY FILE in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 94 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + if(len(Data) < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + return + endif + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + return + elseif(DH%MDVarNames(NVar) == NO_NAME) then + DH%MDVarNames(NVar) = Name + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 111 + call wrf_debug ( WARN , msg) + return + endif + enddo + do i=1,MaxDims + if(DH%DimLengths(i) == len(Data)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),len(Data),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 124,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + DH%DimLengths(i) = len(Data) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) & +'Warning TOO MANY DIMENSIONS in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 133 + call wrf_debug ( WARN , msg) + return + endif + enddo + DH%MDVarDimLens(NVar) = len(Data) + VDims(1) = DH%DimIDs(i) + VDims(2) = DH%DimUnlimID + stat = NF_DEF_VAR(NCID,Name,NF_CHAR,2,VDims,DH%MDVarIDs(NVar)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 145,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + do NVar=1,MaxVars + if(DH%MDVarNames(NVar) == Name) then + exit + elseif(DH%MDVarNames(NVar) == NO_NAME) then + Status = WRF_WARN_MD_NF + write(msg,*) & +'Warning METADATA NOT FOUND in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 156 + call wrf_debug ( WARN , msg) + return + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) & +'Warning TOO MANY VARIABLES in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 162 + call wrf_debug ( WARN , msg) + return + endif + enddo + if(len(Data) > DH%MDVarDimLens(NVar)) then + Status = WRF_WARN_COUNT_TOO_LONG + write(msg,*) & +'Warning COUNT TOO LONG in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 170 + call wrf_debug ( WARN , msg) + return + elseif(len(Data) < 1) then + Status = WRF_WARN_ZERO_LENGTH_PUT + write(msg,*) & +'Warning ZERO LENGTH PUT in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 176 + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('write',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 183 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = len(Data) + VCount(2) = 1 + stat = NF_PUT_VARA_TEXT (NCID,DH%MDVarIDs(NVar),VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 222,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_put_var_td.code",' ','CHAR',', line', 229 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_put_var_td_char +subroutine ext_ncd_get_var_ti_real(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + real ,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_REAL(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','REAL',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_real +subroutine ext_ncd_get_var_td_real(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + real ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_FLOAT == NF_DOUBLE .OR. NF_FLOAT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_FLOAT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_REAL (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','REAL',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_real +subroutine ext_ncd_get_var_ti_double(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + real*8 ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + real*8 ,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_DOUBLE(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','DOUBLE',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_double +subroutine ext_ncd_get_var_td_double(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + real*8 ,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + real*8 ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_DOUBLE == NF_DOUBLE .OR. NF_DOUBLE == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_DOUBLE) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_DOUBLE (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','DOUBLE',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_double +subroutine ext_ncd_get_var_ti_integer(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + integer,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','INTEGER',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_integer +subroutine ext_ncd_get_var_td_integer(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_INT (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count)) + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','INTEGER',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_integer +subroutine ext_ncd_get_var_ti_logical(DataHandle,Element,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + integer,allocatable :: Buffer(:) + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + allocate(Buffer(XLen), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 128 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,DH%VarIDs(NVar),trim(Element), Buffer ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + Data(1:min(XLen,Count)) = Buffer(1:min(XLen,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 155 + call wrf_debug ( FATAL , msg) + return + endif + if(XLen > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = XLen + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','LOGICAL',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_logical +subroutine ext_ncd_get_var_td_logical(DataHandle,Element,DateStr,Var,Data,Count,OutCount,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + logical,intent(out) :: Data(*) + integer,intent(in) :: Count + integer,intent(out) :: OutCount + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + integer ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_INT == NF_DOUBLE .OR. NF_INT == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = min(Count,Len1) + VCount(2) = 1 + allocate(Buffer(VCount(1)), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) & +'Fatal ALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 180 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_GET_VARA_INT (NCID,VarID,VStart,VCount,Buffer) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + Data(1:min(Len1,Count)) = Buffer(1:min(Len1,Count))==1 + deallocate(Buffer, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) & +'Fatal DEALLOCATION ERROR in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 209 + call wrf_debug ( FATAL , msg) + return + endif + if(Len1 > Count) then + OutCount = Count + Status = WRF_WARN_MORE_DATA_IN_FILE + else + OutCount = Len1 + Status = WRF_NO_ERR + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','LOGICAL',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_logical +subroutine ext_ncd_get_var_ti_char(DataHandle,Element,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Data + integer :: Count = 1 + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: XLen + + character (VarNameLen) :: VarName + integer :: stat + integer :: NVar + integer :: XType + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 60 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 68 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 75 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 80 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 85 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) & +'Warning VARIABLE NOT FOUND in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 94 + call wrf_debug ( WARN , msg) + return + endif + enddo + stat = NF_INQ_ATT(DH%NCID,DH%VarIDs(NVar),trim(Element),XType,XLen) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 103,' Element ',Element + call wrf_debug ( WARN , msg) + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 110 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 118 + call wrf_debug ( WARN , msg) + return + endif + endif + if(XLen > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 137 + call wrf_debug ( WARN , msg) + return + endif + stat = NF_GET_ATT_TEXT(DH%NCID,DH%VarIDs(NVar),trim(Element), Data ) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 146,' Element ',Element + call wrf_debug ( WARN , msg) + endif + + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_ti.code",' ','CHAR',', line', 170 + call wrf_debug ( FATAL , msg) + return + endif + return +end subroutine ext_ncd_get_var_ti_char +subroutine ext_ncd_get_var_td_char(DataHandle,Element,DateStr,Var,Data,Status) +!*------------------------------------------------------------------------------ +!* Standard Disclaimer +!* +!* Forecast Systems Laboratory +!* NOAA/OAR/ERL/FSL +!* 325 Broadway +!* Boulder, CO 80303 +!* +!* AVIATION DIVISION +!* ADVANCED COMPUTING BRANCH +!* SMS/NNT Version: 2.0.0 +!* +!* This software and its documentation are in the public domain and +!* are furnished "as is". The United States government, its +!* instrumentalities, officers, employees, and agents make no +!* warranty, express or implied, as to the usefulness of the software +!* and documentation for any purpose. They assume no +!* responsibility (1) for the use of the software and documentation; +!* or (2) to provide technical support to users. +!* +!* Permission to use, copy, modify, and distribute this software is +!* hereby granted, provided that this disclaimer notice appears in +!* all copies. All modifications to this software must be clearly +!* documented, and are solely the responsibility of the agent making +!* the modification. If significant modifications or enhancements +!* are made to this software, the SMS Development team +!* (sms-info@fsl.noaa.gov) should be notified. +!* +!*---------------------------------------------------------------------------- +!* +!* WRF NetCDF I/O +! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov +!* Date: October 6, 2000 +!* +!*---------------------------------------------------------------------------- + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character (DateStrLen),intent(in) :: DateStr + character*(*) ,intent(in) :: Var + character*(*) ,intent(out) :: Data + integer :: Count = 1 + + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + character (VarNameLen) :: VarName + character (40+len(Element)) :: Name + character (40+len(Element)) :: FName + integer :: stat + character (80) ,allocatable :: Buffer(:) + integer :: i + integer :: VDims (2) + integer :: VStart(2) + integer :: VCount(2) + integer :: NVar + integer :: TimeIndex + integer :: NCID + integer :: DimIDs(2) + integer :: VarID + integer :: XType + integer :: NDims + integer :: NAtts + integer :: Len1 + if(Count <= 0) then + Status = WRF_WARN_ZERO_LENGTH_GET + write(msg,*) & +'Warning ZERO LENGTH GET in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 73 + call wrf_debug ( WARN , msg) + return + endif + VarName = Var + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning DATE STRING ERROR in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 81 + call wrf_debug ( WARN , msg) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 88 + call wrf_debug ( WARN , msg) + return + endif + NCID = DH%NCID + call GetName(Element, VarName, Name, Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning Status = ',Status,' in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 96 + call wrf_debug ( WARN , msg) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) & +'Warning FILE NOT OPENED in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 103 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) & +'Warning DRYRUN READ in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 108 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) & +'Warning READ WONLY FILE in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 113 + call wrf_debug ( WARN , msg) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + stat = NF_INQ_VARID(NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 120,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + stat = NF_INQ_VAR(NCID,VarID,FName,XType,NDims,DimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 128,' Element ',Element + call wrf_debug ( WARN , msg) + return + endif + if ( NF_CHAR == NF_DOUBLE .OR. NF_CHAR == NF_FLOAT ) then + if( .NOT. ( XType==NF_FLOAT .OR. XType==NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 136 + call wrf_debug ( WARN , msg) + return + endif + else + if(XType /= NF_CHAR) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) & +'Warning TYPE MISMATCH in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 144 + call wrf_debug ( WARN , msg) + return + endif + endif + if(NDims /= NMDVarDims) then + Status = WRF_ERR_FATAL_MDVAR_DIM_NOT_1D + write(msg,*) & +'Fatal MDVAR DIM NOT 1D in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 152 + call wrf_debug ( FATAL , msg) + return + endif + stat = NF_INQ_DIMLEN(NCID,DimIDs(1),Len1) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 160,' DimIDs(1) ',DimIDs(1) + call wrf_debug ( WARN , msg) + return + endif + call GetTimeIndex('read',DataHandle,DateStr,TimeIndex,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'Warning in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 167 + call wrf_debug ( WARN , msg) + return + endif + VStart(1) = 1 + VStart(2) = TimeIndex + VCount(1) = Len1 + VCount(2) = 1 + if(Len1 > len(Data)) then + Status = WRF_WARN_CHARSTR_GT_LENDATA + write(msg,*) & +'Warning LEN CHAR STRING > LEN DATA in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 189 + call wrf_debug ( WARN , msg) + return + endif + Data = '' + stat = NF_GET_VARA_TEXT (NCID,VarID,VStart,VCount,Data) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) & +'NetCDF error in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 199 + call wrf_debug ( WARN , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) & +'Fatal error BAD FILE STATUS in ',"ext_ncd_get_var_td.code",' ','CHAR',', line', 224 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_td_char +subroutine ext_ncd_put_dom_td_real(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_real +subroutine ext_ncd_put_dom_td_integer(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_integer +subroutine ext_ncd_put_dom_td_double(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_double +subroutine ext_ncd_put_dom_td_logical(DataHandle,Element,DateStr,Data,Count,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(in) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: Status + call ext_ncd_put_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,Status) + return +end subroutine ext_ncd_put_dom_td_logical +subroutine ext_ncd_put_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Data + integer ,intent(out) :: Status + call ext_ncd_put_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_put_dom_td_char +subroutine ext_ncd_get_dom_td_real(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_real(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_real +subroutine ext_ncd_get_dom_td_integer(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_integer(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_integer +subroutine ext_ncd_get_dom_td_double(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + real*8 ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_double(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_double +subroutine ext_ncd_get_dom_td_logical(DataHandle,Element,DateStr,Data,Count,OutCount,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + logical ,intent(out) :: Data(*) + integer ,intent(in) :: Count + integer ,intent(out) :: OutCount + integer ,intent(out) :: Status + call ext_ncd_get_var_td_logical(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Count,OutCount,Status) + return +end subroutine ext_ncd_get_dom_td_logical +subroutine ext_ncd_get_dom_td_char(DataHandle,Element,DateStr,Data,Status) + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Element + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(out) :: Data + integer ,intent(out) :: Status + call ext_ncd_get_var_td_char(DataHandle,Element,DateStr, & + 'E_X_T_D_O_M_A_I_N_M_E_T_A_DATA_' ,Data,Status) + return +end subroutine ext_ncd_get_dom_td_char +subroutine ext_ncd_write_field(DataHandle,DateStr,Var,Field,FieldTypeIn, & + Comm, IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(inout) :: Field(*) + integer ,intent(in) :: FieldTypeIn + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) ,dimension(*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + integer :: FieldType + character (3) :: MemoryOrder + type(wrf_data_handle) ,pointer :: DH + integer :: NCID + integer :: NDim + character (VarNameLen) :: VarName + character (3) :: MemO + character (3) :: UCMemO + integer :: VarID + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + character(80),dimension(NVarDims) :: RODimNames + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(:,:,:,:),allocatable :: XField + integer :: stat + integer :: NVar + integer :: i,j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + integer :: XType + integer :: di + character (80) :: NullName + logical :: NotFound + MemoryOrder = trim(adjustl(MemoryOrdIn)) + NullName=char(0) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',MemoryOrder,'| in ',"wrf_io.F90",', line', 2482 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',DateStr,'| in ',"wrf_io.F90",', line', 2489 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 2496 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + NCID = DH%NCID + if ( DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE ) then + FieldType = WRF_REAL + else + FieldType = FieldTypeIn + end if + write(msg,*)'ext_ncd_write_field: called for ',TRIM(Var) +!jm 010827 Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + IF ( ZeroLengthHorzDim(MemoryOrder,Length,Status) ) THEN + write(msg,*)'ext_ncd_write_field: zero length dimension in ',TRIM(Var),'. Ignoring' + call wrf_debug ( WARN , TRIM(msg)) + return + ENDIF + call ExtOrder(MemoryOrder,Length,Status) + call ExtOrderStr(MemoryOrder,DimNames,RODimNames,Status) + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 2533 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + Status = WRF_WARN_WRITE_RONLY_FILE + write(msg,*) 'Warning WRITE READ ONLY FILE in ',"wrf_io.F90",', line', 2537 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + do NVar=1,MaxVars + if(DH%VarNames(NVar) == VarName ) then + Status = WRF_WARN_2DRYRUNS_1VARIABLE + write(msg,*) 'Warning 2 DRYRUNS 1 VARIABLE in ',"wrf_io.F90",', line', 2543 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%VarNames(NVar) == NO_NAME) then + DH%VarNames(NVar) = VarName + DH%NumVars = NVar + exit + elseif(NVar == MaxVars) then + Status = WRF_WARN_TOO_MANY_VARIABLES + write(msg,*) 'Warning TOO MANY VARIABLES in ',"wrf_io.F90",', line', 2552 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + do j = 1,NDim + if(RODimNames(j) == NullName .or. RODimNames(j) == '') then + do i=1,MaxDims + if(DH%DimLengths(i) == Length(j)) then + exit + elseif(DH%DimLengths(i) == NO_DIM) then + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2566 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',"wrf_io.F90",', line', 2574 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else !look for input name and check if already defined + NotFound = .true. + do i=1,MaxDims + if (DH%DimNames(i) == RODimNames(j)) then + if (DH%DimLengths(i) == Length(j)) then + NotFound = .false. + exit + else + Status = WRF_WARN_DIMNAME_REDEFINED + write(msg,*) 'Warning DIM ',i,', NAME ',TRIM(DH%DimNames(i)),' REDEFINED by var ', & + TRIM(Var),' ',DH%DimLengths(i),Length(j) ,' in ', "wrf_io.F90" ,' line', 2589 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + endif + enddo + if (NotFound) then + do i=1,MaxDims + if (DH%DimLengths(i) == NO_DIM) then + DH%DimNames(i) = RODimNames(j) + stat = NF_DEF_DIM(NCID,DH%DimNames(i),Length(j),DH%DimIDs(i)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2602 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%DimLengths(i) = Length(j) + exit + elseif(i == MaxDims) then + Status = WRF_WARN_TOO_MANY_DIMS + write(msg,*) 'Warning TOO MANY DIMENSIONS in ',"wrf_io.F90",', line', 2610 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + endif + endif + VDimIDs(j) = DH%DimIDs(i) + DH%VarDimLens(j,NVar) = Length(j) + enddo + VDimIDs(NDim+1) = DH%DimUnlimID + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN + XType = NF_FLOAT + ELSE IF (FieldType == WRF_DOUBLE) THEN + Xtype = NF_DOUBLE + ELSE IF (FieldType == WRF_INTEGER) THEN + XType = NF_INT + ELSE IF (FieldType == WRF_LOGICAL) THEN + XType = NF_INT + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 2633 + call wrf_debug ( WARN , TRIM(msg)) + return + END IF + stat = NF_DEF_VAR(NCID,VarName,XType,NDim+1,VDimIDs,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error for ',TRIM(VarName),' in ',"wrf_io.F90",', line', 2641 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + DH%VarIDs(NVar) = VarID + stat = NF_PUT_ATT_INT(NCID,VarID,'FieldType',NF_INT,1,FieldType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',"wrf_io.F90",', line', 2697 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call reorder(MemoryOrder,MemO) + call uppercase(MemO,UCMemO) + stat = NF_PUT_ATT_TEXT(NCID,VarID,'MemoryOrder',3,UCMemO) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'ext_ncd_write_field: NetCDF error in ',"wrf_io.F90",', line', 2706 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + do NVar=1,DH%NumVars + if(DH%VarNames(NVar) == VarName) then + exit + elseif(NVar == DH%NumVars) then + Status = WRF_WARN_VAR_NF + write(msg,*) 'Warning VARIABLE NOT FOUND in ',"wrf_io.F90",', line', 2716 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + VarID = DH%VarIDs(NVar) + do j=1,NDim + if(Length(j) /= DH%VarDimLens(j,NVar) .AND. DH%FileStatus /= WRF_FILE_OPENED_FOR_UPDATE ) then + Status = WRF_WARN_WRTLEN_NE_DRRUNLEN + write(msg,*) 'Warning LENGTH != DRY RUN LENGTH for |', & + VarName,'| dim ',j,' in ',"wrf_io.F90",', line', 2726 + call wrf_debug ( WARN , TRIM(msg)) + write(msg,*) ' LENGTH ',Length(j),' DRY RUN LENGTH ',DH%VarDimLens(j,NVar) + call wrf_debug ( WARN , TRIM(msg)) + return +!jm 010825 elseif(DomainStart(j) < MemoryStart(j)) then + elseif(PatchStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning DIMENSION ERROR for |',VarName, & + '| in ',"wrf_io.F90",', line', 2735 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,Length ,x1,x2,y1,y2,z1,z2) + call GetIndices(NDim,PatchStart, PatchEnd ,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 2749 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + if (DH%R4OnOutput .and. FieldTypeIn == WRF_DOUBLE) then + call TransposeToR4('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + else + call Transpose('write',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + end if + call FieldIO('write',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 2765 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 2772 + call wrf_debug ( FATAL , TRIM(msg)) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 2778 + call wrf_debug ( FATAL , TRIM(msg)) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_write_field +subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & + IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + character*(*) ,intent(in) :: Var + integer ,intent(out) :: Field(*) + integer ,intent(in) :: FieldType + integer ,intent(inout) :: Comm + integer ,intent(inout) :: IOComm + integer ,intent(in) :: DomainDesc + character*(*) ,intent(in) :: MemoryOrdIn + character*(*) ,intent(in) :: Stagger ! Dummy for now + character*(*) , dimension (*) ,intent(in) :: DimNames + integer ,dimension(*) ,intent(in) :: DomainStart, DomainEnd + integer ,dimension(*) ,intent(in) :: MemoryStart, MemoryEnd + integer ,dimension(*) ,intent(in) :: PatchStart, PatchEnd + integer ,intent(out) :: Status + character (3) :: MemoryOrder + character (NF_MAX_NAME) :: dimname + type(wrf_data_handle) ,pointer :: DH + integer :: NDim + integer :: NCID + character (VarNameLen) :: VarName + integer :: VarID + integer ,dimension(NVarDims) :: VCount + integer ,dimension(NVarDims) :: VStart + integer ,dimension(NVarDims) :: Length + integer ,dimension(NVarDims) :: VDimIDs + integer ,dimension(NVarDims) :: MemS + integer ,dimension(NVarDims) :: MemE + integer ,dimension(NVarDims) :: StoredStart + integer ,dimension(NVarDims) :: StoredLen + integer ,dimension(:,:,:,:) ,allocatable :: XField + integer :: NVar + integer :: j + integer :: i1,i2,j1,j2,k1,k2 + integer :: x1,x2,y1,y2,z1,z2 + integer :: l1,l2,m1,m2,n1,n2 + character (VarNameLen) :: Name + integer :: XType + integer :: StoredDim + integer :: NAtts + integer :: Len + integer :: stat + integer :: di + integer :: FType + MemoryOrder = trim(adjustl(MemoryOrdIn)) + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER |',TRIM(MemoryOrder),'| for |', & + TRIM(Var),'| in ext_ncd_read_field ',"wrf_io.F90",', line', 2842 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR |',TRIM(DateStr),'| for |',TRIM(Var), & + '| in ext_ncd_read_field ',"wrf_io.F90",', line', 2849 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + VarName = Var + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ext_ncd_read_field ',"wrf_io.F90",', line', 2856 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 2862 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then +! jm it is okay to have a dry run read. means read is called between ofrb and ofrc. Just return. +! Status = WRF_WARN_DRYRUN_READ +! write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 2867 +! call wrf_debug ( WARN , TRIM(msg)) + Status = WRF_NO_ERR + RETURN + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 2873 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + NCID = DH%NCID +!jm Length(1:NDim) = DomainEnd(1:NDim)-DomainStart(1:NDim)+1 + Length(1:NDim) = PatchEnd(1:NDim)-PatchStart(1:NDim)+1 + call ExtOrder(MemoryOrder,Length,Status) + stat = NF_INQ_VARID(NCID,VarName,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2884,' Varname ',Varname + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VAR(NCID,VarID,Name,XType,StoredDim,VDimIDs,NAtts) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2891 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(NCID,VarID,'FieldType',FType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2898 + call wrf_debug ( WARN , TRIM(msg)) + return + endif +! allow coercion between double and single prec real +!jm if(FieldType /= Ftype) then + if( (FieldType == WRF_REAL .OR. FieldType == WRF_DOUBLE) ) then + if ( .NOT. (Ftype == WRF_REAL .OR. Ftype == WRF_DOUBLE )) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 2907 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + else if(FieldType /= Ftype) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning TYPE MISMATCH in ',"wrf_io.F90",', line', 2913 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! Do not use SELECT statement here as sometimes WRF_REAL=WRF_DOUBLE + IF (FieldType == WRF_REAL) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning REAL TYPE MISMATCH in ',"wrf_io.F90",', line', 2923 + endif + ELSE IF (FieldType == WRF_DOUBLE) THEN +! allow coercion between double and single prec real + if(.NOT. (XType == NF_FLOAT .OR. XType == NF_DOUBLE) ) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning DOUBLE TYPE MISMATCH in ',"wrf_io.F90",', line', 2929 + endif + ELSE IF (FieldType == WRF_INTEGER) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning INTEGER TYPE MISMATCH in ',"wrf_io.F90",', line', 2934 + endif + ELSE IF (FieldType == WRF_LOGICAL) THEN + if(XType /= NF_INT) then + Status = WRF_WARN_TYPE_MISMATCH + write(msg,*) 'Warning LOGICAL TYPE MISMATCH in ',"wrf_io.F90",', line', 2939 + endif + ELSE + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 2943 + END IF + if(Status /= WRF_NO_ERR) then + call wrf_debug ( WARN , TRIM(msg)) + return + endif + ! NDim=0 for scalars. Handle read of old NDim=1 files. TBH: 20060502 + IF ( ( NDim == 0 ) .AND. ( StoredDim == 2 ) ) THEN + stat = NF_INQ_DIMNAME(NCID,VDimIDs(1),dimname) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2955 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + IF ( dimname(1:10) == 'ext_scalar' ) THEN + NDim = 1 + Length(1) = 1 + ENDIF + ENDIF + if(StoredDim /= NDim+1) then + Status = WRF_ERR_FATAL_BAD_VARIABLE_DIM + write(msg,*) 'Fatal error BAD VARIABLE DIMENSION in ext_ncd_read_field ',TRIM(Var),TRIM(DateStr) + call wrf_debug ( FATAL , msg) + write(msg,*) ' StoredDim ', StoredDim, ' .NE. NDim+1 ', NDim+1 + call wrf_debug ( FATAL , msg) + return + endif + do j=1,NDim + stat = NF_INQ_DIMLEN(NCID,VDimIDs(j),StoredLen(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 2976 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(Length(j) > StoredLen(j)) then + Status = WRF_WARN_READ_PAST_EOF + write(msg,*) 'Warning READ PAST EOF in ext_ncd_read_field of ',TRIM(Var),Length(j),'>',StoredLen(j) + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(Length(j) <= 0) then + Status = WRF_WARN_ZERO_LENGTH_READ + write(msg,*) 'Warning ZERO LENGTH READ in ',"wrf_io.F90",', line', 2987 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DomainStart(j) < MemoryStart(j)) then + Status = WRF_WARN_DIMENSION_ERROR + write(msg,*) 'Warning dim ',j,' DomainStart (',DomainStart(j), & + ') < MemoryStart (',MemoryStart(j),') in ',"wrf_io.F90",', line', 2993 + call wrf_debug ( WARN , TRIM(msg)) +! return + endif + enddo + StoredStart = 1 + call GetIndices(NDim,MemoryStart,MemoryEnd,l1,l2,m1,m2,n1,n2) + call GetIndices(NDim,StoredStart,StoredLen,x1,x2,y1,y2,z1,z2) +!jm call GetIndices(NDim,DomainStart,DomainEnd,i1,i2,j1,j2,k1,k2) + call GetIndices(NDim,PatchStart,PatchEnd,i1,i2,j1,j2,k1,k2) + di=1 + if(FieldType == WRF_DOUBLE) di=2 + allocate(XField(di,x1:x2,y1:y2,z1:z2), STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_ALLOCATION_ERROR + write(msg,*) 'Fatal ALLOCATION ERROR in ',"wrf_io.F90",', line', 3010 + call wrf_debug ( FATAL , msg) + return + endif + call FieldIO('read',DataHandle,DateStr,Length,MemoryOrder, & + FieldType,NCID,VarID,XField,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3017 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call Transpose('read',MemoryOrder,di, Field,l1,l2,m1,m2,n1,n2 & + ,XField,x1,x2,y1,y2,z1,z2 & + ,i1,i2,j1,j2,k1,k2 ) + deallocate(XField, STAT=stat) + if(stat/= 0) then + Status = WRF_ERR_FATAL_DEALLOCATION_ERR + write(msg,*) 'Fatal DEALLOCATION ERROR in ',"wrf_io.F90",', line', 3027 + call wrf_debug ( FATAL , msg) + return + endif + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3033 + call wrf_debug ( FATAL , msg) + endif + DH%first_operation = .FALSE. + return +end subroutine ext_ncd_read_field +subroutine ext_ncd_inquire_opened( DataHandle, FileName , FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(inout) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + !call upgrade_filename(FileName) + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + FileStatus = WRF_FILE_NOT_OPENED + return + endif + if(trim(FileName) /= trim(DH%FileName)) then + FileStatus = WRF_FILE_NOT_OPENED + else + FileStatus = DH%FileStatus + endif + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_opened +subroutine ext_ncd_inquire_filename( Datahandle, FileName, FileStatus, Status ) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: FileName + integer ,intent(out) :: FileStatus + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + FileStatus = WRF_FILE_NOT_OPENED + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3080 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + FileName = trim(DH%FileName) + FileStatus = DH%FileStatus + Status = WRF_NO_ERR + return +end subroutine ext_ncd_inquire_filename +subroutine ext_ncd_set_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: i + call DateCheck(DateStr,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning DATE STRING ERROR in ',"wrf_io.F90",', line', 3103 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3109 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3115 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_FILE_NOT_COMMITTED + write(msg,*) 'Warning FILE NOT COMMITTED in ',"wrf_io.F90",', line', 3119 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3123 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + do i=1,MaxTimes + if(DH%Times(i)==DateStr) then + DH%CurrentTime = i + exit + endif + if(i==MaxTimes) then + Status = WRF_WARN_TIME_NF + return + endif + enddo + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3140 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_set_time +subroutine ext_ncd_get_next_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3158 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3164 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3168 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3172 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE ) then + if(DH%CurrentTime >= DH%NumberTimes) then + Status = WRF_WARN_TIME_EOF + return + endif + DH%CurrentTime = DH%CurrentTime +1 + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'DH%FileStatus ',DH%FileStatus + call wrf_debug ( FATAL , msg) + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3187 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_time +subroutine ext_ncd_get_previous_time(DataHandle, DateStr, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: DateStr + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3205 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3211 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3215 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3219 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ) then + if(DH%CurrentTime.GT.0) then + DH%CurrentTime = DH%CurrentTime -1 + endif + DateStr = DH%Times(DH%CurrentTime) + DH%CurrentVariable = 0 + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3230 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_previous_time +subroutine ext_ncd_get_next_var(DataHandle, VarName, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'wrf_status_codes.h' + include 'netcdf.inc' + integer ,intent(in) :: DataHandle + character*(*) ,intent(out) :: VarName + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: stat + character (80) :: Name + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3251 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3257 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3261 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3265 + call wrf_debug ( WARN , TRIM(msg)) + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + DH%CurrentVariable = DH%CurrentVariable +1 + if(DH%CurrentVariable > DH%NumVars) then + Status = WRF_WARN_VAR_EOF + return + endif + VarName = DH%VarNames(DH%CurrentVariable) + Status = WRF_NO_ERR + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3278 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_next_var +subroutine ext_ncd_end_of_frame(DataHandle, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + call GetDH(DataHandle,DH,Status) + return +end subroutine ext_ncd_end_of_frame +! NOTE: For scalar variables NDim is set to zero and DomainStart and +! NOTE: DomainEnd are left unmodified. +subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder,Stagger,DomainStart,DomainEnd,WrfType,Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer ,intent(in) :: DataHandle + character*(*) ,intent(in) :: Name + integer ,intent(out) :: NDim + character*(*) ,intent(out) :: MemoryOrder + character*(*) :: Stagger ! Dummy for now + integer ,dimension(*) ,intent(out) :: DomainStart, DomainEnd + integer ,intent(out) :: WrfType + integer ,intent(out) :: Status + type(wrf_data_handle) ,pointer :: DH + integer :: VarID + integer ,dimension(NVarDims) :: VDimIDs + integer :: j + integer :: stat + integer :: XType + call GetDH(DataHandle,DH,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning Status = ',Status,' in ',"wrf_io.F90",', line', 3323 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + if(DH%FileStatus == WRF_FILE_NOT_OPENED) then + Status = WRF_WARN_FILE_NOT_OPENED + write(msg,*) 'Warning FILE NOT OPENED in ',"wrf_io.F90",', line', 3329 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_NOT_COMMITTED) then + Status = WRF_WARN_DRYRUN_READ + write(msg,*) 'Warning DRYRUN READ in ',"wrf_io.F90",', line', 3334 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then + Status = WRF_WARN_READ_WONLY_FILE + write(msg,*) 'Warning READ WRITE ONLY FILE in ',"wrf_io.F90",', line', 3339 + call wrf_debug ( WARN , TRIM(msg)) + return + elseif(DH%FileStatus == WRF_FILE_OPENED_FOR_READ .OR. DH%FileStatus == WRF_FILE_OPENED_FOR_UPDATE) then + stat = NF_INQ_VARID(DH%NCID,Name,VarID) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3346 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARTYPE(DH%NCID,VarID,XType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3353 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_GET_ATT_INT(DH%NCID,VarID,'FieldType',WrfType) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3360 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + select case (XType) + case (NF_BYTE) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BYTE IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3367 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_CHAR) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning CHAR IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3372 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_SHORT) + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning SHORT IS BAD DATA TYPE in ',"wrf_io.F90",', line', 3377 + call wrf_debug ( WARN , TRIM(msg)) + return + case (NF_INT) + if(WrfType /= WRF_INTEGER .and. WrfType /= WRF_LOGICAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3383 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_FLOAT) + if(WrfType /= WRF_REAL) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3390 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case (NF_DOUBLE) + if(WrfType /= WRF_DOUBLE) then + Status = WRF_WARN_BAD_DATA_TYPE + write(msg,*) 'Warning BAD DATA TYPE in ',"wrf_io.F90",', line', 3397 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + case default + Status = WRF_WARN_DATA_TYPE_NOT_FOUND + write(msg,*) 'Warning DATA TYPE NOT FOUND in ',"wrf_io.F90",', line', 3403 + call wrf_debug ( WARN , TRIM(msg)) + return + end select + stat = NF_GET_ATT_TEXT(DH%NCID,VarID,'MemoryOrder',MemoryOrder) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3411 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + call GetDim(MemoryOrder,NDim,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'Warning BAD MEMORY ORDER ',TRIM(MemoryOrder),' in ',"wrf_io.F90",', line', 3417 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + stat = NF_INQ_VARDIMID(DH%NCID,VarID,VDimIDs) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3424 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + do j = 1, NDim + DomainStart(j) = 1 + stat = NF_INQ_DIMLEN(DH%NCID,VDimIDs(j),DomainEnd(j)) + call netcdf_err(stat,Status) + if(Status /= WRF_NO_ERR) then + write(msg,*) 'NetCDF error in ',"wrf_io.F90",', line', 3433 + call wrf_debug ( WARN , TRIM(msg)) + return + endif + enddo + else + Status = WRF_ERR_FATAL_BAD_FILE_STATUS + write(msg,*) 'Fatal error BAD FILE STATUS in ',"wrf_io.F90",', line', 3440 + call wrf_debug ( FATAL , msg) + endif + return +end subroutine ext_ncd_get_var_info +subroutine ext_ncd_warning_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + SELECT CASE (Code) + CASE (0) + ReturnString='No error' + Status=WRF_NO_ERR + return + CASE (-1) + ReturnString= 'File not found (or file is incomplete)' + Status=WRF_NO_ERR + return + CASE (-2) + ReturnString='Metadata not found' + Status=WRF_NO_ERR + return + CASE (-3) + ReturnString= 'Timestamp not found' + Status=WRF_NO_ERR + return + CASE (-4) + ReturnString= 'No more timestamps' + Status=WRF_NO_ERR + return + CASE (-5) + ReturnString= 'Variable not found' + Status=WRF_NO_ERR + return + CASE (-6) + ReturnString= 'No more variables for the current time' + Status=WRF_NO_ERR + return + CASE (-7) + ReturnString= 'Too many open files' + Status=WRF_NO_ERR + return + CASE (-8) + ReturnString= 'Data type mismatch' + Status=WRF_NO_ERR + return + CASE (-9) + ReturnString= 'Attempt to write read-only file' + Status=WRF_NO_ERR + return + CASE (-10) + ReturnString= 'Attempt to read write-only file' + Status=WRF_NO_ERR + return + CASE (-11) + ReturnString= 'Attempt to access unopened file' + Status=WRF_NO_ERR + return + CASE (-12) + ReturnString= 'Attempt to do 2 trainings for 1 variable' + Status=WRF_NO_ERR + return + CASE (-13) + ReturnString= 'Attempt to read past EOF' + Status=WRF_NO_ERR + return + CASE (-14) + ReturnString= 'Bad data handle' + Status=WRF_NO_ERR + return + CASE (-15) + ReturnString= 'Write length not equal to training length' + Status=WRF_NO_ERR + return + CASE (-16) + ReturnString= 'More dimensions requested than training' + Status=WRF_NO_ERR + return + CASE (-17) + ReturnString= 'Attempt to read more data than exists' + Status=WRF_NO_ERR + return + CASE (-18) + ReturnString= 'Input dimensions inconsistent' + Status=WRF_NO_ERR + return + CASE (-19) + ReturnString= 'Input MemoryOrder not recognized' + Status=WRF_NO_ERR + return + CASE (-20) + ReturnString= 'A dimension name with 2 different lengths' + Status=WRF_NO_ERR + return + CASE (-21) + ReturnString= 'String longer than provided storage' + Status=WRF_NO_ERR + return + CASE (-22) + ReturnString= 'Function not supportable' + Status=WRF_NO_ERR + return + CASE (-23) + ReturnString= 'Package implements this routine as NOOP' + Status=WRF_NO_ERR + return +!netcdf-specific warning messages + CASE (-1007) + ReturnString= 'Bad data type' + Status=WRF_NO_ERR + return + CASE (-1008) + ReturnString= 'File not committed' + Status=WRF_NO_ERR + return + CASE (-1009) + ReturnString= 'File is opened for reading' + Status=WRF_NO_ERR + return + CASE (-1011) + ReturnString= 'Attempt to write metadata after open commit' + Status=WRF_NO_ERR + return + CASE (-1010) + ReturnString= 'I/O not initialized' + Status=WRF_NO_ERR + return + CASE (-1012) + ReturnString= 'Too many variables requested' + Status=WRF_NO_ERR + return + CASE (-1013) + ReturnString= 'Attempt to close file during a dry run' + Status=WRF_NO_ERR + return + CASE (-1014) + ReturnString= 'Date string not 19 characters in length' + Status=WRF_NO_ERR + return + CASE (-1015) + ReturnString= 'Attempt to read zero length words' + Status=WRF_NO_ERR + return + CASE (-1016) + ReturnString= 'Data type not found' + Status=WRF_NO_ERR + return + CASE (-1017) + ReturnString= 'Badly formatted date string' + Status=WRF_NO_ERR + return + CASE (-1018) + ReturnString= 'Attempt at read during a dry run' + Status=WRF_NO_ERR + return + CASE (-1019) + ReturnString= 'Attempt to get zero words' + Status=WRF_NO_ERR + return + CASE (-1020) + ReturnString= 'Attempt to put zero length words' + Status=WRF_NO_ERR + return + CASE (-1021) + ReturnString= 'NetCDF error' + Status=WRF_NO_ERR + return + CASE (-1022) + ReturnString= 'Requested length <= 1' + Status=WRF_NO_ERR + return + CASE (-1023) + ReturnString= 'More data available than requested' + Status=WRF_NO_ERR + return + CASE (-1024) + ReturnString= 'New date less than previous date' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This warning code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this warning code.' + Status=WRF_NO_ERR + END SELECT + return +end subroutine ext_ncd_warning_str +!returns message string for all WRF and netCDF warning/error status codes +!Other i/o packages must provide their own routines to return their own status messages +subroutine ext_ncd_error_str( Code, ReturnString, Status) + use wrf_data + use ext_ncd_support_routines + implicit none + include 'netcdf.inc' + include 'wrf_status_codes.h' + integer , intent(in) ::Code + character *(*), intent(out) :: ReturnString + integer, intent(out) ::Status + SELECT CASE (Code) + CASE (-100) + ReturnString= 'Allocation Error' + Status=WRF_NO_ERR + return + CASE (-101) + ReturnString= 'Deallocation Error' + Status=WRF_NO_ERR + return + CASE (-102) + ReturnString= 'Bad File Status' + Status=WRF_NO_ERR + return + CASE (-1004) + ReturnString= 'Variable on disk is not 3D' + Status=WRF_NO_ERR + return + CASE (-1005) + ReturnString= 'Metadata on disk is not 1D' + Status=WRF_NO_ERR + return + CASE (-1006) + ReturnString= 'Time dimension too small' + Status=WRF_NO_ERR + return + CASE DEFAULT + ReturnString= 'This error code is not supported or handled directly by WRF and NetCDF. & + & Might be an erroneous number, or specific to an i/o package other than NetCDF; you may need & + & to be calling a package-specific routine to return a message for this error code.' + Status=WRF_NO_ERR + END SELECT + return +end subroutine ext_ncd_error_str diff --git a/libsrc/wrflib/wrf_io_flags.h b/libsrc/wrflib/wrf_io_flags.h new file mode 100644 index 0000000000..2048aff665 --- /dev/null +++ b/libsrc/wrflib/wrf_io_flags.h @@ -0,0 +1,15 @@ + integer, parameter :: WRF_FILE_NOT_OPENED = 100 + integer, parameter :: WRF_FILE_OPENED_NOT_COMMITTED = 101 + integer, parameter :: WRF_FILE_OPENED_FOR_WRITE = 102 + integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103 + integer, parameter :: WRF_REAL = 104 + integer, parameter :: WRF_DOUBLE = 105 + integer, parameter :: WRF_FLOAT=WRF_REAL + integer, parameter :: WRF_INTEGER = 106 + integer, parameter :: WRF_LOGICAL = 107 + integer, parameter :: WRF_COMPLEX = 108 + integer, parameter :: WRF_DOUBLE_COMPLEX = 109 + integer, parameter :: WRF_FILE_OPENED_FOR_UPDATE = 110 +! This bit is for backwards compatibility with old variants of these flags +! that are still being used in io_grib1 and io_phdf5. It should be removed! + integer, parameter :: WRF_FILE_OPENED_AND_COMMITTED = 102 diff --git a/libsrc/wrflib/wrf_status_codes.h b/libsrc/wrflib/wrf_status_codes.h new file mode 100644 index 0000000000..059d9ea719 --- /dev/null +++ b/libsrc/wrflib/wrf_status_codes.h @@ -0,0 +1,133 @@ + +!WRF Error and Warning messages (1-999) +!All i/o package-specific status codes you may want to add must be handled by your package (see below) +! WRF handles these and netCDF messages only + integer, parameter :: WRF_NO_ERR = 0 !no error + integer, parameter :: WRF_WARN_FILE_NF = -1 !file not found, or incomplete + integer, parameter :: WRF_WARN_MD_NF = -2 !metadata not found + integer, parameter :: WRF_WARN_TIME_NF = -3 !timestamp not found + integer, parameter :: WRF_WARN_TIME_EOF = -4 !no more timestamps + integer, parameter :: WRF_WARN_VAR_NF = -5 !variable not found + integer, parameter :: WRF_WARN_VAR_EOF = -6 !no more variables for the current time + integer, parameter :: WRF_WARN_TOO_MANY_FILES = -7 !too many open files + integer, parameter :: WRF_WARN_TYPE_MISMATCH = -8 !data type mismatch + integer, parameter :: WRF_WARN_WRITE_RONLY_FILE = -9 !attempt to write readonly file + integer, parameter :: WRF_WARN_READ_WONLY_FILE = -10 !attempt to read writeonly file + integer, parameter :: WRF_WARN_FILE_NOT_OPENED = -11 !attempt to access unopened file + integer, parameter :: WRF_WARN_2DRYRUNS_1VARIABLE = -12 !attempt to do 2 trainings for 1 variable + integer, parameter :: WRF_WARN_READ_PAST_EOF = -13 !attempt to read past EOF + integer, parameter :: WRF_WARN_BAD_DATA_HANDLE = -14 !bad data handle + integer, parameter :: WRF_WARN_WRTLEN_NE_DRRUNLEN = -15 !write length not equal to training length + integer, parameter :: WRF_WARN_TOO_MANY_DIMS = -16 !more dimensions requested than training + integer, parameter :: WRF_WARN_COUNT_TOO_LONG = -17 !attempt to read more data than exists + integer, parameter :: WRF_WARN_DIMENSION_ERROR = -18 !input dimension inconsistent + integer, parameter :: WRF_WARN_BAD_MEMORYORDER = -19 !input MemoryOrder not recognized + integer, parameter :: WRF_WARN_DIMNAME_REDEFINED = -20 !a dimension name with 2 different lengths + integer, parameter :: WRF_WARN_CHARSTR_GT_LENDATA = -21 !string longer than provided storage + integer, parameter :: WRF_WARN_NOTSUPPORTED = -22 !function not supportable + integer, parameter :: WRF_WARN_NOOP = -23 !package implements this routine as NOOP + +!Fatal errors + integer, parameter :: WRF_ERR_FATAL_ALLOCATION_ERROR = -100 !allocation error + integer, parameter :: WRF_ERR_FATAL_DEALLOCATION_ERR = -101 !dealloc error + integer, parameter :: WRF_ERR_FATAL_BAD_FILE_STATUS = -102 !bad file status + + +!Package specific errors (1000+) +!Netcdf status codes +!WRF will accept status codes of 1000+, but it is up to the package to handle +! and return the status to the user. + + integer, parameter :: WRF_ERR_FATAL_BAD_VARIABLE_DIM = -1004 + integer, parameter :: WRF_ERR_FATAL_MDVAR_DIM_NOT_1D = -1005 + integer, parameter :: WRF_ERR_FATAL_TOO_MANY_TIMES = -1006 + integer, parameter :: WRF_WARN_BAD_DATA_TYPE = -1007 !this code not in either spec? + integer, parameter :: WRF_WARN_FILE_NOT_COMMITTED = -1008 !this code not in either spec? + integer, parameter :: WRF_WARN_FILE_OPEN_FOR_READ = -1009 + integer, parameter :: WRF_IO_NOT_INITIALIZED = -1010 + integer, parameter :: WRF_WARN_MD_AFTER_OPEN = -1011 + integer, parameter :: WRF_WARN_TOO_MANY_VARIABLES = -1012 + integer, parameter :: WRF_WARN_DRYRUN_CLOSE = -1013 + integer, parameter :: WRF_WARN_DATESTR_BAD_LENGTH = -1014 + integer, parameter :: WRF_WARN_ZERO_LENGTH_READ = -1015 + integer, parameter :: WRF_WARN_DATA_TYPE_NOT_FOUND = -1016 + integer, parameter :: WRF_WARN_DATESTR_ERROR = -1017 + integer, parameter :: WRF_WARN_DRYRUN_READ = -1018 + integer, parameter :: WRF_WARN_ZERO_LENGTH_GET = -1019 + integer, parameter :: WRF_WARN_ZERO_LENGTH_PUT = -1020 + integer, parameter :: WRF_WARN_NETCDF = -1021 + integer, parameter :: WRF_WARN_LENGTH_LESS_THAN_1 = -1022 + integer, parameter :: WRF_WARN_MORE_DATA_IN_FILE = -1023 + integer, parameter :: WRF_WARN_DATE_LT_LAST_DATE = -1024 + +! For HDF5 only + integer, parameter :: WRF_HDF5_ERR_FILE = -200 + integer, parameter :: WRF_HDF5_ERR_MD = -201 + integer, parameter :: WRF_HDF5_ERR_TIME = -202 + integer, parameter :: WRF_HDF5_ERR_TIME_EOF = -203 + integer, parameter :: WRF_HDF5_ERR_MORE_DATA_IN_FILE = -204 + integer, parameter :: WRF_HDF5_ERR_DATE_LT_LAST_DATE = -205 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_FILES = -206 + integer, parameter :: WRF_HDF5_ERR_TYPE_MISMATCH = -207 + integer, parameter :: WRF_HDF5_ERR_LENGTH_LESS_THAN_1 = -208 + integer, parameter :: WRF_HDF5_ERR_WRITE_RONLY_FILE = -209 + integer, parameter :: WRF_HDF5_ERR_READ_WONLY_FILE = -210 + integer, parameter :: WRF_HDF5_ERR_FILE_NOT_OPENED = -211 + integer, parameter :: WRF_HDF5_ERR_DATESTR_ERROR = -212 + integer, parameter :: WRF_HDF5_ERR_DRYRUN_READ = -213 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_GET = -214 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_PUT = -215 + integer, parameter :: WRF_HDF5_ERR_2DRYRUNS_1VARIABLE = -216 + integer, parameter :: WRF_HDF5_ERR_DATA_TYPE_NOTFOUND = -217 + integer, parameter :: WRF_HDF5_ERR_READ_PAST_EOF = -218 + integer, parameter :: WRF_HDF5_ERR_BAD_DATA_HANDLE = -219 + integer, parameter :: WRF_HDF5_ERR_WRTLEN_NE_DRRUNLEN = -220 + integer, parameter :: WRF_HDF5_ERR_DRYRUN_CLOSE = -221 + integer, parameter :: WRF_HDF5_ERR_DATESTR_BAD_LENGTH = -222 + integer, parameter :: WRF_HDF5_ERR_ZERO_LENGTH_READ = -223 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_DIMS = -224 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_VARIABLES = -225 + integer, parameter :: WRF_HDF5_ERR_COUNT_TOO_LONG = -226 + integer, parameter :: WRF_HDF5_ERR_DIMENSION_ERROR = -227 + integer, parameter :: WRF_HDF5_ERR_BAD_MEMORYORDER = -228 + integer, parameter :: WRF_HDF5_ERR_DIMNAME_REDEFINED = -229 + integer, parameter :: WRF_HDF5_ERR_MD_AFTER_OPEN = -230 + integer, parameter :: WRF_HDF5_ERR_CHARSTR_GT_LENDATA = -231 + integer, parameter :: WRF_HDF5_ERR_BAD_DATA_TYPE = -232 + integer, parameter :: WRF_HDF5_ERR_FILE_NOT_COMMITTED = -233 + + integer, parameter :: WRF_HDF5_ERR_ALLOCATION = -2001 + integer, parameter :: WRF_HDF5_ERR_DEALLOCATION = -2002 + integer, parameter :: WRF_HDF5_ERR_BAD_FILE_STATUS = -2003 + integer, parameter :: WRF_HDF5_ERR_BAD_VARIABLE_DIM = -2004 + integer, parameter :: WRF_HDF5_ERR_MDVAR_DIM_NOT_1D = -2005 + integer, parameter :: WRF_HDF5_ERR_TOO_MANY_TIMES = -2006 + integer, parameter :: WRF_HDF5_ERR_DATA_ID_NOTFOUND = -2007 + + integer, parameter :: WRF_HDF5_ERR_DATASPACE = -300 + integer, parameter :: WRF_HDF5_ERR_DATATYPE = -301 + integer, parameter :: WRF_HDF5_ERR_PROPERTY_LIST = -302 + + integer, parameter :: WRF_HDF5_ERR_DATASET_CREATE = -303 + integer, parameter :: WRF_HDF5_ERR_DATASET_READ = -304 + integer, parameter :: WRF_HDF5_ERR_DATASET_WRITE = -305 + integer, parameter :: WRF_HDF5_ERR_DATASET_OPEN = -306 + integer, parameter :: WRF_HDF5_ERR_DATASET_GENERAL = -307 + integer, parameter :: WRF_HDF5_ERR_GROUP = -308 + + integer, parameter :: WRF_HDF5_ERR_FILE_OPEN = -309 + integer, parameter :: WRF_HDF5_ERR_FILE_CREATE = -310 + integer, parameter :: WRF_HDF5_ERR_DATASET_CLOSE = -311 + integer, parameter :: WRF_HDF5_ERR_FILE_CLOSE = -312 + integer, parameter :: WRF_HDF5_ERR_CLOSE_GENERAL = -313 + + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_CREATE = -314 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_READ = -315 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_WRITE = -316 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_OPEN = -317 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_GENERAL = -318 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_CLOSE = -319 + + integer, parameter :: WRF_HDF5_ERR_OTHERS = -320 + integer, parameter :: WRF_HDF5_ERR_ATTRIBUTE_OTHERS = -321 + From 320de0f4b0d06a4e7542d98da73031597a86c57b Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Wed, 17 Mar 2021 16:27:44 -0500 Subject: [PATCH 069/155] Create symbolic links for the modulefiles for wcoss_cray and wcoss_dell_p3 so that they can be easily loaded at the HAFS workflow level. --- modulefiles/modulefile.ProdGSI.wcoss_cray | 1 + modulefiles/modulefile.ProdGSI.wcoss_dell_p3 | 1 + 2 files changed, 2 insertions(+) create mode 120000 modulefiles/modulefile.ProdGSI.wcoss_cray create mode 120000 modulefiles/modulefile.ProdGSI.wcoss_dell_p3 diff --git a/modulefiles/modulefile.ProdGSI.wcoss_cray b/modulefiles/modulefile.ProdGSI.wcoss_cray new file mode 120000 index 0000000000..332e5e3f3f --- /dev/null +++ b/modulefiles/modulefile.ProdGSI.wcoss_cray @@ -0,0 +1 @@ +modulefile.ProdGSI.wcoss_c \ No newline at end of file diff --git a/modulefiles/modulefile.ProdGSI.wcoss_dell_p3 b/modulefiles/modulefile.ProdGSI.wcoss_dell_p3 new file mode 120000 index 0000000000..3311ccee5a --- /dev/null +++ b/modulefiles/modulefile.ProdGSI.wcoss_dell_p3 @@ -0,0 +1 @@ +modulefile.ProdGSI.wcoss_d \ No newline at end of file From 6d370e88f3f734161ed656820a69f9e41501f178 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 23 Mar 2021 15:32:11 -0400 Subject: [PATCH 070/155] Fix a bug with q when tsen is used as control variable in fv3 regional EnKF analysis (#6) * For fv3-lam enkf, fix a bug with q when tsen is used as control variable * For fv3-lam enkf, fix a bug with q when tsen is used as control variable Co-authored-by: TingLei-NOAA --- src/enkf/gridio_fv3reg.f90 | 208 ++++++++++++++++++------------------- 1 file changed, 103 insertions(+), 105 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 8c6fec3f9a..badb70e01a 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -5,11 +5,7 @@ module gridio !$$$ Module documentation block ! ! This module contains various routines to ingest and update - ! variables from Weather Research and Forecasting (WRF) model Advanced - ! Research WRF (ARW) and Non-hydrostatic Mesoscale Model (NMM) dynamical - ! cores which are required by the Ensemble Kalman Filter (ENKF) currently - ! designed for operations within the National Centers for Environmental - ! Prediction (NCEP) Global Forecasting System (GFS) + ! variables from FV3-LAM warmstart files ! ! prgmmr: Winterbottom org: ESRL/PSD1 date: 2011-11-30 ! @@ -17,7 +13,7 @@ module gridio ! ! 2011-11-30 Winterbottom - Initial version. ! - ! 2019-01- Ting -- modified for fv3sar + ! 2019-01- Ting -- modified for fv3-lam ! attributes: ! language: f95 ! @@ -191,17 +187,9 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f deallocate(vworkvar3d) endif - - if (tv_ind > 0.or.tsen_ind) then - allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) - varstrname = 'T' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) - - - if (q_ind > 0) then - varstrname = 'sphum' + if (q_ind > 0) then + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res @@ -217,8 +205,16 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) enddo - endif - if(tv_ind > 0) then + endif + if (tv_ind > 0.or.tsen_ind) then + allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) + varstrname = 'T' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + if(tv_ind > 0) then + if(.not. (q_ind > 0)) then + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) + endif do k=1,nlevs do j=1,ny_res do i=1,nx_res @@ -226,9 +222,10 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f enddo enddo enddo - tvworkvar3d=workvar3d + tvworkvar3d=workvar3d else! tsen_id >0 workvar3d=tsenworkvar3d + tvworkvar3d=workvar3d*(one+fv*qworkvar3d(i,j,k)) endif tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 do k=1,nlevs @@ -242,7 +239,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f enddo do k = levels(tmp_ind-1)+1, levels(tmp_ind) if (nproc .eq. 0) then - write(6,*) 'READFVregional : t ', & + write(6,*) 'READFVregional : tv or tsen ', & & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) endif enddo @@ -361,12 +358,12 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f end subroutine readgriddata !======================================================================== - ! readgriddata_nmm.f90: read FV3-Lam state or control vector + ! readgriddata: read fv3-lam state or control vector !------------------------------------------------------------------------- !======================================================================== - ! writegriddata.f90: write FV3-LAM analysis + ! writegriddata: write fv3-lam !------------------------------------------------------------------------- subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) @@ -404,7 +401,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid real(r_single), dimension(:,:), allocatable ::pswork real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,workinc3d2,uworkvar3d,& vworkvar3d,tvworkvar3d,tsenworkvar3d,& - workprsi,qworkvar3d + workprsi,qworkvar3d,qbgworkvar3d !---------------------------------------------------------------------- ! Define variables required by for extracting netcdf variable @@ -438,7 +435,6 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid ps_ind = getindex(vars2d, 'ps') ! Ps (2D) - !---------------------------------------------------------------------- if (nbackgrounds > 1) then write(6,*)'gridio/writegriddata: writing multiple backgrounds not yet supported' @@ -452,6 +448,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid allocate(workinc3d(nx_res,ny_res,nlevs),workinc3d2(nx_res,ny_res,nlevsp1)) allocate(workvar3d(nx_res,ny_res,nlevs)) allocate(qworkvar3d(nx_res,ny_res,nlevs)) + allocate(qbgworkvar3d(nx_res,ny_res,nlevs)) allocate(tvworkvar3d(nx_res,ny_res,nlevs)) @@ -503,81 +500,36 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(v_ind-1)+k,nb,ne) - enddo - enddo - enddo - vworkvar3d(1:nx_res,:,:)=vworkvar3d(1:nx_res,:,:)+workinc3d - vworkvar3d(nx_res+1,:,:)=vworkvar3d(nx_res,:,:) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(v_ind-1)+k,nb,ne) + enddo + enddo + enddo + vworkvar3d(1:nx_res,:,:)=vworkvar3d(1:nx_res,:,:)+workinc3d + vworkvar3d(nx_res+1,:,:)=vworkvar3d(nx_res,:,:) call write_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) deallocate(vworkvar3d) endif - if (tv_ind > 0.or.tsen_ind>0 ) then - - varstrname = 'T' - if(tsen_ind>0) then - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(tsen_ind-1)+k,nb,ne) - enddo - enddo - enddo - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - workvar3d=workvar3d+workinc3d - call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - else ! tv_ind >0 - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(tv_ind-1)+k,nb,ne) - enddo - enddo - enddo - - varstrname = 'T' - allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) - tvworkvar3d=tsenworkvar3d*(one+fv*qworkvar3d) - tvworkvar3d=tvworkvar3d+workinc3d - if(q_ind > 0) then - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(q_ind-1)+k,nb,ne) - enddo - enddo - enddo - qworkvar3d=qworkvar3d+workinc3d - endif - tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d) - varstrname = 'T' - call write_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - do k=1,nlevs - if (nproc .eq. 0) & - write(6,*) 'WRITEregional : T ', & - & k, minval(tsenworkvar3d(:,:,k)), maxval(tsenworkvar3d(:,:,k)) - enddo - - - - if(q_ind>0) then + if(q_ind>0) then + varstrname='sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qbgworkvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(q_ind-1)+k,nb,ne) + enddo + enddo + enddo + qworkvar3d=qbgworkvar3d+workinc3d call write_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) do k=1,nlevs @@ -585,14 +537,64 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid write(6,*) 'WRITEregional : sphum ', & & k, minval(qworkvar3d(:,:,k)), maxval(qworkvar3d(:,:,k)) enddo - endif - - + end if + + + + if (tv_ind > 0.or.tsen_ind>0 ) then + + varstrname = 'T' + if(tsen_ind>0) then + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(tsen_ind-1)+k,nb,ne) + enddo + enddo + enddo + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + else ! tv_ind >0 + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(tv_ind-1)+k,nb,ne) + enddo + enddo + enddo + + varstrname = 'T' + allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + if(.not. (q_ind > 0) ) then + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qbgworkvar3d) + endif + tvworkvar3d=tsenworkvar3d*(one+fv*qbgworkvar3d) + tvworkvar3d=tvworkvar3d+workinc3d + if(.not. ( q_ind > 0)) then + tsenworkvar3d=tvworkvar3d/(one+fv*qbgworkvar3d) + else + tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d) + endif + varstrname = 'T' + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : T ', & + & k, minval(tsenworkvar3d(:,:,k)), maxval(tsenworkvar3d(:,:,k)) + enddo - deallocate(tsenworkvar3d) - endif + deallocate(tsenworkvar3d) + endif !if tsens else tv endif + if (oz_ind > 0) then varstrname = 'o3mr' @@ -621,9 +623,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) enddo - - - nn = nn_tile0 + nn = nn_tile0 do j=1,ny_res do i=1,nx_res nn=nn+1 @@ -657,9 +657,6 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid myname_,'close '//trim(filename) ) - !---------------------------------------------------------------------- - ! update time stamp is to be considered NSTART_HOUR in NMM (HWRF) restart file. - !====================================================================== end do ! tiles if(allocated(workinc3d)) deallocate(workinc3d) if(allocated(workinc3d2)) deallocate(workinc3d2) @@ -667,6 +664,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid if(allocated(pswork)) deallocate(pswork) if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) if(allocated(qworkvar3d)) deallocate(qworkvar3d) + if(allocated(qbgworkvar3d)) deallocate(qbgworkvar3d) From 08bca19eb0027f51db7393a94591b3bcf3ade3ed Mon Sep 17 00:00:00 2001 From: TingLei-NOAA <63461756+TingLei-NOAA@users.noreply.github.com> Date: Fri, 26 Mar 2021 13:55:33 -0400 Subject: [PATCH 071/155] A bug fix in gridio_fv3reg.f90 and add delp as a control variable choice A bug fix in gridio_fv3reg.f90 and delp is added as a control variable choice for fv3-lam from @TingLei-NOAA --- src/enkf/gridinfo_fv3reg.f90 | 2 +- src/enkf/gridio_fv3reg.f90 | 49 +++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 60b9461706..7c2a44b8b3 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -67,7 +67,7 @@ module gridinfo integer,public :: npts integer,public :: ntrunc ! supported variable names in anavinfo -character(len=max_varname_length),public, dimension(8) :: vars3d_supported = (/'u ', 'v ', 't ', 'q ', 'oz ', 'cw ', 'tsen', 'prse' /) +character(len=max_varname_length),public, dimension(9) :: vars3d_supported = (/'u ', 'v ', 't ', 'q ',' delp', 'oz ', 'cw ', 'tsen', 'prse' /) character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) ! supported variable names in anavinfo real(r_single), allocatable, dimension(:) :: ak,bk,eta1_ll,eta2_ll diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index badb70e01a..95cb845e07 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -86,7 +86,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f ! Define counting variables integer :: nlevsp1 integer :: i,j, k,nn,ntile,nn_tile0, nb,nanal,ne - integer :: u_ind, v_ind, tv_ind,tsen_ind, q_ind, oz_ind + integer :: u_ind, v_ind, tv_ind,tsen_ind, q_ind,delp_ind, oz_ind integer :: ps_ind, sst_ind integer :: tmp_ind logical :: ice @@ -99,6 +99,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f v_ind = getindex(vars3d, 'v') ! U and V (3D) tv_ind = getindex(vars3d, 't') ! Tv (3D) q_ind = getindex(vars3d, 'q') ! Q (3D) + delp_ind = getindex(vars3d, 'delp') ! delp (3D) oz_ind = getindex(vars3d, 'oz') ! Oz (3D) tsen_ind = getindex(vars3d, 'tsen') !sensible T (3D) ! prse_ind = getindex(vars3d, 'prse') ! pressure @@ -186,6 +187,25 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f enddo deallocate(vworkvar3d) + endif + if (delp_ind > 0) then + varstrname = 'delp' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(delp_ind-1)+k,nb,ne)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(delp_ind-1)+1, levels(delp_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : delp ', & + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + enddo + endif if (q_ind > 0) then varstrname = 'sphum' @@ -225,7 +245,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f tvworkvar3d=workvar3d else! tsen_id >0 workvar3d=tsenworkvar3d - tvworkvar3d=workvar3d*(one+fv*qworkvar3d(i,j,k)) + tvworkvar3d=workvar3d*(one+fv*qworkvar3d) endif tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 do k=1,nlevs @@ -394,7 +414,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid character(len=7) :: charnanal !---------------------------------------------------------------------- - integer(i_kind) :: u_ind, v_ind, tv_ind, tsen_ind,q_ind, ps_ind,oz_ind + integer(i_kind) :: u_ind, v_ind, tv_ind, tsen_ind,q_ind, delp_ind,ps_ind,oz_ind integer(i_kind) :: w_ind, cw_ind, ph_ind integer(i_kind) file_id @@ -429,6 +449,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid tv_ind = getindex(vars3d, 't') ! Tv (3D) tsen_ind = getindex(vars3d, 'tsen') ! Tv (3D) q_ind = getindex(vars3d, 'q') ! Q (3D) + delp_ind = getindex(vars3d, 'delp') ! delp (3D) cw_ind = getindex(vars3d, 'cw') ! CWM for WRF-NMM w_ind = getindex(vars3d, 'w') ! W for WRF-ARW ph_ind = getindex(vars3d, 'ph') ! PH for WRF-ARW @@ -515,6 +536,28 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid deallocate(vworkvar3d) endif + if(delp_ind>0) then + + varstrname='delp' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(delp_ind-1)+k,nb,ne) + enddo + enddo + enddo + workvar3d=workvar3d+workinc3d + + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : delp ', & + & k, minval(qworkvar3d(:,:,k)), maxval(workvar3d(:,:,k)) + enddo + end if if(q_ind>0) then From 9a67c53fe5e0be7e72256c276e7825e8e42cced8 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA <63461756+TingLei-NOAA@users.noreply.github.com> Date: Mon, 29 Mar 2021 21:12:39 -0400 Subject: [PATCH 072/155] Feature/ensda bugfix q new (#10) Bug fix for adding delp as a EnKF control vector variable from @TingLei-NOAA. --- src/enkf/controlvec.f90 | 1 + src/enkf/gridinfo_fv3reg.f90 | 2 +- src/enkf/gridio_fv3reg.f90 | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/enkf/controlvec.f90 b/src/enkf/controlvec.f90 index 6b2b744b35..47e0451072 100644 --- a/src/enkf/controlvec.f90 +++ b/src/enkf/controlvec.f90 @@ -166,6 +166,7 @@ subroutine init_controlvec() call stop2(5021) endif enddo + do i = 1, nc3d if (getindex(vars3d_supported, cvars3d(i))<0) then if (nproc .eq. 0) then diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 7c2a44b8b3..15042bacfa 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -67,7 +67,7 @@ module gridinfo integer,public :: npts integer,public :: ntrunc ! supported variable names in anavinfo -character(len=max_varname_length),public, dimension(9) :: vars3d_supported = (/'u ', 'v ', 't ', 'q ',' delp', 'oz ', 'cw ', 'tsen', 'prse' /) +character(len=max_varname_length),public, dimension(9) :: vars3d_supported = (/'u ', 'v ', 't ', 'q ','delp', 'oz ', 'cw ', 'tsen', 'prse' /) character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) ! supported variable names in anavinfo real(r_single), allocatable, dimension(:) :: ak,bk,eta1_ll,eta2_ll diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 95cb845e07..3d80ac9437 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -449,6 +449,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid tv_ind = getindex(vars3d, 't') ! Tv (3D) tsen_ind = getindex(vars3d, 'tsen') ! Tv (3D) q_ind = getindex(vars3d, 'q') ! Q (3D) + oz_ind = getindex(vars3d, 'oz') ! Oz (3D) delp_ind = getindex(vars3d, 'delp') ! delp (3D) cw_ind = getindex(vars3d, 'cw') ! CWM for WRF-NMM w_ind = getindex(vars3d, 'w') ! W for WRF-ARW From 29d1a6b290d3af2250ef34376be6700b9092da51 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 13 Apr 2021 02:47:46 +0000 Subject: [PATCH 073/155] Update modulefile.ProdGSI.jet so that module load works on Jet. --- modulefiles/modulefile.ProdGSI.jet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modulefiles/modulefile.ProdGSI.jet b/modulefiles/modulefile.ProdGSI.jet index dfc65dcb50..af772aea74 100644 --- a/modulefiles/modulefile.ProdGSI.jet +++ b/modulefiles/modulefile.ProdGSI.jet @@ -1,4 +1,4 @@ - #%Module###################################################################### +#%Module###################################################################### ## NOAA-EMC/GSI ##_____________________________________________________ #proc ModulesHelp { } { @@ -10,7 +10,7 @@ # # -set CRTM_FIX /lfs4/HFIP/hfv3gfs/gwv/l0530/lib/crtm/v2.3.0/fix +setenv CRTM_FIX /lfs4/HFIP/hfv3gfs/gwv/l0530/lib/crtm/v2.3.0/fix # Load cmake module load cmake/3.16.1 From 1363d3dee2231cc43e16b6d406f3bb8516e7e689 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 13 Apr 2021 19:32:41 +0000 Subject: [PATCH 074/155] Use cmake/3.16.2 in modulefile.ProdGSI.wcoss_c so that it can build on wcoss_c successfully (From Biju). --- modulefiles/modulefile.ProdGSI.wcoss_c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modulefiles/modulefile.ProdGSI.wcoss_c b/modulefiles/modulefile.ProdGSI.wcoss_c index 0d36d80e07..f02f4ded73 100644 --- a/modulefiles/modulefile.ProdGSI.wcoss_c +++ b/modulefiles/modulefile.ProdGSI.wcoss_c @@ -30,7 +30,7 @@ module load intel/18.1.163 module load craype-sandybridge module load cray-mpich/7.2.0 -module load cmake/3.6.2 +module load cmake/3.16.2 # Loading netcdf modules module load HDF5-parallel-intel-sandybridge/1.10.6 From c8fd806e3fa8ed4f432eacaeac614f6677c543f0 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Thu, 15 Apr 2021 13:57:27 +0000 Subject: [PATCH 075/155] Modify build_all_cmake.sh so that it can work on Jet properly. --- ush/build_all_cmake.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ush/build_all_cmake.sh b/ush/build_all_cmake.sh index 572568ef20..3ade6a648f 100755 --- a/ush/build_all_cmake.sh +++ b/ush/build_all_cmake.sh @@ -66,7 +66,7 @@ if [ $target = wcoss_d ]; then elif [ $target = wcoss -o $target = gaea ]; then module purge module load $dir_modules/modulefile.ProdGSI.$target -elif [ $target = hera -o $target = orion ]; then +elif [ $target = hera -o $target = orion -o $target = jet ]; then module purge module use $dir_modules module load modulefile.ProdGSI.$target From a7e35de6b1ee75d8c5cae362ad0d7c2f4ba7c7ef Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Thu, 6 May 2021 18:02:29 -0500 Subject: [PATCH 076/155] Remove the duplicated line of "deallocate(ges_z_ens)" in src/gsi/get_gefs_for_regional.f90, which cause gsi failure when running 3DEnVar with GDAS ensembles. --- src/gsi/get_gefs_for_regional.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 5bc4e0a48d..e7f348d228 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -958,8 +958,6 @@ subroutine get_gefs_for_regional end do ! end loop over ensemble members. deallocate(ges_z_ens) - deallocate(ges_z_ens) - ! next, compute mean of ensembles. allocate(stbar(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig)) From 700f60451c3d7c8ffadbf9f879f14d49813edce3 Mon Sep 17 00:00:00 2001 From: TingLei-daprediction Date: Mon, 10 May 2021 11:51:55 +0000 Subject: [PATCH 077/155] the fix for incorrect reference to fv3reg conversion subroutines in mod_fv3_loal.f90 and for a newer crtm lib to avoid GSI aborion running in debug mode --- modulefiles/modulefile.ProdGSI.hera | 4 +- src/gsi/get_gefs_for_regional.f90 | 5 +- src/gsi/gsi_rfv3io_mod.f90 | 14 +- src/gsi/mod_fv3_lola.f90 | 946 ---------------------------- src/gsi/mod_fv3_lolgrid.f90 | 127 ++++ 5 files changed, 139 insertions(+), 957 deletions(-) delete mode 100644 src/gsi/mod_fv3_lola.f90 diff --git a/modulefiles/modulefile.ProdGSI.hera b/modulefiles/modulefile.ProdGSI.hera index aa158d2b89..de1890b2a9 100755 --- a/modulefiles/modulefile.ProdGSI.hera +++ b/modulefiles/modulefile.ProdGSI.hera @@ -40,5 +40,7 @@ module load sp/2.3.3 module load w3nco/2.4.1 module load w3emc/2.7.3 module load bacio/2.4.1 -module load crtm/2.3.0 +#clt module load crtm/2.3.0 module load netcdf/4.7.4 +module use /scratch1/NCEPDEV/da/Michael.Lueken/REL-2.3.0/crtm_v2.3.1/modulefiles +module load crtm/2.3.1 diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index e7f348d228..4f258e2396 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -381,7 +381,7 @@ subroutine get_gefs_for_regional gfshead%idvc = 2 ! FV3GFS write component does not include JCAP, infer from DIMY-2 - njcap=latb-2 +!clt njcap=latb-2 nlat_gfs=gfshead%latb+2 nlon_gfs=gfshead%lonb @@ -389,7 +389,8 @@ subroutine get_gefs_for_regional jcap_gfs=gfshead%latb-2 - if (mype==mype_out) write(6,*)'GESINFO: Read NCEP FV3GFS netCDF ', & +!clt if (mype==mype_out) write(6,*)'GESINFO: Read NCEP FV3GFS netCDF ', & + if (mype==0) write(6,*)'GESINFO: Read NCEP FV3GFS netCDF ', & 'format file, ',trim(filename) ! hard code nvcoord to be 2 gfshead%nvcoord=2 ! ak and bk diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 960f8d0287..e6d71dc483 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -2691,8 +2691,7 @@ subroutine gsi_fv3ncdf_write_fv3_dz(filename,varname,varinc,mype_io,add_saved) use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig use gridmod, only: ijn,displs_g,itotsub,iglobal - use mod_fv3_lola, only: fv3_ll_to_h - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close use netcdf, only: nf90_write,nf90_inq_varid @@ -2751,7 +2750,7 @@ subroutine gsi_fv3ncdf_write_fv3_dz(filename,varname,varinc,mype_io,add_saved) call check( nf90_get_var(gfile_loc,VarId,work_b) ) do k=1,nsig - call fv3_ll_to_h(work_ainc(1,1,k),workb2(:,:),nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_ainc(1,1,k),workb2(:,:),nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) !!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! work_b(:,:,k)=workb2(:,:)+work_b(:,:,k) enddo @@ -2803,8 +2802,7 @@ subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig use gridmod, only: ijn,displs_g,itotsub,iglobal - use mod_fv3_lola, only: fv3_ll_to_h - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lolgrid, only: fv3_ll_to_h_regular_grids,fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi,ltosj use netcdf, only: nf90_open,nf90_close use netcdf, only: nf90_write,nf90_inq_varid @@ -2865,16 +2863,16 @@ subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) ! for being now only lev between (including ) 2 and nsig+1 of work_b (:,:,lev) ! are updated do k=1,nsig - call fv3_h_to_ll(work_b(:,:,ilev0+k),worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll_regular_grids(work_b(:,:,ilev0+k),worka2,nlon_regional,nlat_regional,nlon,nlat,p_fv3sar2anlgrid) !!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! work_a(:,:,k)=work_a(:,:,k)-worka2(:,:) - call fv3_ll_to_h(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) work_b(:,:,ilev0+k)=work_b(:,:,ilev0+k)+workb2(:,:) enddo deallocate(worka2,workb2) else do k=1,nsig - call fv3_ll_to_h(work_a(1,1,k),work_b(1,1,ilev0+k),nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h_regular_grids(work_a(1,1,k),work_b(1,1,ilev0+k),nlon,nlat,nlon_regional,nlat_regional,.true.,p_fv3sar2anlgrid) enddo endif diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 deleted file mode 100644 index 497f91c192..0000000000 --- a/src/gsi/mod_fv3_lola.f90 +++ /dev/null @@ -1,946 +0,0 @@ -module mod_fv3_lola -!$$$ module documentation block -! . . . . -! module: mod_fv3_lola -! prgmmr: parrish -! -! abstract: This module contains routines to interpolate from a single -! fv3 D grid tile to a rotated lat-lon analysis grid which completely -! covers the fv3 tile. Points beyond the fv3 tile are -! filled with nearest fv3 edge values, but have no actual -! impact on the analysis. -! -! program history log: -! 2017-02-24 parrish--initial documentation (patterned after -! mod_fv3_to_a.f90) -! 2017-10-10 wu w - setup interpolation and trnsform coeff in generate_anl_grid -! add routines earthuv2fv3, fv3uv2earth, fv3_h_to_ll -! fv3_ll_to_h -! 2019-11-01 wu - add checks in generate_anl_grid to present the mean -! longitude correctly to fix problem near lon=0 -! -! subroutines included: -! sub generate_anl_grid -! sub earthuv2fv3 -! sub fv3uv2earth -! sub fv3_h_to_ll -! sub fv3_ll_to_h -! sub rotate2deg -! sub unrotate2deg -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - -! DIAGRAM: D-Grid layout: -! -! 1 nx -! . . (U,H) -! -! 1 nx +1 -! . . (V) - -! U U U U U U + ny +1 (for U) -! V H V H V H V H V H V H V + ny (for V,H) -! U U U U U U xh(i) = i dx=1 -! V H V H V H V H V H V H V xu(i) = i -! U U U U U U xv(i) = i-0.5 -! V H V H V H V H V H V H V -! U U U U U U yh(j) = j dy=1 -! V H V H V H V H V H V H V yu(j) = j-0.5 -! U U U U U U yv(j) = j -! V H V H V H V H V H V H V -! U U U U U U -! V H V H V H V H V H V H V + 1 (for V,H) -! U U U U U U + 1 (for U) - -! U(nx ,ny +1),V(nx +1,ny ),H(nx ,ny ) - - use kinds, only: r_kind,i_kind - implicit none -! - private - public :: generate_anl_grid,fv3_h_to_ll,fv3_ll_to_h,fv3uv2earth,earthuv2fv3 - public :: fv3dx,fv3dx1,fv3dy,fv3dy1,fv3ix,fv3ixp,fv3jy,fv3jyp,a3dx,a3dx1,a3dy,a3dy1,a3ix,a3ixp,a3jy,a3jyp - public :: nxa,nya,cangu,sangu,cangv,sangv,nx,ny,bilinear - - logical bilinear - integer(i_kind) nxa,nya,nx,ny - real(r_kind) ,allocatable,dimension(:,:):: fv3dx,fv3dx1,fv3dy,fv3dy1 - integer(i_kind),allocatable,dimension(:,:):: fv3ix,fv3ixp,fv3jy,fv3jyp - real(r_kind) ,allocatable,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 - real(r_kind) ,allocatable,dimension(:,:):: cangu,sangu,cangv,sangv - integer(i_kind),allocatable,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp - - -contains - -subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) -!$$$ subprogram documentation block -! . . . . -! subprogram: generate_anl_grid -! prgmmr: parrish -! -! abstract: define rotated lat-lon analysis grid which is centered on fv3 tile -! and oriented to completely cover the tile. -! -! program history log: -! 2017-05-02 parrish -! 2017-10-10 wu - 1. setup analysis A-grid, -! 2. compute/setup FV3 to A grid interpolation parameters -! 3. compute/setup A to FV3 grid interpolation parameters -! 4. setup weightings for wind conversion from FV3 to earth -! 2019-11-01 wu - add checks to present the mean longitude correctly to fix -! problem near lon=0 -! -! input argument list: -! nx, ny - number of cells = nx*ny -! grid_lon ,grid_lat - longitudes and latitudes of fv3 grid cell corners -! grid_lont,grid_latt - longitudes and latitudes of fv3 grid cell centers -! -! output argument list: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use kinds, only: r_kind,i_kind - use constants, only: quarter,one,two,half,zero,deg2rad,rearth,rad2deg - use gridmod, only:grid_ratio_fv3_regional, region_lat,region_lon,nlat,nlon - use gridmod, only: region_dy,region_dx,region_dyi,region_dxi,coeffy,coeffx - use gridmod, only:init_general_transform,region_dy,region_dx - use gridmod, only: fv3_regional_dd_reduce,nlon_fv3_regional_reduce,nlat_fv3_regional_reduce - use mpimod, only: mype - implicit none - - real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b - real(r_kind),allocatable,dimension(:)::ybh_a,ya_a,ya_b,yy - real(r_kind),allocatable,dimension(:,:)::xbh_b,ybh_b - real(r_kind) dlat,dlon,dyy,dxx,dyyi,dxxi - real(r_kind) dyyh,dxxh - - - integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions - real(r_kind) , intent(inout) :: grid_lon(nx+1,ny+1) ! fv3 cell corner longitudes - real(r_kind) , intent(inout) :: grid_lont(nx,ny) ! fv3 cell center longitudes - real(r_kind) , intent(inout) :: grid_lat(nx+1,ny+1) ! fv3 cell corner latitudes - real(r_kind) , intent(inout) :: grid_latt(nx,ny) ! fv3 cell center latitudes - - integer(i_kind) i,j,ir,jr,n - real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in - real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an - real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon - real(r_kind) adlon,adlat,alon,clat,clon - integer(i_kind) nlonh,nlath,nxh,nyh - integer(i_kind) ib1,ib2,jb1,jb2,jj - - integer(i_kind) nord_e2a - real(r_kind)gxa,gya - - real(r_kind) x(nx+1,ny+1),y(nx+1,ny+1),z(nx+1,ny+1), xr,yr,zr,xu,yu,zu,rlat,rlon - real(r_kind) xv,yv,zv,vval - real(r_kind) cx,cy - real(r_kind) uval,ewval,nsval - real(r_kind) diff,sq180 - real(r_kind) d(4),ds - integer(i_kind) kk,k - - - nord_e2a=4 - bilinear=.false. - - -! create xc,yc,zc for the cell centers. - allocate(xc(nx,ny)) - allocate(yc(nx,ny)) - allocate(zc(nx,ny)) - allocate(gclat(nx,ny)) - allocate(gclon(nx,ny)) - allocate(gcrlat(nx,ny)) - allocate(gcrlon(nx,ny)) - do j=1,ny - do i=1,nx - xc(i,j)=cos(grid_latt(i,j)*deg2rad)*cos(grid_lont(i,j)*deg2rad) - yc(i,j)=cos(grid_latt(i,j)*deg2rad)*sin(grid_lont(i,j)*deg2rad) - zc(i,j)=sin(grid_latt(i,j)*deg2rad) - enddo - enddo - -! compute center as average x,y,z coordinates of corners of domain -- - - xcent=quarter*(xc(1,1)+xc(1,ny)+xc(nx,1)+xc(nx,ny)) - ycent=quarter*(yc(1,1)+yc(1,ny)+yc(nx,1)+yc(nx,ny)) - zcent=quarter*(zc(1,1)+zc(1,ny)+zc(nx,1)+zc(nx,ny)) - - rnorm=one/sqrt(xcent**2+ycent**2+zcent**2) - xcent=rnorm*xcent - ycent=rnorm*ycent - zcent=rnorm*zcent - centlat=asin(zcent)*rad2deg - centlon=atan2(ycent,xcent)*rad2deg - -!! compute new lats, lons - call rotate2deg(grid_lont,grid_latt,gcrlon,gcrlat, & - centlon,centlat,nx,ny) - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! compute analysis A-grid lats, lons -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -!--------------------------obtain analysis grid dimensions nxa,nya - nxa=1+nint((nx-one)/grid_ratio_fv3_regional) - nya=1+nint((ny-one)/grid_ratio_fv3_regional) - nlat=nya - nlon=nxa - if(mype==0) print *,'nlat,nlon=nya,nxa= ',nlat,nlon - -!--------------------------obtain analysis grid spacing - dlat=(maxval(gcrlat)-minval(gcrlat))/(ny-1) - dlon=(maxval(gcrlon)-minval(gcrlon))/(nx-1) - adlat=dlat*grid_ratio_fv3_regional - adlon=dlon*grid_ratio_fv3_regional - -!-------setup analysis A-grid; find center of the domain - nlonh=nlon/2 - nlath=nlat/2 - - if(nlonh*2==nlon)then - clon=adlon/two - cx=half - else - clon=adlon - cx=one - endif - - if(nlath*2==nlat)then - clat=adlat/two - cy=half - else - clat=adlat - cy=one - endif - -! -!-----setup analysis A-grid from center of the domain -! - allocate(rlat_in(nlat,nlon),rlon_in(nlat,nlon)) - do j=1,nlon - alon=(j-nlonh)*adlon-clon - do i=1,nlat - rlon_in(i,j)=alon - enddo - enddo - - - do j=1,nlon - do i=1,nlat - rlat_in(i,j)=(i-nlath)*adlat-clat - enddo - enddo - - if (allocated(region_dx )) deallocate(region_dx ) - if (allocated(region_dy )) deallocate(region_dy ) - allocate(region_dx(nlat,nlon),region_dy(nlat,nlon)) - allocate(region_dxi(nlat,nlon),region_dyi(nlat,nlon)) - allocate(coeffx(nlat,nlon),coeffy(nlat,nlon)) - dyy=rearth*adlat*deg2rad - dyyi=one/dyy - dyyh=half/dyy - do j=1,nlon - do i=1,nlat - region_dy(i,j)=dyy - region_dyi(i,j)=dyyi - coeffy(i,j)=dyyh - enddo - enddo - - do i=1,nlat - dxx=rearth*cos(rlat_in(i,1)*deg2rad)*adlon*deg2rad - dxxi=one/dxx - dxxh=half/dxx - do j=1,nlon - region_dx(i,j)=dxx - region_dxi(i,j)=dxxi - coeffx(i,j)=dxxh - enddo - enddo - -! -!---------- setup region_lat,region_lon in earth coord -! - if (allocated(region_lat)) deallocate(region_lat) - if (allocated(region_lon)) deallocate(region_lon) - allocate(region_lat(nlat,nlon),region_lon(nlat,nlon)) - allocate(glat_an(nlon,nlat),glon_an(nlon,nlat)) - - call unrotate2deg(region_lon,region_lat,rlon_in,rlat_in, & - centlon,centlat,nlat,nlon) - - region_lat=region_lat*deg2rad - region_lon=region_lon*deg2rad - - do j=1,nlat - do i=1,nlon - glat_an(i,j)=region_lat(j,i) - glon_an(i,j)=region_lon(j,i) - enddo - enddo - - call init_general_transform(glat_an,glon_an) - - deallocate(glat_an,glon_an) - -!--------------------compute all combinations of relative coordinates - - allocate(xbh_a(nx),xbh_b(nx,ny),xa_a(nxa),xa_b(nxa)) - allocate(ybh_a(ny),ybh_b(nx,ny),ya_a(nya),ya_b(nya)) - - nxh=nx/2 - nyh=ny/2 - -!!!!!! fv3 rotated grid; not equal spacing, non_orthogonal !!!!!! - do j=1,ny - jr=ny+1-j - do i=1,nx - ir=nx+1-i - xbh_b(ir,jr)=gcrlon(i,j)/dlon - end do - end do - do j=1,ny - jr=ny+1-j - do i=1,nx - ir=nx+1-i - ybh_b(ir,jr)=gcrlat(i,j)/dlat - end do - end do - -!!!! define analysis A grid !!!!!!!!!!!!! - do j=1,nxa - xa_a(j)=(float(j-nlonh)-cx)*grid_ratio_fv3_regional - end do - do i=1,nya - ya_a(i)=(float(i-nlath)-cy)*grid_ratio_fv3_regional - end do - -!!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! - allocate ( fv3dx(nxa,nya),fv3dx1(nxa,nya),fv3dy(nxa,nya),fv3dy1(nxa,nya) ) - allocate ( fv3ix(nxa,nya),fv3ixp(nxa,nya),fv3jy(nxa,nya),fv3jyp(nxa,nya) ) - allocate(yy(ny)) - -! iteration to find the fv3 grid cell - jb1=1 - ib1=1 - do j=1,nya - do i=1,nxa - do n=1,3 - gxa=xa_a(i) - if(gxa < xbh_b(1,jb1))then - gxa= 1 - else if(gxa > xbh_b(nx,jb1))then - gxa= nx - else - call grdcrd1(gxa,xbh_b(1,jb1),nx,1) - endif - ib2=ib1 - ib1=gxa - do jj=1,ny - yy(jj)=ybh_b(ib1,jj) - enddo - gya=ya_a(j) - if(gya < yy(1))then - gya= 1 - else if(gya > yy(ny))then - gya= ny - else - call grdcrd1(gya,yy,ny,1) - endif - jb2=jb1 - jb1=gya - - if((ib1 == ib2) .and. (jb1 == jb2)) exit - if(n==3 ) then -!!!!!!! if not converge, find the nearest corner point - d(1)=(xa_a(i)-xbh_b(ib1,jb1))**2+(ya_a(j)-ybh_b(ib1,jb1))**2 - d(2)=(xa_a(i)-xbh_b(ib1+1,jb1))**2+(ya_a(j)-ybh_b(ib1+1,jb1))**2 - d(3)=(xa_a(i)-xbh_b(ib1,jb1+1))**2+(ya_a(j)-ybh_b(ib1,jb1+1))**2 - d(4)=(xa_a(i)-xbh_b(ib1+1,jb1+1))**2+(ya_a(j)-ybh_b(ib1+1,jb1+1))**2 - kk=1 - do k=2,4 - if(d(k) xa_a(nxa))then - gxa= nxa - else - call grdcrd1(gxa,xa_a,nxa,1) - endif - a3ix(j,i)=int(gxa) - a3ix(j,i)=min(max(1,a3ix(j,i)),nxa) - a3dx(j,i)=max(zero,min(one,gxa-a3ix(j,i))) - a3dx1(j,i)=one-a3dx(j,i) - a3ixp(j,i)=min(nxa,a3ix(j,i)+1) - end do - end do - - do i=1,nx - do j=1,ny - gya=ybh_b(i,j) - if(gya < ya_a(1))then - gya= 1 - else if(gya > ya_a(nya))then - gya= nya - else - call grdcrd1(gya,ya_a,nya,1) - endif - a3jy(j,i)=int(gya) - a3jy(j,i)=min(max(1,a3jy(j,i)),nya) - a3dy(j,i)=max(zero,min(one,gya-a3jy(j,i))) - a3dy1(j,i)=one-a3dy(j,i) - a3jyp(j,i)=min(ny,a3jy(j,i)+1) - end do - end do - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! find coefficients for wind conversion btw FV3 & earth -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - allocate ( cangu(nx,ny+1),sangu(nx,ny+1),cangv(nx+1,ny),sangv(nx+1,ny) ) - -! 1. compute x,y,z at cell cornor from grid_lon, grid_lat - - do j=1,ny+1 - do i=1,nx+1 - x(i,j)=cos(grid_lat(i,j)*deg2rad)*cos(grid_lon(i,j)*deg2rad) - y(i,j)=cos(grid_lat(i,j)*deg2rad)*sin(grid_lon(i,j)*deg2rad) - z(i,j)=sin(grid_lat(i,j)*deg2rad) - enddo - enddo - -! 2 find angles to E-W and N-S for U edges - sq180=180._r_kind**2 - do j=1,ny+1 - do i=1,nx -! center lat/lon of the edge - rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) - diff=(grid_lon(i,j)-grid_lon(i+1,j))**2 - if(diff < sq180)then - rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) - else - rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)-360._r_kind) - endif -! vector to center of the edge - xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) - yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) - zr=sin(rlat*deg2rad) -! vector of the edge - xu= x(i+1,j)-x(i,j) - yu= y(i+1,j)-y(i,j) - zu= z(i+1,j)-z(i,j) -! find angle with cross product - uval=sqrt((xu**2+yu**2+zu**2)) - ewval=sqrt((xr**2+yr**2)) - nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) - cangu(i,j)=(-yr*xu+xr*yu)/ewval/uval - sangu(i,j)=(-xr*zr*xu-zr*yr*yu+(xr*xr+yr*yr)*zu) / nsval/uval - enddo - enddo - -! 3 find angles to E-W and N-S for V edges - do j=1,ny - do i=1,nx+1 - rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) - diff=(grid_lon(i,j)-grid_lon(i,j+1))**2 - if(diff < sq180)then - rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) - else - rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)-360._r_kind) - endif - xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) - yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) - zr=sin(rlat*deg2rad) - xv= x(i,j+1)-x(i,j) - yv= y(i,j+1)-y(i,j) - zv= z(i,j+1)-z(i,j) - vval=sqrt((xv**2+yv**2+zv**2)) - ewval=sqrt((xr**2+yr**2)) - nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) - cangv(i,j)=(-yr*xv+xr*yv)/ewval/vval - sangv(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval - enddo - enddo -!clt following Hongli Wang's treatment - if(fv3_regional_dd_reduce) then - !write(*,*)'testing Hongli code' - if(nlon_fv3_regional_reduce.le.0.and.nlat_fv3_regional_reduce.le.0) then - nlon_fv3_regional_reduce=nint((maxval(gcrlon)-maxval(gcrlon(:,ny/2)))/adlon) - j=nlon_fv3_regional_reduce - nlat_fv3_regional_reduce=nint((gcrlat(j,ny)-minval(gcrlat))/adlat) - if(nlon_fv3_regional_reduce.lt.0) nlon_fv3_regional_reduce=0 - if(nlat_fv3_regional_reduce.lt.0) nlat_fv3_regional_reduce=0 - endif - endif - deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) -end subroutine generate_anl_grid - -subroutine earthuv2fv3(u,v,nx,ny,u_out,v_out) -!$$$ subprogram documentation block -! . . . . -! subprogram: earthuv2fv3 -! prgmmr: wu 2017-06-15 -! -! abstract: project earth UV to fv3 UV and interpolate to edge of the cell -! -! program history log: -! -! -! input argument list: -! u,v - earth wind components at center of the cell -! nx,ny - dimensions -! -! output argument list: -! u_out,v_out - output fv3 winds on the cell boundaries -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use kinds, only: r_kind,i_kind - use constants, only: half - implicit none - - integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions - real(r_kind),intent(in ) :: u(nx,ny),v(nx,ny) - real(r_kind),intent( out) :: u_out(nx,ny+1),v_out(nx+1,ny) - integer(i_kind) i,j - - -!!!!!!! earth u/v to covariant u/v - j=1 - do i=1,nx - u_out(i,j)= u(i,j)*cangu(i,j)+v(i,j)*sangu(i,j) - end do - - do j=2,ny - do i=1,nx - u_out(i,j)=half *( (u(i,j)+u(i,j-1))*cangu(i,j)+(v(i,j)+v(i,j-1))*sangu(i,j) ) - end do - end do - j=ny - do i=1,nx - u_out(i,j+1)= u(i,j)*cangu(i,j+1)+v(i,j)*sangu(i,j+1) - end do - - do j=1,ny - v_out(1,j)=u(1,j)*cangv(1,j)+v(1,j)*sangv(1,j) - do i=2,nx - v_out(i,j)=half *( (u(i,j)+u(i-1,j))*cangv(i,j)+(v(i,j)+v(i-1,j))*sangv(i,j) ) - end do - v_out(nx+1,j)=u(nx,j)*cangv(nx+1,j)+v(nx,j)*sangv(nx+1,j) - end do -end subroutine earthuv2fv3 - -subroutine fv3uv2earth(u,v,nx,ny,u_out,v_out) -!$$$ subprogram documentation block -! . . . . -! subprogram: fv3uv2earth -! prgmmr: wu 2017-06-15 -! -! abstract: project fv3 UV to earth UV and interpolate to the center of the cells -! -! program history log: -! -! -! input argument list: -! u,v - fv3 winds on the cell boundaries -! nx,ny - dimensions -! -! output argument list: -! u_out,v_out - output earth wind components at center of the cell -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use kinds, only: r_kind,i_kind - use constants, only: half - implicit none - - integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions - real(r_kind),intent(in ) :: u(nx,ny+1),v(nx+1,ny) - real(r_kind),intent( out) :: u_out(nx,ny),v_out(nx,ny) - integer(i_kind) i,j - - do j=1,ny - do i=1,nx - u_out(i,j)=half *( (u(i,j)*sangv(i,j)-v(i,j)*sangu(i,j))/(cangu(i,j)*sangv(i,j)-sangu(i,j)*cangv(i,j)) & - +(u(i,j+1)*sangv(i+1,j)-v(i+1,j)*sangu(i,j+1))/(cangu(i,j+1)*sangv(i+1,j)-sangu(i,j+1)*cangv(i+1,j))) - v_out(i,j)=half *( (u(i,j)*cangv(i,j)-v(i,j)*cangu(i,j))/(sangu(i,j)*cangv(i,j)-cangu(i,j)*sangv(i,j)) & - +(u(i,j+1)*cangv(i+1,j)-v(i+1,j)*cangu(i,j+1))/(sangu(i,j+1)*cangv(i+1,j)-cangu(i,j+1)*sangv(i+1,j))) - end do - end do - return -end subroutine fv3uv2earth - -subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma) -!$$$ subprogram documentation block -! . . . . -! subprogram: fv3_h_to_ll -! prgmmr: wu 2017-05-30 -! -! abstract: interpolate from rotated fv3 grid to A grid. -! Interpolation choices 1)bilinear both ways -! 2)inverse-distance weighting average -! reverse E-W and N-S directions & reverse i,j for output array a(nlat,nlon) -! -! program history log: -! -! -! input argument list: -! mb,nb - fv3 dimensions -! ma,na - a dimensions -! b - input variable b -! xb,yb - b array x and y coordinates -! xa,ya - a array coordinates (xa in xb units, ya in yb units) -! -! output argument list: -! a - output interpolated array -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use constants, only: zero,one - implicit none - - integer(i_kind),intent(in ) :: mb,nb,ma,na - real(r_kind) ,intent(in ) :: b_in(nb,mb) - real(r_kind) ,intent( out) :: a(ma,na) - - integer(i_kind) i,j,ir,jr,mbp,nbp - real(r_kind) b(nb,mb) - -!!!!!!!!! reverse E-W and N-S - mbp=mb+1 - nbp=nb+1 - do j=1,mb - jr=mbp-j - do i=1,nb - ir=nbp-i - b(ir,jr)=b_in(i,j) - end do - end do -!!!!!!!!! interpolate to A grid & reverse ij for array a(lat,lon) - if(bilinear)then ! bilinear interpolation - do j=1,ma - do i=1,na - a(j,i)=fv3dx1(i,j)*(fv3dy1(i,j)*b(fv3ix (i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ix (i,j),fv3jyp(i,j))) & - +fv3dx (i,j)*(fv3dy1(i,j)*b(fv3ixp(i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ixp(i,j),fv3jyp(i,j))) - end do - end do - else ! inverse-distance weighting average - do j=1,ma - do i=1,na - a(j,i)=fv3dx(i,j)*b(fv3ix (i,j),fv3jy(i,j))+fv3dy(i,j)*b(fv3ix (i,j),fv3jyp(i,j)) & - +fv3dx1(i,j)*b(fv3ixp(i,j),fv3jy(i,j))+fv3dy1(i,j)*b(fv3ixp(i,j),fv3jyp(i,j)) - end do - end do - endif - return -end subroutine fv3_h_to_ll - -subroutine fv3_ll_to_h(a,b,nxa,nya,nxb,nyb,rev_flg) -!$$$ subprogram documentation block -! . . . . -! subprogram: fv3_ll_to_h -! prgmmr: wu 2017-05-30 -! -! abstract: interpolate from analysis A grid to rotated fv3 grid. -! Interpolation is bilinear both ways. Reverse E-W and N-S and -! reverse i,j for output array b(nxb,nyb) -! -! program history log: -! -! -! input argument list: -! nxa,nya - a array dimensions -! nxb,nyb - b array dimensions -! -! b - input variable b -! rev_flg - flag for reverse i,j order -! output argument list: -! a - output interpolated array -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use kinds, only: r_kind,i_kind - use constants, only: zero,one - implicit none - - integer(i_kind),intent(in ) :: nyb,nxb,nya,nxa - real(r_kind) ,intent(in ) :: a(nya,nxa) - logical ,intent(in ) :: rev_flg - real(r_kind) ,intent( out) :: b(nxb*nyb) - - integer(i_kind) i,j,ir,jr,nybp,nxbp,ijr - - if(rev_flg)then -!!!!!!!!!! output in reverse E-W, N-S and reversed i,j !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - nybp=nyb+1 - nxbp=nxb+1 - do i=1,nyb - ir=nybp-i - ijr=(ir-1)*nxb - do j=1,nxb - jr=nxbp-j - b(jr+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & - +a3dy (i,j)*(a3dx1(i,j)*a(a3jyp(i,j),a3ix(i,j))+a3dx(i,j)*a(a3jyp(i,j),a3ixp(i,j))) - end do - end do - else -!!!!!!!!!! output order as input W-E S-N and (i:lat,j:lon) !!!!!!!!!!! - do j=1,nxb - ijr=(j-1)*nyb - do i=1,nyb - b(i+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & - +a3dy (i,j)*(a3dx1(i,j)*a(a3jyp(i,j),a3ix(i,j))+a3dx(i,j)*a(a3jyp(i,j),a3ixp(i,j))) - end do - end do - endif -end subroutine fv3_ll_to_h - -end module mod_fv3_lola - -subroutine rotate2deg(rlon_in,rlat_in,rlon_out,rlat_out,rlon0,rlat0,nx,ny) -!$$$ subprogram documentation block -! . . . . -! subprogram: rotate2deg -! -! prgmmr: parrish -! -! Rotate right-handed spherical coordinate to new right-handed spherical -! coordinate. The coordinates are latitude (-90 to 90) and longitude. -! Output for longitude is principle range of atan2d function ( -180 < rlon_out <= 180 ) -! -! program history log: -! 2017-05-02 parrish -! -! Method is as follows: -! 1. define x,y,z coordinate system with origin at center of sphere, -! x intersecting sphere at 0 deg N, 0 deg E, -! y intersecting sphere at 0 deg N, 90 deg E, -! z intersecting sphere at 90 deg N (north pole). - -! 4 steps: - -! 1. compute x,y,z from rlon_in, rlat_in - -! 2. rotate (x,y,z) about z axis by amount rlon0 -- (x,y,z) --> (xt,yt,zt) - -! 3. rotate (xt,yt,zt) about yt axis by amount rlat0 --- (xt,yt,zt) --> (xtt,ytt,ztt) - -! 4. compute rlon_out, rlat_out from xtt,ytt,ztt - -! This is the desired new orientation, where (0N, 0E) maps to point -! (rlon0,rlat0) in original coordinate and the new equator is tangent to -! the original latitude circle rlat0 at original longitude rlon0. -! attributes: -! langauge: f90 -! machine: -! -!$$$ end documentation block - - - use kinds, only: r_kind,i_kind - use constants, only: deg2rad,rad2deg - implicit none - - integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions - real(r_kind),intent(in ) :: rlon_in(nx,ny),rlat_in(nx,ny),rlon0,rlat0 - real(r_kind),intent( out) :: rlon_out(nx,ny),rlat_out(nx,ny) - - real(r_kind) x,y,z, xt,yt,zt, xtt,ytt,ztt - integer(i_kind) i,j - - do j=1,ny - do i=1,nx -! 1. compute x,y,z from rlon_in, rlat_in - - x=cos(rlat_in(i,j)*deg2rad)*cos(rlon_in(i,j)*deg2rad) - y=cos(rlat_in(i,j)*deg2rad)*sin(rlon_in(i,j)*deg2rad) - z=sin(rlat_in(i,j)*deg2rad) - -! 2. rotate (x,y,z) about z axis by amount rlon0 -- (x,y,z) --> (xt,yt,zt) - - xt= x*cos(rlon0*deg2rad)+y*sin(rlon0*deg2rad) - yt=-x*sin(rlon0*deg2rad)+y*cos(rlon0*deg2rad) - zt=z - -! 3. rotate (xt,yt,zt) about yt axis by amount rlat0 --- (xt,yt,zt) --> (xtt,ytt,ztt) - - xtt= xt*cos(rlat0*deg2rad)+zt*sin(rlat0*deg2rad) - ytt= yt - ztt=-xt*sin(rlat0*deg2rad)+zt*cos(rlat0*deg2rad) - -! 4. compute rlon_out, rlat_out from xtt,ytt,ztt - - rlat_out(i,j)=asin(ztt)*rad2deg - rlon_out(i,j)=atan2(ytt,xtt)*rad2deg - enddo - enddo -end subroutine rotate2deg - -subroutine unrotate2deg(rlon_in,rlat_in,rlon_out,rlat_out,rlon0,rlat0,nx,ny) -!$$$ subprogram documentation block -! . . . . -! subprogram: unrotate2deg -! -! prgmmr: parrish -! -! abstract: inverse of rotate2deg. -! -! program history log: -! 2017-05-02 parrish - -! attributes: -! langauge: f90 -! machine: -! -!$$$ end documentation block - - use kinds, only: r_kind,i_kind - use constants, only: deg2rad,rad2deg - implicit none - - real(r_kind),intent(in ) :: rlon_out(nx,ny),rlat_out(nx,ny),rlon0,rlat0 - integer(i_kind),intent(in ) :: nx,ny - real(r_kind),intent( out) :: rlon_in(nx,ny),rlat_in(nx,ny) - - real(r_kind) x,y,z, xt,yt,zt, xtt,ytt,ztt - integer(i_kind) i,j - do j=1,ny - do i=1,nx - xtt=cos(rlat_out(i,j)*deg2rad)*cos(rlon_out(i,j)*deg2rad) - ytt=cos(rlat_out(i,j)*deg2rad)*sin(rlon_out(i,j)*deg2rad) - ztt=sin(rlat_out(i,j)*deg2rad) - - xt= xtt*cos(rlat0*deg2rad)-ztt*sin(rlat0*deg2rad) - yt= ytt - zt= xtt*sin(rlat0*deg2rad)+ztt*cos(rlat0*deg2rad) - - x= xt*cos(rlon0*deg2rad)-yt*sin(rlon0*deg2rad) - y= xt*sin(rlon0*deg2rad)+yt*cos(rlon0*deg2rad) - z= zt - - rlat_in(i,j)=asin(z)*rad2deg - rlon_in(i,j)=atan2(y,x)*rad2deg - enddo - enddo - -end subroutine unrotate2deg diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 4ccb6cc4b4..c1b76e134b 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -1396,3 +1396,130 @@ end subroutine fv3_ll_to_h_regular_grids end module mod_fv3_lolgrid +subroutine rotate2deg(rlon_in,rlat_in,rlon_out,rlat_out,rlon0,rlat0,nx,ny) +!$$$ subprogram documentation block +! . . . . +! subprogram: rotate2deg +! +! prgmmr: parrish +! +! Rotate right-handed spherical coordinate to new right-handed spherical +! coordinate. The coordinates are latitude (-90 to 90) and longitude. +! Output for longitude is principle range of atan2d function ( -180 < rlon_out <= 180 ) +! +! program history log: +! 2017-05-02 parrish +! +! Method is as follows: +! 1. define x,y,z coordinate system with origin at center of sphere, +! x intersecting sphere at 0 deg N, 0 deg E, +! y intersecting sphere at 0 deg N, 90 deg E, +! z intersecting sphere at 90 deg N (north pole). + +! 4 steps: + +! 1. compute x,y,z from rlon_in, rlat_in + +! 2. rotate (x,y,z) about z axis by amount rlon0 -- (x,y,z) --> (xt,yt,zt) + +! 3. rotate (xt,yt,zt) about yt axis by amount rlat0 --- (xt,yt,zt) --> (xtt,ytt,ztt) + +! 4. compute rlon_out, rlat_out from xtt,ytt,ztt + +! This is the desired new orientation, where (0N, 0E) maps to point +! (rlon0,rlat0) in original coordinate and the new equator is tangent to +! the original latitude circle rlat0 at original longitude rlon0. +! attributes: +! langauge: f90 +! machine: +! +!$$$ end documentation block + + + use kinds, only: r_kind,i_kind + use constants, only: deg2rad,rad2deg + implicit none + + integer(i_kind), intent(in ) :: nx,ny ! fv3 tile x- and y-dimensions + real(r_kind),intent(in ) :: rlon_in(nx,ny),rlat_in(nx,ny),rlon0,rlat0 + real(r_kind),intent( out) :: rlon_out(nx,ny),rlat_out(nx,ny) + + real(r_kind) x,y,z, xt,yt,zt, xtt,ytt,ztt + integer(i_kind) i,j + + do j=1,ny + do i=1,nx +! 1. compute x,y,z from rlon_in, rlat_in + + x=cos(rlat_in(i,j)*deg2rad)*cos(rlon_in(i,j)*deg2rad) + y=cos(rlat_in(i,j)*deg2rad)*sin(rlon_in(i,j)*deg2rad) + z=sin(rlat_in(i,j)*deg2rad) + +! 2. rotate (x,y,z) about z axis by amount rlon0 -- (x,y,z) --> (xt,yt,zt) + + xt= x*cos(rlon0*deg2rad)+y*sin(rlon0*deg2rad) + yt=-x*sin(rlon0*deg2rad)+y*cos(rlon0*deg2rad) + zt=z + +! 3. rotate (xt,yt,zt) about yt axis by amount rlat0 --- (xt,yt,zt) --> (xtt,ytt,ztt) + + xtt= xt*cos(rlat0*deg2rad)+zt*sin(rlat0*deg2rad) + ytt= yt + ztt=-xt*sin(rlat0*deg2rad)+zt*cos(rlat0*deg2rad) + +! 4. compute rlon_out, rlat_out from xtt,ytt,ztt + + rlat_out(i,j)=asin(ztt)*rad2deg + rlon_out(i,j)=atan2(ytt,xtt)*rad2deg + enddo + enddo +end subroutine rotate2deg + +subroutine unrotate2deg(rlon_in,rlat_in,rlon_out,rlat_out,rlon0,rlat0,nx,ny) +!$$$ subprogram documentation block +! . . . . +! subprogram: unrotate2deg +! +! prgmmr: parrish +! +! abstract: inverse of rotate2deg. +! +! program history log: +! 2017-05-02 parrish + +! attributes: +! langauge: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: deg2rad,rad2deg + implicit none + + real(r_kind),intent(in ) :: rlon_out(nx,ny),rlat_out(nx,ny),rlon0,rlat0 + integer(i_kind),intent(in ) :: nx,ny + real(r_kind),intent( out) :: rlon_in(nx,ny),rlat_in(nx,ny) + + real(r_kind) x,y,z, xt,yt,zt, xtt,ytt,ztt + integer(i_kind) i,j + do j=1,ny + do i=1,nx + xtt=cos(rlat_out(i,j)*deg2rad)*cos(rlon_out(i,j)*deg2rad) + ytt=cos(rlat_out(i,j)*deg2rad)*sin(rlon_out(i,j)*deg2rad) + ztt=sin(rlat_out(i,j)*deg2rad) + + xt= xtt*cos(rlat0*deg2rad)-ztt*sin(rlat0*deg2rad) + yt= ytt + zt= xtt*sin(rlat0*deg2rad)+ztt*cos(rlat0*deg2rad) + + x= xt*cos(rlon0*deg2rad)-yt*sin(rlon0*deg2rad) + y= xt*sin(rlon0*deg2rad)+yt*cos(rlon0*deg2rad) + z= zt + + rlat_in(i,j)=asin(z)*rad2deg + rlon_in(i,j)=atan2(y,x)*rad2deg + enddo + enddo + +end subroutine unrotate2deg From 27d87988756df966a8327b9b43eda93b6f2d70ca Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Fri, 4 Jun 2021 16:05:43 -0500 Subject: [PATCH 078/155] Modifications from Xu Lu and Xuguang Wang (OU) to enable TDR and NEXRAD radial wind OBS being properly ingested/assimilated in the EnKF analysis. POC: xuguang.wang@ou.edu. --- src/gsi/setuprw.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsi/setuprw.f90 b/src/gsi/setuprw.f90 index 7b00caea4f..f471b5aaaf 100644 --- a/src/gsi/setuprw.f90 +++ b/src/gsi/setuprw.f90 @@ -1158,7 +1158,7 @@ subroutine contents_netcdf_diag_(odiag) real(r_kind),dimension(miter) :: obsdiag_iuse call nc_diag_metadata("Station_ID", station_id ) call nc_diag_metadata("Observation_Class", obsclass ) - call nc_diag_metadata("Observation_Type", data(iobs_type,i) ) + call nc_diag_metadata("Observation_Type", ictype(ikx) ) call nc_diag_metadata("Observation_Subtype", icsubtype(ikx) ) call nc_diag_metadata("Latitude", sngl(data(ilate,i)) ) call nc_diag_metadata("Longitude", sngl(data(ilone,i)) ) From af7b9786015a7a0c56deb8d668aca834faefe4e5 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Mon, 14 Jun 2021 09:12:14 -0400 Subject: [PATCH 079/155] Bug fix for enkf analysis steps when using t(tv) as a control vector variable for regional FV3 DA (#12) *Bug fix for EnKF analysis steps when using t (tv) as a control vector variable for regional FV3 DA. *Whitespace and indentation clean-ups were made in src/enkf/gridio_fv3reg.f90. Notes: This PR addresses issue #13, which was reported by Jonathan Poterjoy (UMD). And this bug should have affected all the EnKF steps (mean, update, recenter, etc.) The bug fix is based on the diagnoses and discussions among @BinLiu-NOAA and @TingLei-NOAA (EMC), @XL-OU, Jonathan Poterjoy (UMD), Jason Sippel (HRD), etc. --- src/enkf/gridio_fv3reg.f90 | 754 ++++++++++++++++++------------------- 1 file changed, 359 insertions(+), 395 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 3d80ac9437..faf37e90de 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -3,17 +3,17 @@ module gridio !======================================================================== !$$$ Module documentation block - ! + ! ! This module contains various routines to ingest and update ! variables from FV3-LAM warmstart files ! ! prgmmr: Winterbottom org: ESRL/PSD1 date: 2011-11-30 ! ! program history log: - ! + ! ! 2011-11-30 Winterbottom - Initial version. ! - ! 2019-01- Ting -- modified for fv3-lam + ! 2019-01- Ting -- modified for fv3-lam ! attributes: ! language: f95 ! @@ -46,26 +46,24 @@ module gridio contains subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,filesfcprefixes,reducedgrid,vargrid,qsat) - use constants, only:zero,one,half,fv, max_varname_length - use gridinfo,only: eta1_ll - use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr - use netcdf, only: nf90_inq_dimid,nf90_inq_varid - use netcdf, only: nf90_nowrite,nf90_write,nf90_inquire,nf90_inquire_dimension - implicit none - integer, intent(in) :: nanal1,nanal2, n2d, n3d, ndim, ntimes - character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d - character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d - integer, dimension(0:n3d), intent(in) :: levels - character(len=120), dimension(7), intent(in) :: fileprefixes - character(len=120), dimension(7), intent(in) :: filesfcprefixes - logical, intent(in) :: reducedgrid - - real(r_single), dimension(npts,ndim,ntimes,nanal2-nanal1+1), intent(out) :: vargrid - real(r_double), dimension(npts,nlevs,ntimes,nanal2-nanal1+1), intent(out) :: qsat - - - - ! Define local variables + use constants, only:zero,one,half,fv, max_varname_length + use gridinfo,only: eta1_ll + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_inq_dimid,nf90_inq_varid + use netcdf, only: nf90_nowrite,nf90_write,nf90_inquire,nf90_inquire_dimension + implicit none + integer, intent(in) :: nanal1,nanal2, n2d, n3d, ndim, ntimes + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, dimension(0:n3d), intent(in) :: levels + character(len=120), dimension(7), intent(in) :: fileprefixes + character(len=120), dimension(7), intent(in) :: filesfcprefixes + logical, intent(in) :: reducedgrid + + real(r_single), dimension(npts,ndim,ntimes,nanal2-nanal1+1), intent(out) :: vargrid + real(r_double), dimension(npts,nlevs,ntimes,nanal2-nanal1+1), intent(out) :: qsat + + ! Define local variables character(len=500) :: filename character(len=:),allocatable :: fv3filename character(len=7) :: charnanal @@ -78,8 +76,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f ! Define variables required for netcdf variable I/O character(len=12) :: varstrname - - + character(len=1) char_tile character(len=24),parameter :: myname_ = 'fv3: getgriddata' @@ -102,7 +99,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f delp_ind = getindex(vars3d, 'delp') ! delp (3D) oz_ind = getindex(vars3d, 'oz') ! Oz (3D) tsen_ind = getindex(vars3d, 'tsen') !sensible T (3D) -! prse_ind = getindex(vars3d, 'prse') ! pressure + !prse_ind = getindex(vars3d, 'prse') ! pressure ps_ind = getindex(vars2d, 'ps') ! Ps (2D) sst_ind = getindex(vars2d, 'sst') ! SST (2D) @@ -125,270 +122,252 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f ! Define character string for ensemble member file if (nanal > 0) then - write(charnanal,'(a3, i3.3)') 'mem', nanal + write(charnanal,'(a3, i3.3)') 'mem', nanal else - charnanal = 'ensmean' + charnanal = 'ensmean' endif - do ntile=1,ntiles - nn_tile0=(ntile-1)*nx_res*ny_res - write(char_tile, '(i1)') ntile + do ntile=1,ntiles + + nn_tile0=(ntile-1)*nx_res*ny_res + write(char_tile, '(i1)') ntile - filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) - fv3filename=trim(adjustl(filename))//"_dynvartracer" + filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) + fv3filename=trim(adjustl(filename))//"_dynvartracer" !---------------------------------------------------------------------- ! read u-component - call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(fv3filename)) ) + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) - + if (u_ind > 0) then - allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) - varstrname = 'u' + allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) + varstrname = 'u' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) - do k=1,nlevs + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) + do k=1,nlevs nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(u_ind-1)+k,nb,ne)=uworkvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(u_ind-1)+1, levels(u_ind) - if (nproc .eq. 0) & + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(u_ind-1)+k,nb,ne)=uworkvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(u_ind-1)+1, levels(u_ind) + if (nproc .eq. 0) & write(6,*) 'READFVregional : u ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo - - deallocate(uworkvar3d) + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + enddo + deallocate(uworkvar3d) endif + if (v_ind > 0) then - allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) + allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) varstrname = 'v' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) - do k=1,nlevs - nn = nn_tile0 + do k=1,nlevs + nn = nn_tile0 do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(v_ind-1)+k,nb,ne)=vworkvar3d(i,j,k) - enddo + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(v_ind-1)+k,nb,ne)=vworkvar3d(i,j,k) + enddo + enddo enddo - enddo - do k = levels(v_ind-1)+1, levels(v_ind) - if (nproc .eq. 0) & + do k = levels(v_ind-1)+1, levels(v_ind) + if (nproc .eq. 0) & write(6,*) 'READFVregional : v ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo - deallocate(vworkvar3d) - + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + enddo + deallocate(vworkvar3d) endif - if (delp_ind > 0) then - varstrname = 'delp' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(delp_ind-1)+k,nb,ne)=workvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(delp_ind-1)+1, levels(delp_ind) - if (nproc .eq. 0) & - write(6,*) 'READFVregional : delp ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo + if (delp_ind > 0) then + varstrname = 'delp' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(delp_ind-1)+k,nb,ne)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(delp_ind-1)+1, levels(delp_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : delp ', & + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + enddo endif - if (q_ind > 0) then - varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(q_ind-1)+k,nb,ne)=qworkvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(q_ind-1)+1, levels(q_ind) - if (nproc .eq. 0) & - write(6,*) 'READFVregional : q ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - enddo + if (q_ind > 0) then + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(q_ind-1)+k,nb,ne)=qworkvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(q_ind-1)+1, levels(q_ind) + if (nproc .eq. 0) & + write(6,*) 'READFVregional : q ', & + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + enddo endif - if (tv_ind > 0.or.tsen_ind) then + + if (tv_ind > 0 .or. tsen_ind > 0) then allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) varstrname = 'T' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - if(tv_ind > 0) then - if(.not. (q_ind > 0)) then + if (tv_ind > 0) then + if (.not. (q_ind > 0)) then varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) endif - do k=1,nlevs - do j=1,ny_res - do i=1,nx_res - workvar3d(i,j,k)=tsenworkvar3d(i,j,k)*(one+fv*qworkvar3d(i,j,k)) - enddo - enddo - enddo - tvworkvar3d=workvar3d - else! tsen_id >0 - workvar3d=tsenworkvar3d - tvworkvar3d=workvar3d*(one+fv*qworkvar3d) - endif - tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(tmp_ind-1)+k,nb,ne)=workvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(tmp_ind-1)+1, levels(tmp_ind) - if (nproc .eq. 0) then - write(6,*) 'READFVregional : tv or tsen ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) - endif - enddo - - endif - if(allocated(tsenworkvar3d)) deallocate(tsenworkvar3d) - - - - if (oz_ind > 0) then + do k=1,nlevs + do j=1,ny_res + do i=1,nx_res + workvar3d(i,j,k)=tsenworkvar3d(i,j,k)*(one+fv*qworkvar3d(i,j,k)) + enddo + enddo + enddo + tvworkvar3d=workvar3d + else! tsen_id >0 + workvar3d=tsenworkvar3d + tvworkvar3d=workvar3d*(one+fv*qworkvar3d) + endif + tmp_ind=max(tv_ind,tsen_ind) !then can't be both >0 + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(tmp_ind-1)+k,nb,ne)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(tmp_ind-1)+1, levels(tmp_ind) + if (nproc .eq. 0) then + write(6,*) 'READFVregional : tv or tsen ', & + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + endif + enddo + endif + if(allocated(tsenworkvar3d)) deallocate(tsenworkvar3d) + + if (oz_ind > 0) then varstrname = 'o3mr' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - do k=1,nlevs + do k=1,nlevs nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(oz_ind-1)+k,nb,ne)=workvar3d(i,j,k) - enddo - enddo - enddo - do k = levels(oz_ind-1)+1, levels(oz_ind) + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(oz_ind-1)+k,nb,ne)=workvar3d(i,j,k) + enddo + enddo + enddo + do k = levels(oz_ind-1)+1, levels(oz_ind) if (nproc .eq. 0) & write(6,*) 'READFVregional : oz ', & - & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) + & k, minval(vargrid(:,k,nb,ne)), maxval(vargrid(:,k,nb,ne)) enddo - endif - + call nc_check( nf90_close(file_id),& myname_,'close '//trim(fv3filename) ) + ! set SST to zero for now if (sst_ind > 0) then vargrid(:,levels(n3d)+sst_ind,nb,ne) = zero endif - !---------------------------------------------------------------------- ! Allocate memory for variables computed within routine - + if (ps_ind > 0) then - allocate(workprsi(nx_res,ny_res,nlevsp1)) - allocate(pswork(nx_res,ny_res)) - fv3filename=trim(adjustl(filename))//"_dynvartracer" - call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& - myname_,'open: '//trim(adjustl(fv3filename)) ) - call read_fv3_restart_data3d('delp',fv3filename,file_id,workvar3d) + allocate(workprsi(nx_res,ny_res,nlevsp1)) + allocate(pswork(nx_res,ny_res)) + fv3filename=trim(adjustl(filename))//"_dynvartracer" + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_nowrite,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) + call read_fv3_restart_data3d('delp',fv3filename,file_id,workvar3d) !print *,'min/max delp',ntile,minval(delp),maxval(delp) - call nc_check( nf90_close(file_id),& - myname_,'close '//trim(fv3filename) ) - workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed - do i=nlevs,1,-1 - workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) - enddo - - pswork(:,:)=workprsi(:,:,1) - - - - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - vargrid(nn,levels(n3d)+ps_ind, nb,ne) =pswork(i,j) - enddo - enddo + call nc_check( nf90_close(file_id),& + myname_,'close '//trim(fv3filename) ) + workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed + do i=nlevs,1,-1 + workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) + enddo + pswork(:,:)=workprsi(:,:,1) - - + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + vargrid(nn,levels(n3d)+ps_ind, nb,ne) =pswork(i,j) + enddo + enddo - - do k=1,nlevs - do j=1,ny_res - do i=1,nx_res - workvar3d(i,j,k)=(workprsi(i,j,k)+workprsi(i,j,k+1))*half - enddo - enddo - enddo - ice=.true. !tothink - if (pseudo_rh) then - call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & - nx_res*ny_res,nlevs) - else - qsatworkvar3d(:,:,:) = 1._r_double - endif - do k=1,nlevs + do k=1,nlevs + do j=1,ny_res + do i=1,nx_res + workvar3d(i,j,k)=(workprsi(i,j,k)+workprsi(i,j,k+1))*half + enddo + enddo + enddo + ice=.true. !tothink + if (pseudo_rh) then + call genqsat1(qworkvar3d,qsatworkvar3d,workvar3d,tvworkvar3d,ice, & + nx_res*ny_res,nlevs) + else + qsatworkvar3d(:,:,:) = 1._r_double + endif + do k=1,nlevs nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - qsat(nn,k,nb,ne)=qsatworkvar3d(i,j,k) - enddo - enddo - enddo - - - - + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + qsat(nn,k,nb,ne)=qsatworkvar3d(i,j,k) + enddo + enddo + enddo - if(allocated(workprsi)) deallocate(workprsi) - if(allocated(pswork)) deallocate(pswork) - if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) - if(allocated(qworkvar3d)) deallocate(qworkvar3d) - if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) + if(allocated(workprsi)) deallocate(workprsi) + if(allocated(pswork)) deallocate(pswork) + if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) + if(allocated(qworkvar3d)) deallocate(qworkvar3d) + if(allocated(qsatworkvar3d)) deallocate(qsatworkvar3d) endif !====================================================================== - ! Deallocate memory + ! Deallocate memory if(allocated(workvar3d)) deallocate(workvar3d) - end do ! ntile loop + + end do ! ntile loop end do backgroundloop ! loop over backgrounds to read in - end do ensmemloop ! loop over ens members to read in + end do ensmemloop ! loop over ens members to read in return -end subroutine readgriddata - - !======================================================================== - ! readgriddata: read fv3-lam state or control vector - !------------------------------------------------------------------------- - + end subroutine readgriddata !======================================================================== - ! writegriddata: write fv3-lam + ! writegriddata: write fv3-lam !------------------------------------------------------------------------- -subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) + subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) use constants, only: zero, one,fv,half - use gridinfo,only: eta1_ll,eta2_ll + use gridinfo,only: eta1_ll,eta2_ll use params, only: nbackgrounds, anlfileprefixes, fgfileprefixes use params, only: nx_res,ny_res,nlevs,ntiles,l_pres_add_saved use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr @@ -396,7 +375,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid use netcdf, only: nf90_write,nf90_write,nf90_inquire,nf90_inquire_dimension use write_fv3regional_restarts,only:write_fv3_restart_data1d,write_fv3_restart_data2d use write_fv3regional_restarts,only:write_fv3_restart_data3d,write_fv3_restart_data4d - include 'netcdf.inc' + include 'netcdf.inc' !---------------------------------------------------------------------- ! Define variables passed to subroutine @@ -418,7 +397,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid integer(i_kind) :: w_ind, cw_ind, ph_ind integer(i_kind) file_id - real(r_single), dimension(:,:), allocatable ::pswork + real(r_single), dimension(:,:), allocatable ::pswork real(r_single), dimension(:,:,:), allocatable ::workvar3d,workinc3d,workinc3d2,uworkvar3d,& vworkvar3d,tvworkvar3d,tsenworkvar3d,& workprsi,qworkvar3d,qbgworkvar3d @@ -436,10 +415,8 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid ! Define counting variables integer :: i,j,k,nn,ntile,nn_tile0, nb,ne,nanal - - write(6,*)"anlfileprefixes, fgfileprefixes are not used in the current implementation", & - anlfileprefixes, fgfileprefixes + anlfileprefixes, fgfileprefixes write(6,*)"the no_inflate_flag is not used in the currrent implementation ",no_inflate_flag !---------------------------------------------------------------------- nlevsp1=nlevs+1 @@ -473,61 +450,58 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid allocate(qbgworkvar3d(nx_res,ny_res,nlevs)) allocate(tvworkvar3d(nx_res,ny_res,nlevs)) - - !---------------------------------------------------------------------- ! First guess file should be copied to analysis file at scripting ! level; only variables updated by EnKF are changed - write(charnanal,'(a3, i3.3)') 'mem', nanal + write(charnanal,'(a3, i3.3)') 'mem', nanal !---------------------------------------------------------------------- ! Update u and v variables (same for NMM and ARW) do ntile=1,ntiles - nn_tile0=(ntile-1)*nx_res*ny_res - write(char_tile, '(i1)') ntile - filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) - fv3filename=trim(adjustl(filename))//"_dynvartracer" + nn_tile0=(ntile-1)*nx_res*ny_res + write(char_tile, '(i1)') ntile + filename = "fv3sar_tile"//char_tile//"_"//trim(charnanal) + fv3filename=trim(adjustl(filename))//"_dynvartracer" !---------------------------------------------------------------------- ! read u-component - call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_write,file_id),& - myname_,'open: '//trim(adjustl(fv3filename)) ) - + call nc_check( nf90_open(trim(adjustl(fv3filename)),nf90_write,file_id),& + myname_,'open: '//trim(adjustl(fv3filename)) ) ! update CWM for WRF-NMM if (u_ind > 0) then varstrname = 'u' allocate(uworkvar3d(nx_res,ny_res+1,nlevs)) - + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) - do k=1,nlevs + do k=1,nlevs nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(u_ind-1)+k,nb,ne) - enddo - enddo - enddo - uworkvar3d(:,1:ny_res,:)=uworkvar3d(:,1:ny_res,:)+workinc3d - uworkvar3d(:,ny_res+1,:)=uworkvar3d(:,ny_res,:) + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(u_ind-1)+k,nb,ne) + enddo + enddo + enddo + uworkvar3d(:,1:ny_res,:)=uworkvar3d(:,1:ny_res,:)+workinc3d + uworkvar3d(:,ny_res+1,:)=uworkvar3d(:,ny_res,:) + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,uworkvar3d) deallocate(uworkvar3d) - endif if (v_ind > 0) then varstrname = 'v' allocate(vworkvar3d(nx_res+1,ny_res,nlevs)) - + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,vworkvar3d) do k=1,nlevs nn = nn_tile0 do j=1,ny_res do i=1,nx_res nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(v_ind-1)+k,nb,ne) + workinc3d(i,j,k)=vargrid(nn,levels(v_ind-1)+k,nb,ne) enddo enddo enddo @@ -537,192 +511,183 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid deallocate(vworkvar3d) endif + if(delp_ind>0) then - varstrname='delp' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(delp_ind-1)+k,nb,ne) - enddo - enddo - enddo - workvar3d=workvar3d+workinc3d - + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(delp_ind-1)+k,nb,ne) + enddo + enddo + enddo + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) do k=1,nlevs - if (nproc .eq. 0) & + if (nproc .eq. 0) & write(6,*) 'WRITEregional : delp ', & - & k, minval(qworkvar3d(:,:,k)), maxval(workvar3d(:,:,k)) + & k, minval(workvar3d(:,:,k)), maxval(workvar3d(:,:,k)) enddo end if if(q_ind>0) then - varstrname='sphum' call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qbgworkvar3d) - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(q_ind-1)+k,nb,ne) - enddo - enddo - enddo - qworkvar3d=qbgworkvar3d+workinc3d - - call write_fv3_restart_data3d(varstrname,fv3filename,file_id,qworkvar3d) do k=1,nlevs - if (nproc .eq. 0) & + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(q_ind-1)+k,nb,ne) + enddo + enddo + enddo + qworkvar3d=qbgworkvar3d+workinc3d + + ! In write_fv3_restart_data3d, the input workvar3d will get all its + ! dimensions in revered order. So, use workvar3d for writing and leave + ! qworkvar3d unchanged so that it can be used below for the tsen + ! calculation if needed. + workvar3d=qworkvar3d + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + if (nproc .eq. 0) & write(6,*) 'WRITEregional : sphum ', & - & k, minval(qworkvar3d(:,:,k)), maxval(qworkvar3d(:,:,k)) + & k, minval(workvar3d(:,:,k)), maxval(workvar3d(:,:,k)) enddo end if - - - if (tv_ind > 0.or.tsen_ind>0 ) then - - varstrname = 'T' - if(tsen_ind>0) then - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(tsen_ind-1)+k,nb,ne) - enddo - enddo - enddo - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - workvar3d=workvar3d+workinc3d - call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - else ! tv_ind >0 - do k=1,nlevs - nn = nn_tile0 - do j=1,ny_res + if (tv_ind>0 .or. tsen_ind>0 ) then + varstrname = 'T' + if (tsen_ind>0) then + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res do i=1,nx_res nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(tv_ind-1)+k,nb,ne) + workinc3d(i,j,k)=vargrid(nn,levels(tsen_ind-1)+k,nb,ne) enddo - enddo - enddo - - varstrname = 'T' - allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - if(.not. (q_ind > 0) ) then - varstrname = 'sphum' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qbgworkvar3d) - endif - tvworkvar3d=tsenworkvar3d*(one+fv*qbgworkvar3d) - tvworkvar3d=tvworkvar3d+workinc3d - if(.not. ( q_ind > 0)) then - tsenworkvar3d=tvworkvar3d/(one+fv*qbgworkvar3d) - else - tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d) - endif - varstrname = 'T' - call write_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) - do k=1,nlevs - if (nproc .eq. 0) & - write(6,*) 'WRITEregional : T ', & - & k, minval(tsenworkvar3d(:,:,k)), maxval(tsenworkvar3d(:,:,k)) - enddo - - deallocate(tsenworkvar3d) - endif !if tsens else tv - + enddo + enddo + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + workvar3d=workvar3d+workinc3d + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + else ! tv_ind >0 + do k=1,nlevs + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(tv_ind-1)+k,nb,ne) + enddo + enddo + enddo + varstrname = 'T' + allocate(tsenworkvar3d(nx_res,ny_res,nlevs)) + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + if (.not. (q_ind>0) ) then + varstrname = 'sphum' + call read_fv3_restart_data3d(varstrname,fv3filename,file_id,qbgworkvar3d) + endif + tvworkvar3d=tsenworkvar3d*(one+fv*qbgworkvar3d) + tvworkvar3d=tvworkvar3d+workinc3d + if (.not. (q_ind>0)) then + tsenworkvar3d=tvworkvar3d/(one+fv*qbgworkvar3d) + else + tsenworkvar3d=tvworkvar3d/(one+fv*qworkvar3d) + endif + varstrname = 'T' + call write_fv3_restart_data3d(varstrname,fv3filename,file_id,tsenworkvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : T ', & + & k, minval(tsenworkvar3d(:,:,k)), maxval(tsenworkvar3d(:,:,k)) + enddo + deallocate(tsenworkvar3d) + endif !if tsens else tv endif - + if (oz_ind > 0) then varstrname = 'o3mr' - call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - do k=1,nlevs + do k=1,nlevs nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - workinc3d(i,j,k)=vargrid(nn,levels(oz_ind-1)+k,nb,ne) - enddo - enddo - enddo - workvar3d=workvar3d+workinc3d + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + workinc3d(i,j,k)=vargrid(nn,levels(oz_ind-1)+k,nb,ne) + enddo + enddo + enddo + workvar3d=workvar3d+workinc3d call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) - endif - if (ps_ind > 0) then + + if (ps_ind > 0) then allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) varstrname = 'delp' - call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) - !print *,'min/max delp',ntile,minval(delp),maxval(delp) - workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed - do i=nlevs,1,-1 - workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) - enddo - - nn = nn_tile0 - do j=1,ny_res - do i=1,nx_res - nn=nn+1 - pswork(i,j)=vargrid(nn,levels(n3d)+ps_ind,nb,ne) - enddo - enddo - if(l_pres_add_saved) then - do k=1,nlevs+1 - do j=1,ny_res - do i=1,nx_res - workinc3d2(i,j,k)=eta2_ll(k)*pswork(i,j) - enddo - enddo - enddo - workprsi=workprsi+workinc3d2 - else - workprsi(:,:,1)=workprsi(:,:,1)+pswork - do k=2,nlevsp1 - workprsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*workprsi(:,:,1) - enddo - endif + call read_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) + !print *,'min/max delp',ntile,minval(delp),maxval(delp) + workprsi(:,:,nlevsp1)=eta1_ll(nlevsp1) !etal_ll is needed + do i=nlevs,1,-1 + workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) + enddo + + nn = nn_tile0 + do j=1,ny_res + do i=1,nx_res + nn=nn+1 + pswork(i,j)=vargrid(nn,levels(n3d)+ps_ind,nb,ne) + enddo + enddo + if (l_pres_add_saved) then + do k=1,nlevs+1 + do j=1,ny_res + do i=1,nx_res + workinc3d2(i,j,k)=eta2_ll(k)*pswork(i,j) + enddo + enddo + enddo + workprsi=workprsi+workinc3d2 + else + workprsi(:,:,1)=workprsi(:,:,1)+pswork + do k=2,nlevsp1 + workprsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*workprsi(:,:,1) + enddo + endif do k=1,nlevs - workvar3d(:,:,k)=(workprsi(:,:,k)-workprsi(:,:,k+1))*100.0 + workvar3d(:,:,k)=(workprsi(:,:,k)-workprsi(:,:,k+1))*100.0 enddo - call write_fv3_restart_data3d(varstrname,filename,file_id,workvar3d) - endif - + endif + call nc_check( nf90_close(file_id),& - myname_,'close '//trim(filename) ) + myname_,'close '//trim(filename) ) + end do ! tiles - end do ! tiles - if(allocated(workinc3d)) deallocate(workinc3d) - if(allocated(workinc3d2)) deallocate(workinc3d2) + if(allocated(workinc3d)) deallocate(workinc3d) + if(allocated(workinc3d2)) deallocate(workinc3d2) if(allocated(workprsi)) deallocate(workprsi) - if(allocated(pswork)) deallocate(pswork) - if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) - if(allocated(qworkvar3d)) deallocate(qworkvar3d) - if(allocated(qbgworkvar3d)) deallocate(qbgworkvar3d) - + if(allocated(pswork)) deallocate(pswork) + if(allocated(tvworkvar3d)) deallocate(tvworkvar3d) + if(allocated(qworkvar3d)) deallocate(qworkvar3d) + if(allocated(qbgworkvar3d)) deallocate(qbgworkvar3d) - - end do backgroundloop ! loop over backgrounds to read in end do ensmemloop ! loop over ens members to read in - ! Return calculated values return - !====================================================================== - end subroutine writegriddata + subroutine writeincrement(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) !Dummy subroutine declaration in place of the actual subroutine definition in !the GFS EnKF @@ -753,7 +718,7 @@ subroutine writeincrement_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin logical, intent(in) :: no_inflate_flag end subroutine writeincrement_pnc - + subroutine readgriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, & fileprefixes,filesfcprefixes,reducedgrid,grdin,qsat) !Dummy subroutine declaration in place of the actual subroutine definition in @@ -788,5 +753,4 @@ subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_ logical, intent(in) :: no_inflate_flag end subroutine writegriddata_pnc - end module gridio From c56991bb2fca6508d6ff21fe9d2f5dd56d7810c9 Mon Sep 17 00:00:00 2001 From: xulu Date: Fri, 23 Jul 2021 18:03:42 -0500 Subject: [PATCH 080/155] Bug fixes and optimizations to the dual-resolution by Xu Lu & Xuguang Wang from OU, POC: xuguang.wang@ou.edu 1. change region_lat/lon_in to degree & replace clon/clat with centlon/centlat in rotate2deg 2. add itotsubens for ensemble domain in gridmod.f90 & gsi_rfv3io_mod.f90 3. use grd_ens instead of grd_loc for ensemble grid indexes in hybrid_ensemble_isotropic.F90 4. reduce duplication of dual_res in cplr_get_fv3_regional_ensperts.f90 --- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 55 +++++----------------- src/gsi/gridmod.F90 | 3 +- src/gsi/gsi_rfv3io_mod.f90 | 45 ++++++++++++------ src/gsi/hybrid_ensemble_isotropic.F90 | 13 ++--- src/gsi/mod_fv3_lolgrid.f90 | 4 +- 5 files changed, 55 insertions(+), 65 deletions(-) diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index fe943985d2..006ddeea81 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -392,69 +392,38 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g !cltthinktobe should be contained in variable like grd_ens - if (dual_res) then if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,dual_res) else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,dual_res) endif if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,dual_res) else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.true.) + call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,dual_res) endif - else - if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.false.) - else - call gsi_fv3ncdf_readuv_v1(dynvars,g_u,g_v,grd_ens%lat2,grd_ens%lon2,.false.) - endif - if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(dynvars,'T','t',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.false.) - else - call gsi_fv3ncdf_read_v1(dynvars,'t','T',g_tsen,mype_t,grd_ens%lat2,grd_ens%lon2,.false.) - endif - end if if (fv3sar_ensemble_opt == 0) then - if (dual_res) then - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,grd_ens%lat2,grd_ens%lon2,.true.) - else - call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,grd_ens%lat2,grd_ens%lon2,.false.) - end if + call gsi_fv3ncdf_read(dynvars,'DELP','delp',g_prsi,mype_p,grd_ens%lat2,grd_ens%lon2,dual_res) g_prsi(:,:,grd_ens%nsig+1)=eta1_ll(grd_ens%nsig+1) !thinkto be done , should use eta1_ll from ensemble grid do i=grd_ens%nsig,1,-1 g_prsi(:,:,i)=g_prsi(:,:,i)*0.001_r_kind+g_prsi(:,:,i+1) enddo g_ps(:,:)=g_prsi(:,:,1) else ! for the ensemble processed frm CHGRES - if (dual_res) then - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,grd_ens%lat2,grd_ens%lon2,.true.) - else - call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,grd_ens%lat2,grd_ens%lon2,.false.) - end if + call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',g_ps,mype_p,grd_ens%lat2,grd_ens%lon2,dual_res) g_ps=g_ps*0.001_r_kind do k=1,grd_ens%nsig+1 g_prsi(:,:,k)=eta1_ll(k)+eta2_ll(k)*g_ps enddo endif - if (dual_res) then - if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.true.) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.true.) - else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.true.) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.true.) - endif + if(fv3sar_ensemble_opt == 0) then + call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,dual_res) + call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,dual_res) else - if(fv3sar_ensemble_opt == 0) then - call gsi_fv3ncdf_read(tracers,'SPHUM','sphum',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.false.) - call gsi_fv3ncdf_read(tracers,'O3MR','o3mr',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.false.) - else - call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,.false.) - call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,.false.) - endif - end if + call gsi_fv3ncdf_read_v1(tracers,'sphum','SPHUM',g_q,mype_q,grd_ens%lat2,grd_ens%lon2,dual_res) + call gsi_fv3ncdf_read_v1(tracers,'o3mr','O3MR',g_oz,mype_oz,grd_ens%lat2,grd_ens%lon2,dual_res) + endif !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do k=1,grd_ens%nsig diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index edaf2a856c..3fa38f8fae 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -131,7 +131,7 @@ module gridmod public :: strip_periodic ! set passed variables to public - public :: nnnn1o,iglobal,itotsub,ijn,ijn_s,lat2,lon2,lat1,lon1,nsig,nsig_soil + public :: nnnn1o,iglobal,itotsub,ijn,ijn_s,lat2,lon2,lat1,lon1,nsig,nsig_soil,itotsubens public :: ncloud,nlat,nlon,ntracer,displs_s,displs_g public :: ijn_sens,ijnens,displs_sens public :: bk5,regional,latlon11,latlon1n,twodvar_regional @@ -262,6 +262,7 @@ module gridmod integer(i_kind) latlon1n1 ! no. of points in subdomain for 3d prs (with buffer) integer(i_kind) iglobal ! number of horizontal points on global grid integer(i_kind) itotsub ! number of horizontal points of all subdomains combined + integer(i_kind) itotsubens ! number of horizontal points of all subdomains combined integer(i_kind) msig ! number of profile layers to use when calling RTM integer(i_kind) jcap_cut ! spectral triangular truncation beyond which you recalculate pln and plntop - default 600 - used to save memory diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index e6d71dc483..89ebcf6b62 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -350,7 +350,6 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) coeffx,coeffy) - deallocate (grid_lon,grid_lat,grid_lont,grid_latt) deallocate (ak,bk,abk_fv3) @@ -428,7 +427,6 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) ierr=1 return endif - iret=nf90_inquire(gfile_grid_spec,ndimensions,nvariables,nattributes,unlimiteddimid) gfile_loc=gfile_grid_spec do k=1,ndimensions @@ -466,7 +464,6 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) !!! get ak,bk - !!!!!!! setup A grid and interpolation/rotation coeff. call definecoef_regular_grids(nxens,nyens,nxa_ens,nya_ens,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & nlat_ens,nlon_ens,region_lat_ens,region_lon_ens) @@ -753,7 +750,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) ! !$$$ end documentation block use kinds, only: r_kind,i_kind - use mpimod, only: npe + use mpimod, only: npe,mype use guess_grids, only: ges_tsen,ges_prsi use gridmod, only: lat2,lon2,nsig,ijn,eta1_ll,eta2_ll,ijn_s use gridmod, only: ijnens,ijn_sens @@ -1129,7 +1126,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io,la use netcdf, only: nf90_inquire_variable use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - use gridmod, only: ijn_sens,ijnens,displs_sens + use gridmod, only: ijn_sens,ijnens,displs_sens,itotsubens use general_commvars_mod, only: ltosi_sens,ltosj_sens use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens @@ -1151,7 +1148,11 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io,la integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid mm1=mype+1 - allocate (work(itotsub)) + if (ensgrid) then + allocate (work(itotsubens)) + else + allocate (work(itotsub)) + endif if(mype==mype_io ) then iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) @@ -1260,7 +1261,7 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io,lat2in, use netcdf, only: nf90_inquire_variable use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - use gridmod, only: ijn_sens,ijnens + use gridmod, only: ijn_sens,ijnens,itotsubens use general_commvars_mod, only: ltosi_sens,ltosj_sens use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens @@ -1283,7 +1284,11 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io,lat2in, integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid mm1=mype+1 - allocate (work(itotsub*nsig)) + if (ensgrid) then + allocate (work(itotsubens*nsig)) + else + allocate (work(itotsub*nsig)) + endif if(mype==mype_io ) then iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) @@ -1407,7 +1412,7 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io,lat2 use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - use gridmod, only: lat2,lon2,nsig,nlat,nlon,itotsub,ijn_s,ijn_sens + use gridmod, only: lat2,lon2,nsig,nlat,nlon,itotsub,ijn_s,ijn_sens,itotsubens use general_commvars_mod, only: ltosi_sens,ltosj_sens use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none @@ -1430,7 +1435,11 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io,lat2 integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid mm1=mype+1 - allocate (work(itotsub*nsig)) + if (ensgrid) then + allocate (work(itotsubens*nsig)) + else + allocate (work(itotsub*nsig)) + endif if(mype==mype_io ) then iret=nf90_open(trim(filenamein),nf90_nowrite,gfile_loc) @@ -1552,7 +1561,7 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - use gridmod, only: ijn_sens,ijnens + use gridmod, only: ijn_sens,ijnens,itotsubens use general_commvars_mod, only: ltosi_sens,ltosj_sens use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens @@ -1574,7 +1583,11 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) integer(i_kind) nz,nzp1,kk,j,mm1,i,ir,ii,jj integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid - allocate (work(itotsub*nsig)) + if (ensgrid) then + allocate (work(itotsubens*nsig)) + else + allocate (work(itotsub*nsig)) + endif mm1=mype+1 if(mype==mype_u .or. mype==mype_v) then iret=nf90_open(dynvarsfile,nf90_nowrite,gfile_loc) @@ -1717,7 +1730,7 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) use netcdf, only: nf90_inq_varid use mod_fv3_lolgrid, only: fv3_h_to_ll_regular_grids,nya,nxa,fv3uv2earth_regular_grids use general_commvars_mod, only: ltosi_s,ltosj_s - use gridmod, only: ijn_sens,ijnens + use gridmod, only: ijn_sens,ijnens,itotsubens use general_commvars_mod, only: ltosi_sens,ltosj_sens use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens implicit none @@ -1738,7 +1751,11 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v,lat2in,lon2in,ensgrid) integer(i_kind) nztmp,nzp1,kk,j,mm1,i,ir,ii,jj integer(i_kind) ndimensions,nvariables,nattributes,unlimiteddimid - allocate (work(itotsub*nsig)) + if (ensgrid) then + allocate (work(itotsubens*nsig)) + else + allocate (work(itotsub*nsig)) + endif mm1=mype+1 if(mype==mype_u .or. mype==mype_v) then iret=nf90_open(dynvarsfile,nf90_nowrite,gfile_loc) diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 538749c517..6617449837 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3875,7 +3875,7 @@ subroutine hybens_grid_setup use hybrid_ensemble_parameters, only:regional_ensemble_option use gsi_rfv3io_mod,only:gsi_rfv3io_get_ens_grid_specs use general_commvars_mod, only: ltosi_sens,ltosj_sens - use gridmod, only: itotsub,ijn_sens,ijnens,displs_sens + use gridmod, only: itotsub,ijn_sens,ijnens,displs_sens,itotsubens use mpimod, only: npe implicit none @@ -3943,11 +3943,6 @@ subroutine hybens_grid_setup allocate(vector(num_fields)) vector=.false. call general_sub2grid_create_info(grd_loc,inner_vars,nlat_ens,nlon_ens,nsig,num_fields,regional,vector) - ltosi_sens=grd_loc%ltosi_s - ltosj_sens=grd_loc%ltosj_s - ijn_sens=grd_loc%ijn_s - ijnens=grd_loc%ijn - displs_sens=grd_loc%displs_s num_fields=max(0,nc3d)*nsig+max(0,nc2d) deallocate(vector) allocate(vector(num_fields)) @@ -3977,6 +3972,12 @@ subroutine hybens_grid_setup nord_e2a,p_e2a,.true.,eqspace=use_sp_eqspace) else if(dual_res) then + ltosi_sens=grd_ens%ltosi_s + ltosj_sens=grd_ens%ltosj_s + ijn_sens=grd_ens%ijn_s + ijnens=grd_ens%ijn + itotsubens=grd_ens%itotsub + displs_sens=grd_ens%displs_s !cltthinktodo call get_region_dx_dy_ens(region_dx_ens,region_dy_ens) if(regional_ensemble_option) then diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index c1b76e134b..a15c7463e4 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -814,8 +814,10 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont cy=one endif allocate(rlat_in(nlatin,nlonin),rlon_in(nlatin,nlonin)) + region_lon_in=region_lon_in*rad2deg + region_lat_in=region_lat_in*rad2deg call rotate2deg(region_lon_in,region_lat_in,rlon_in,rlat_in, & - clon,clat,nlatin,nlonin) + centlon,centlat,nlatin,nlonin) ! !-----setup analysis A-grid from center of the domain From b76e0e949da30a004f4e7c69943d29dd060d0d8b Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Fri, 6 Aug 2021 22:37:23 +0000 Subject: [PATCH 081/155] some consolidation of codes for FV3-LAM dual resoution --- src/gsi/mod_fv3_lolgrid.f90 | 50 +++++++++---------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index a15c7463e4..047e0215b0 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -717,7 +717,6 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon - real(r_kind) adlon,adlat,alon,clat,clon integer(i_kind) nxout,nyout integer(i_kind) nlonh,nlath,nxh,nyh integer(i_kind) ib1,ib2,jb1,jb2,jj @@ -788,37 +787,22 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont nya_inout=nyout ! for compatiability if(mype==0) print *,'nlatin,nlonin = ',nlatin,nlonin -!--------------------------obtain analysis grid spacing - dlat=(maxval(gcrlat)-minval(gcrlat))/(ny-1) - dlon=(maxval(gcrlon)-minval(gcrlon))/(nx-1) - adlat=dlat*grid_ratio_fv3_regional - adlon=dlon*grid_ratio_fv3_regional - -!-------setup analysis A-grid; find center of the domain - nlonh=nlonin/2 - nlath=nlatin/2 - - if(nlonh*2==nlonin)then - clon=adlon/two - cx=half - else - clon=adlon - cx=one - endif - - if(nlath*2==nlatin)then - clat=adlat/two - cy=half - else - clat=adlat - cy=one - endif allocate(rlat_in(nlatin,nlonin),rlon_in(nlatin,nlonin)) region_lon_in=region_lon_in*rad2deg region_lat_in=region_lat_in*rad2deg call rotate2deg(region_lon_in,region_lat_in,rlon_in,rlat_in, & centlon,centlat,nlatin,nlonin) + + + +!--------------------------obtain analysis grid spacing + dlat=(maxval(gcrlat)-minval(gcrlat))/(ny-1) + dlon=(maxval(gcrlon)-minval(gcrlon))/(nx-1) + + + + ! !-----setup analysis A-grid from center of the domain ! @@ -848,22 +832,12 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont !!!! define analysis A grid !!!!!!!!!!!!! - - - do j=1,nxout - xa_a(j)=(float(j-nlonh)-cx)*grid_ratio_fv3_regional - end do - do i=1,nyout - ya_a(i)=(float(i-nlath)-cy)*grid_ratio_fv3_regional - end do - index0=1 -!cltthinkdeb should region_lon_in be in degree or not? do j=1,nxa_inout - xa_a(j)= (rlon_in(index0,j)-clon)/dlon + xa_a(j)= rlon_in(index0,j)/dlon end do do i=1,nya_inout - ya_a(i)= (rlat_in(i,index0)-clat)/dlon + ya_a(i)= rlat_in(i,index0)/dlon end do !!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! From 193409e41ec441f1827f2139d5e955a39e5e16b0 Mon Sep 17 00:00:00 2001 From: xulu Date: Fri, 13 Aug 2021 10:29:26 -0500 Subject: [PATCH 082/155] Further consolidation from Ting Lei, Xu Lu and Xuguang Wang for dual-resolution EnVar for HAFS. POC: xuguang.wang@ou.edu 1. moving ltosi_sens definitions from hybrid_ensemble_isotropic.F90 to gsi_rfv3io_mod.f90 2. modifying xa_a, ya_a calculation for ensemble in mod_fv3_lolgrid.f90 --- src/gsi/gsi_rfv3io_mod.f90 | 15 ++++++++++++--- src/gsi/hybrid_ensemble_isotropic.F90 | 9 +-------- src/gsi/mod_fv3_lolgrid.f90 | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 89ebcf6b62..e482a7533f 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -224,9 +224,9 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) integer(i_kind) myear,mmonth,mday,mhour,mminute,msecond real(r_kind),allocatable:: abk_fv3(:) - coupler_res_filenam=fv3filenamegin%couplerres - grid_spec=fv3filenamegin%grid_spec - ak_bk=fv3filenamegin%ak_bk + coupler_res_filenam=fv3filenamegin%couplerres + grid_spec=fv3filenamegin%grid_spec + ak_bk=fv3filenamegin%ak_bk !!!!! set regional_time open(24,file=trim(coupler_res_filenam),form='formatted') @@ -400,6 +400,9 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) use kinds, only: i_kind,r_kind use constants, only: half,zero use mpimod, only: mpi_comm_world,ierror,mpi_itype,mpi_rtype + use hybrid_ensemble_parameters, only: grd_ens + use gridmod, only: ijn_sens,ijnens,displs_sens,itotsubens + use general_commvars_mod, only: ltosi_sens,ltosj_sens implicit none @@ -465,6 +468,12 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) !!!!!!! setup A grid and interpolation/rotation coeff. + ltosi_sens=grd_ens%ltosi_s + ltosj_sens=grd_ens%ltosj_s + ijn_sens=grd_ens%ijn_s + ijnens=grd_ens%ijn + itotsubens=grd_ens%itotsub + displs_sens=grd_ens%displs_s call definecoef_regular_grids(nxens,nyens,nxa_ens,nya_ens,grid_lon,grid_lont,grid_lat,grid_latt,p_fv3sar2ensgrid, & nlat_ens,nlon_ens,region_lat_ens,region_lon_ens) diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 6617449837..d2b4f8f4a5 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3874,8 +3874,7 @@ subroutine hybens_grid_setup use gridmod, only: region_lat,region_lon,region_dx,region_dy use hybrid_ensemble_parameters, only:regional_ensemble_option use gsi_rfv3io_mod,only:gsi_rfv3io_get_ens_grid_specs - use general_commvars_mod, only: ltosi_sens,ltosj_sens - use gridmod, only: itotsub,ijn_sens,ijnens,displs_sens,itotsubens + use gridmod, only: itotsub use mpimod, only: npe implicit none @@ -3972,12 +3971,6 @@ subroutine hybens_grid_setup nord_e2a,p_e2a,.true.,eqspace=use_sp_eqspace) else if(dual_res) then - ltosi_sens=grd_ens%ltosi_s - ltosj_sens=grd_ens%ltosj_s - ijn_sens=grd_ens%ijn_s - ijnens=grd_ens%ijn - itotsubens=grd_ens%itotsub - displs_sens=grd_ens%displs_s !cltthinktodo call get_region_dx_dy_ens(region_dx_ens,region_dy_ens) if(regional_ensemble_option) then diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 047e0215b0..27c8b5412e 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -837,7 +837,7 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont xa_a(j)= rlon_in(index0,j)/dlon end do do i=1,nya_inout - ya_a(i)= rlat_in(i,index0)/dlon + ya_a(i)= rlat_in(i,index0)/dlat end do !!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! From dd1dcc236cc24e6e9264eed1b312b8306d6d5dc3 Mon Sep 17 00:00:00 2001 From: TingLei-daprediction Date: Fri, 10 Dec 2021 14:19:44 +0000 Subject: [PATCH 083/155] A fix for the logics ,in the enkf_fv3reg, when q_ind > 0 while pseudo_rh=.true. and. ps_ind <0 in the ensemble meaning and recentering to avoid undefined qsat used for q. A fix for the index upbound set in mod_fv3_lolgrid.f90 --- src/enkf/gridio_fv3reg.f90 | 10 ++++++++-- src/gsi/mod_fv3_lolgrid.f90 | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index faf37e90de..2c42646916 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -294,7 +294,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f !---------------------------------------------------------------------- ! Allocate memory for variables computed within routine - if (ps_ind > 0) then + if (ps_ind > 0 .or. q_ind > 0 ) then !if q_ind > 0 qsat will be use allocate(workprsi(nx_res,ny_res,nlevsp1)) allocate(pswork(nx_res,ny_res)) fv3filename=trim(adjustl(filename))//"_dynvartracer" @@ -309,7 +309,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f workprsi(:,:,i)=workvar3d(:,:,i)*0.01_r_kind+workprsi(:,:,i+1) enddo pswork(:,:)=workprsi(:,:,1) - + if(ps_ind >0 ) then nn = nn_tile0 do j=1,ny_res do i=1,nx_res @@ -317,6 +317,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f vargrid(nn,levels(n3d)+ps_ind, nb,ne) =pswork(i,j) enddo enddo + endif do k=1,nlevs do j=1,ny_res @@ -576,6 +577,11 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid call read_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) workvar3d=workvar3d+workinc3d call write_fv3_restart_data3d(varstrname,fv3filename,file_id,workvar3d) + do k=1,nlevs + if (nproc .eq. 0) & + write(6,*) 'WRITEregional : T ', & + & k, minval(workvar3d(:,:,k)), maxval(workvar3d(:,:,k)) + enddo else ! tv_ind >0 do k=1,nlevs nn = nn_tile0 diff --git a/src/gsi/mod_fv3_lolgrid.f90 b/src/gsi/mod_fv3_lolgrid.f90 index 27c8b5412e..e8eb99d984 100644 --- a/src/gsi/mod_fv3_lolgrid.f90 +++ b/src/gsi/mod_fv3_lolgrid.f90 @@ -560,7 +560,7 @@ subroutine generate_regular_grids(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,p_ a3jy(j,i)=min(max(1,a3jy(j,i)),nyout) a3dy(j,i)=max(zero,min(one,gya-a3jy(j,i))) a3dy1(j,i)=one-a3dy(j,i) - a3jyp(j,i)=min(ny,a3jy(j,i)+1) + a3jyp(j,i)=min(nyout,a3jy(j,i)+1) end do end do @@ -1026,7 +1026,7 @@ subroutine definecoef_regular_grids(nx,ny,nxa_inout,nya_inout,grid_lon,grid_lont a3jy(j,i)=min(max(1,a3jy(j,i)),nyout) a3dy(j,i)=max(zero,min(one,gya-a3jy(j,i))) a3dy1(j,i)=one-a3dy(j,i) - a3jyp(j,i)=min(ny,a3jy(j,i)+1) + a3jyp(j,i)=min(nyout,a3jy(j,i)+1) end do end do From 2af8028110774fe995712dfde7ac9d94e039d201 Mon Sep 17 00:00:00 2001 From: TingLei-NOAA Date: Mon, 13 Dec 2021 14:21:08 +0000 Subject: [PATCH 084/155] added back the 'delp' in the vars3d_supported for fv3_reg , which was removed in the upstream branch --- src/enkf/gridinfo_fv3reg.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/enkf/gridinfo_fv3reg.f90 b/src/enkf/gridinfo_fv3reg.f90 index 9e1f3310ed..84a8a5c5ce 100644 --- a/src/enkf/gridinfo_fv3reg.f90 +++ b/src/enkf/gridinfo_fv3reg.f90 @@ -68,7 +68,8 @@ module gridinfo integer,public :: npts integer,public :: ntrunc ! supported variable names in anavinfo -character(len=max_varname_length),public, dimension(15) :: vars3d_supported = (/'u ', 'v ', 'w ', 't ', 'q ', 'oz ', 'cw ', 'tsen', 'prse', & +character(len=max_varname_length),public, dimension(16) :: vars3d_supported = (/'u ', 'v ', 'w ', 't ', 'q ', 'oz ', & + 'cw ', 'tsen', 'prse','delp', & 'ql ', 'qi ', 'qr', 'qs', 'qg', 'qnr'/) character(len=max_varname_length),public, dimension(3) :: vars2d_supported = (/'ps ', 'pst', 'sst' /) ! supported variable names in anavinfo From 8bc6ba6f0c17e27b3d7e2d65c9f0cdc0ed7569f4 Mon Sep 17 00:00:00 2001 From: XL-OU Date: Wed, 2 Mar 2022 10:07:23 -0600 Subject: [PATCH 085/155] 2022-03-01 X.Lu & X.Wang add changes for Dual Ens for HAFS. POC: xuguang.wang@ou.edu --- src/gsi/constants.f90 | 3 +- src/gsi/cplr_get_fv3_regional_ensperts.f90 | 16 +- src/gsi/gridmod.F90 | 6 +- src/gsi/gsi_rfv3io_mod.f90 | 282 +++++++++-- src/gsi/hybrid_ensemble_isotropic.F90 | 11 +- src/gsi/mod_fv3_lola.f90 | 534 +++++++++++++++++++++ 6 files changed, 809 insertions(+), 43 deletions(-) diff --git a/src/gsi/constants.f90 b/src/gsi/constants.f90 index 77aa027061..953856cb1f 100644 --- a/src/gsi/constants.f90 +++ b/src/gsi/constants.f90 @@ -31,6 +31,7 @@ module constants ! 2016-02-15 Johnson, Y. Wang, X. Wang - define additional constant values for ! radar DA, POC: xuguang.wang@ou.edu ! 2019-09-25 X.Su - put stndrd_atmos_ps constant values +! 2022-03-01 X.Lu & X.Wang - increased max_varname_length for HAFS dual ens. POC: xuguang.wang@ou.edu ! ! Subroutines Included: ! sub init_constants_derived - compute derived constants @@ -90,7 +91,7 @@ module constants ! Declare derived constants integer(i_kind):: huge_i_kind - integer(i_kind), parameter :: max_varname_length=32 + integer(i_kind), parameter :: max_varname_length=33 real(r_single):: tiny_single, huge_single real(r_kind):: xai, xa, xbi, xb, dldt, rozcon,ozcon,fv, tpwcon,eps, rd_over_g real(r_kind):: el2orc, g_over_rd, rd_over_cp, cpr, omeps, epsm1, factor2 diff --git a/src/gsi/cplr_get_fv3_regional_ensperts.f90 b/src/gsi/cplr_get_fv3_regional_ensperts.f90 index b54f727b71..6d6c797b0d 100644 --- a/src/gsi/cplr_get_fv3_regional_ensperts.f90 +++ b/src/gsi/cplr_get_fv3_regional_ensperts.f90 @@ -34,6 +34,7 @@ subroutine get_fv3_regional_ensperts_run(this,en_perts,nelen,ps_bar) ! ! 2021-08-10 lei - modify for fv3-lam ensemble spread output ! 2021-11-01 lei - modify for fv3-lam parallel IO + ! 2022-03-01 X.Lu & X.Wang - modify for hafs dual ens. POC: xuguang.wang@ou.edu ! input argument list: ! ! output argument list: @@ -554,7 +555,7 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g use gridmod, only: eta1_ll,eta2_ll use constants, only: zero,one,fv,zero_single,one_tenth,h300 use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens - use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt + use hybrid_ensemble_parameters, only: fv3sar_ensemble_opt,dual_res use mpimod, only: mpi_comm_world,mpi_rtype use netcdf_mod, only: nc_check @@ -631,7 +632,6 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g sfcdata=fv3_filenameginput%sfcdata couplerres=fv3_filenameginput%couplerres - if (allocated(fv3lam_ens_io_dynmetvars2d_nouv) ) then @@ -656,20 +656,20 @@ subroutine general_read_fv3_regional(this,fv3_filenameginput,g_ps,g_u,g_v,g_tv,g if(fv3sar_ensemble_opt == 0 ) then - call gsi_fv3ncdf_readuv(grd_fv3lam_ens_uv,g_u,g_v,fv3_filenameginput) + call gsi_fv3ncdf_readuv(grd_fv3lam_ens_uv,g_u,g_v,fv3_filenameginput,dual_res) else - call gsi_fv3ncdf_readuv_v1(grd_fv3lam_ens_uv,g_u,g_v,fv3_filenameginput) + call gsi_fv3ncdf_readuv_v1(grd_fv3lam_ens_uv,g_u,g_v,fv3_filenameginput,dual_res) endif if(fv3sar_ensemble_opt == 0) then call gsi_fv3ncdf_read(grd_fv3lam_ens_dynvar_io_nouv,gsibundle_fv3lam_ens_dynvar_nouv,& - fv3_filenameginput%dynvars,fv3_filenameginput) + fv3_filenameginput%dynvars,fv3_filenameginput,dual_res) call gsi_fv3ncdf_read(grd_fv3lam_ens_tracer_io_nouv,gsibundle_fv3lam_ens_tracer_nouv,& - fv3_filenameginput%tracers,fv3_filenameginput) + fv3_filenameginput%tracers,fv3_filenameginput,dual_res) else call gsi_fv3ncdf_read_v1(grd_fv3lam_ens_dynvar_io_nouv,gsibundle_fv3lam_ens_dynvar_nouv,& - fv3_filenameginput%dynvars,fv3_filenameginput) + fv3_filenameginput%dynvars,fv3_filenameginput,dual_res) call gsi_fv3ncdf_read_v1(grd_fv3lam_ens_tracer_io_nouv,gsibundle_fv3lam_ens_tracer_nouv,& - fv3_filenameginput%tracers,fv3_filenameginput) + fv3_filenameginput%tracers,fv3_filenameginput,dual_res) endif ier=0 call GSI_Bundlegetvar ( gsibundle_fv3lam_ens_dynvar_nouv, 'tsen' ,g_tsen ,istatus );ier=ier+istatus diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index acc460e9c9..fce57ea701 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -93,6 +93,7 @@ module gridmod ! 2019-09-23 martin - add use_gfs_ncio to read global first guess from netCDF file ! 2020-12-18 Hu - add grid_type_fv3_regional ! 2021-12-30 Hu - add fv3_io_layout_y +! 2022-03-01 X.Lu & X.Wang - add corresponding variables for dual ens for HAFS. POC: xuguang.wang@ou.edu ! ! ! @@ -145,6 +146,7 @@ module gridmod public :: regional_fhr,region_dyi,coeffx,region_dxi,coeffy,nsig_hlf,regional_fmin public :: nsig2,wgtlats,corlats,rbs2,ncepgfs_headv,regional_time,wgtfactlats public :: nlat_regional,nlon_regional,update_regsfc,half_grid,gencode + public :: nlat_regionalens,nlon_regionalens public :: diagnostic_reg,nmmb_reference_grid,filled_grid public :: grid_ratio_nmmb,isd_g,isc_g,dx_gfs,lpl_gfs,nsig5,nmmb_verttype public :: grid_ratio_fv3_regional,fv3_io_layout_y,fv3_regional,grid_type_fv3_regional @@ -326,7 +328,7 @@ module gridmod real(r_kind) rlon_min_dd,rlon_max_dd,rlat_min_dd,rlat_max_dd real(r_kind) dt_ll,pdtop_ll,pt_ll - integer(i_kind) nlon_regional,nlat_regional + integer(i_kind) nlon_regional,nlat_regional,nlon_regionalens,nlat_regionalens real(r_kind) regional_fhr,regional_fmin integer(i_kind) regional_time(6) integer(i_kind) jcap_gfs,nlat_gfs,nlon_gfs @@ -481,6 +483,8 @@ subroutine init_grid update_regsfc = .false. nlon_regional = 0 nlat_regional = 0 + nlon_regionalens = 0 + nlat_regionalens = 0 msig = nsig do k=1,size(nlayers) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 16c8d2f3e4..e7eadf31b8 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -18,8 +18,10 @@ module gsi_rfv3io_mod ! This function is needed when fv3 model sets ! io_layout(2)>1 ! 2022-02-15 Lu @ Wang - add time label it for FGAT. POC: xuguang.wang@ou.edu +! 2022-03-01 X.Lu @ X.Wang - add gsi_rfv3io_get_ens_grid_specs for dual ens HAFS. POC: xuguang.wang@ou.edu ! subroutines included: ! sub gsi_rfv3io_get_grid_specs +! sub gsi_rfv3io_get_ens_grid_specs ! sub read_fv3_files ! sub read_fv3_netcdf_guess ! sub gsi_fv3ncdf2d_read @@ -41,7 +43,7 @@ module gsi_rfv3io_mod !$$$ end documentation block use kinds, only: r_kind,i_kind - use gridmod, only: nlon_regional,nlat_regional + use gridmod, only: nlon_regional,nlat_regional,nlon_regionalens,nlat_regionalens use constants, only:max_varname_length use gsi_bundlemod, only : gsi_bundle use general_sub2grid_mod, only: sub2grid_info @@ -67,7 +69,9 @@ module gsi_rfv3io_mod type(type_fv3regfilenameg):: bg_fv3regfilenameg integer(i_kind) nx,ny,nz + integer(i_kind) nxens,nyens integer(i_kind),dimension(:),allocatable :: ny_layout_len,ny_layout_b,ny_layout_e + integer(i_kind),dimension(:),allocatable :: ny_layout_lenens,ny_layout_bens,ny_layout_eens real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) real(r_kind),allocatable:: ak(:),bk(:) integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) @@ -95,6 +99,7 @@ module gsi_rfv3io_mod private ! set subroutines to public public :: gsi_rfv3io_get_grid_specs + public :: gsi_rfv3io_get_ens_grid_specs public :: gsi_fv3ncdf_read public :: gsi_fv3ncdf_read_v1 public :: gsi_fv3ncdf_readuv @@ -475,6 +480,140 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) return end subroutine gsi_rfv3io_get_grid_specs +subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_rfv3io_get_ens_grid_specs +! modified from gsi_rfv3io_get_grid_specs +! pgrmmr: parrish org: np22 date: 2017-04-03 +! +! abstract: obtain grid dimensions nx,ny and grid definitions +! grid_x,grid_xt,grid_y,grid_yt,grid_lon,grid_lont,grid_lat,grid_latt +! nz,ak(nz),bk(nz) +! +! program history log: +! 2017-04-03 parrish - initial documentation +! 2017-10-10 wu - setup A grid and interpolation coeff with generate_anl_grid +! 2018-02-16 wu - read in time info from file coupler.res +! read in lat, lon at the center and corner of the grid cell +! from file fv3_grid_spec, and vertical grid infor from file +! fv3_akbk +! setup A grid and interpolation/rotation coeff +! input argument list: +! grid_spec +! ak_bk +! lendian_out +! +! output argument list: +! ierr +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr + use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension + use netcdf, only: nf90_inquire_variable + use mpimod, only: mype + use mod_fv3_lola, only: definecoef_regular_grids + use gridmod, only:nsig,regional_time,regional_fhr,regional_fmin,aeta1_ll,aeta2_ll + use gridmod, only:nlon_regionalens,nlat_regionalens + use gridmod, only:grid_type_fv3_regional + use kinds, only: i_kind,r_kind + use constants, only: half,zero + use mpimod, only: mpi_comm_world,mpi_itype,mpi_rtype + implicit none + character(:),allocatable,intent(in) :: grid_spec + + integer(i_kind) gfile_grid_spec + integer(i_kind),intent( out) :: ierr + integer(i_kind) i,k,ndimensions,iret,nvariables,nattributes,unlimiteddimid + integer(i_kind) gfile_loc,len + character(len=128) :: name + integer(i_kind) :: nio,nylen + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout + + + iret=nf90_open(trim(grid_spec),nf90_nowrite,gfile_grid_spec) + if(iret/=nf90_noerr) then + write(6,*)' problem opening1 ',trim(grid_spec),', Status = ',iret + ierr=1 + return + endif + iret=nf90_inquire(gfile_grid_spec,ndimensions,nvariables,nattributes,unlimiteddimid) + gfile_loc=gfile_grid_spec + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc,k,name,len) + if(trim(name)=='grid_xt') nxens=len + if(trim(name)=='grid_yt') nyens=len + enddo + allocate(grid_lat(nxens+1,nyens+1)) + allocate(grid_lon(nxens+1,nyens+1)) + allocate(grid_latt(nxens,nyens)) + allocate(grid_lont(nxens,nyens)) + do k=ndimensions+1,nvariables + iret=nf90_inquire_variable(gfile_loc,k,name,len) + if(trim(name)=='grid_lat') then + iret=nf90_get_var(gfile_loc,k,grid_lat) + endif + if(trim(name)=='grid_lon') then + iret=nf90_get_var(gfile_loc,k,grid_lon) + endif + if(trim(name)=='grid_latt') then + iret=nf90_get_var(gfile_loc,k,grid_latt) + endif + if(trim(name)=='grid_lont') then + iret=nf90_get_var(gfile_loc,k,grid_lont) + endif + enddo + iret=nf90_close(gfile_loc) + + nlon_regionalens=nxens + nlat_regionalens=nyens + allocate(ny_layout_lenens(0:fv3_io_layout_y-1)) + allocate(ny_layout_bens(0:fv3_io_layout_y-1)) + allocate(ny_layout_eens(0:fv3_io_layout_y-1)) + ny_layout_lenens=nyens + ny_layout_bens=0 + ny_layout_eens=0 + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(grid_spec),'.',nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio)) + if(iret/=nf90_noerr) then + write(6,*)' problem opening ',trim(filename_layout),', Status =',iret + ierr=1 + return + endif + iret=nf90_inquire(gfile_loc_layout(nio),ndimensions,nvariables,nattributes,unlimiteddimid) + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc_layout(nio),k,name,len) + if(trim(name)=='grid_yt') ny_layout_lenens(nio)=len + enddo + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate(gfile_loc_layout) +! figure out begin and end of each subdomain restart file + nylen=0 + do nio=0,fv3_io_layout_y-1 + ny_layout_bens(nio)=nylen + 1 + nylen=nylen+ny_layout_lenens(nio) + ny_layout_eens(nio)=nylen + enddo + endif + if(mype==0)write(6,*),'nxens,nyens=',nxens,nyens + if(mype==0)write(6,*),'ny_layout_lenens=',ny_layout_lenens + if(mype==0)write(6,*),'ny_layout_bens=',ny_layout_bens + if(mype==0)write(6,*),'ny_layout_eens=',ny_layout_eens + call definecoef_regular_grids(nxens,nyens,grid_lon,grid_lont,grid_lat,grid_latt) + deallocate (grid_lon,grid_lat,grid_lont,grid_latt) + return +end subroutine gsi_rfv3io_get_ens_grid_specs + + subroutine read_fv3_files(mype) !$$$ subprogram documentation block ! . . . . @@ -1070,16 +1209,16 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin,it) if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_readuv(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin) + call gsi_fv3ncdf_readuv(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin,.false.) else - call gsi_fv3ncdf_readuv_v1(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin) + call gsi_fv3ncdf_readuv_v1(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin,.false.) endif if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_read(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin) - call gsi_fv3ncdf_read(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin) + call gsi_fv3ncdf_read(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin,.false.) + call gsi_fv3ncdf_read(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin,.false.) else - call gsi_fv3ncdf_read_v1(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin) - call gsi_fv3ncdf_read_v1(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin) + call gsi_fv3ncdf_read_v1(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin,.false.) + call gsi_fv3ncdf_read_v1(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin,.false.) endif if( fv3sar_bg_opt == 0) then @@ -1523,7 +1662,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) return end subroutine gsi_fv3ncdf2d_read_v1 -subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) +subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin,ensgrid) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_read @@ -1556,7 +1695,7 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lola, only: fv3_h_to_ll,fv3_h_to_ll_ens use gsi_bundlemod, only: gsi_bundle use general_sub2grid_mod, only: sub2grid_info,general_grid2sub @@ -1565,6 +1704,7 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) type(gsi_bundle),intent(inout) :: cstate_nouv character(*),intent(in):: filenamein type (type_fv3regfilenameg),intent(in) ::fv3filenamegin + logical, intent(in ) :: ensgrid real(r_kind),allocatable,dimension(:,:):: uu2d real(r_kind),dimension(1,grd_ionouv%nlat,grd_ionouv%nlon,grd_ionouv%kbegin_loc:grd_ionouv%kend_alloc):: hwork character(len=max_varname_length) :: varname,vgsiname @@ -1586,8 +1726,13 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) mm1=mype+1 nloncase=grd_ionouv%nlon nlatcase=grd_ionouv%nlat - nxcase=nx - nycase=ny + if (ensgrid) then + nxcase=nxens + nycase=nyens + else + nxcase=nx + nycase=ny + end if kbgn=grd_ionouv%kbegin_loc kend=grd_ionouv%kend_loc allocate(uu2d(nxcase,nycase)) @@ -1630,11 +1775,19 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) if(fv3_io_layout_y > 1) then do nio=0,fv3_io_layout_y-1 + if (ensgrid) then + countloc=(/nxcase,ny_layout_lenens(nio),1/) + allocate(uu2d_layout(nxcase,ny_layout_lenens(nio))) + iret=nf90_inq_varid(gfile_loc_layout(nio),trim(adjustl(varname)),var_id) + iret=nf90_get_var(gfile_loc_layout(nio),var_id,uu2d_layout,start=startloc,count=countloc) + uu2d(:,ny_layout_bens(nio):ny_layout_eens(nio))=uu2d_layout + else countloc=(/nxcase,ny_layout_len(nio),1/) allocate(uu2d_layout(nxcase,ny_layout_len(nio))) iret=nf90_inq_varid(gfile_loc_layout(nio),trim(adjustl(varname)),var_id) iret=nf90_get_var(gfile_loc_layout(nio),var_id,uu2d_layout,start=startloc,count=countloc) uu2d(:,ny_layout_b(nio):ny_layout_e(nio))=uu2d_layout + end if deallocate(uu2d_layout) enddo else @@ -1642,7 +1795,11 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) iret=nf90_get_var(gfile_loc,var_id,uu2d,start=startloc,count=countloc) endif - call fv3_h_to_ll(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + if (ensgrid) then + call fv3_h_to_ll_ens(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + else + call fv3_h_to_ll(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + end if enddo ! ilevtot if(fv3_io_layout_y > 1) then @@ -1660,7 +1817,7 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) return end subroutine gsi_fv3ncdf_read -subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) +subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin,ensgrid) !$$$ subprogram documentation block ! . . . . @@ -1695,13 +1852,14 @@ subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll + use mod_fv3_lola, only: fv3_h_to_ll,fv3_h_to_ll_ens use gsi_bundlemod, only: gsi_bundle use general_sub2grid_mod, only: sub2grid_info,general_grid2sub implicit none type(sub2grid_info), intent(in):: grd_ionouv character(*),intent(in):: filenamein + logical, intent(in ) :: ensgrid type (type_fv3regfilenameg) :: fv3filenamegin type(gsi_bundle),intent(inout) :: cstate_nouv real(r_kind),allocatable,dimension(:,:):: uu2d @@ -1721,8 +1879,13 @@ subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) nloncase=grd_ionouv%nlon nlatcase=grd_ionouv%nlat - nxcase=nx - nycase=ny + if (ensgrid) then + nxcase=nxens + nycase=nyens + else + nxcase=nx + nycase=ny + end if kbgn=grd_ionouv%kbegin_loc kend=grd_ionouv%kend_loc allocate(uu2d(nxcase,nycase)) @@ -1756,7 +1919,11 @@ subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) iret=nf90_get_var(gfile_loc,var_id,uu2d,start=startloc,count=countloc) - call fv3_h_to_ll(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + if (ensgrid) then + call fv3_h_to_ll_ens(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + else + call fv3_h_to_ll(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + end if enddo ! i call general_grid2sub(grd_ionouv,hwork,cstate_nouv%values) @@ -1768,7 +1935,7 @@ subroutine gsi_fv3ncdf_read_v1(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) return end subroutine gsi_fv3ncdf_read_v1 -subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) +subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin,ensgrid) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_fv3ncdf_readuv @@ -1795,7 +1962,7 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll,fv3uv2earth + use mod_fv3_lola, only: fv3_h_to_ll,fv3uv2earth,fv3_h_to_ll_ens,fv3uv2earthens use general_sub2grid_mod, only: sub2grid_info,general_grid2sub implicit none @@ -1803,6 +1970,7 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) real(r_kind),dimension(grd_uv%lat2,grd_uv%lon2,grd_uv%nsig),intent(inout)::ges_u real(r_kind),dimension(grd_uv%lat2,grd_uv%lon2,grd_uv%nsig),intent(inout)::ges_v type (type_fv3regfilenameg),intent (in) :: fv3filenamegin + logical, intent(in ) :: ensgrid real(r_kind),dimension(2,grd_uv%nlat,grd_uv%nlon,grd_uv%kbegin_loc:grd_uv%kend_alloc):: hwork character(:), allocatable:: filenamein real(r_kind),allocatable,dimension(:,:):: u2d,v2d @@ -1829,8 +1997,13 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) mm1=mype+1 nloncase=grd_uv%nlon nlatcase=grd_uv%nlat - nxcase=nx - nycase=ny + if (ensgrid) then + nxcase=nxens + nycase=nyens + else + nxcase=nx + nycase=ny + end if kbgn=grd_uv%kbegin_loc kend=grd_uv%kend_loc allocate(u2d(nxcase,nycase+1)) @@ -1878,6 +2051,22 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) if(fv3_io_layout_y > 1) then do nio=0,fv3_io_layout_y-1 + if (ensgrid) then + u_countloc=(/nxcase,ny_layout_lenens(nio)+1,1/) + allocate(u2d_layout(nxcase,ny_layout_lenens(nio)+1)) + call check( nf90_inq_varid(gfile_loc_layout(nio),'u',u_grd_VarId) ) + iret=nf90_get_var(gfile_loc_layout(nio),u_grd_VarId,u2d_layout,start=u_startloc,count=u_countloc) + u2d(:,ny_layout_bens(nio):ny_layout_eens(nio))=u2d_layout(:,1:ny_layout_lenens(nio)) + if(nio==fv3_io_layout_y-1) u2d(:,ny_layout_eens(nio)+1)=u2d_layout(:,ny_layout_lenens(nio)+1) + deallocate(u2d_layout) + + v_countloc=(/nxcase+1,ny_layout_lenens(nio),1/) + allocate(v2d_layout(nxcase+1,ny_layout_lenens(nio))) + call check( nf90_inq_varid(gfile_loc_layout(nio),'v',v_grd_VarId) ) + iret=nf90_get_var(gfile_loc_layout(nio),v_grd_VarId,v2d_layout,start=v_startloc,count=v_countloc) + v2d(:,ny_layout_bens(nio):ny_layout_eens(nio))=v2d_layout + deallocate(v2d_layout) + else u_countloc=(/nxcase,ny_layout_len(nio)+1,1/) allocate(u2d_layout(nxcase,ny_layout_len(nio)+1)) call check( nf90_inq_varid(gfile_loc_layout(nio),'u',u_grd_VarId) ) @@ -1892,6 +2081,7 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) iret=nf90_get_var(gfile_loc_layout(nio),v_grd_VarId,v2d_layout,start=v_startloc,count=v_countloc) v2d(:,ny_layout_b(nio):ny_layout_e(nio))=v2d_layout deallocate(v2d_layout) + end if enddo else call check( nf90_inq_varid(gfile_loc,'u',u_grd_VarId) ) @@ -1904,7 +2094,11 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) call reverse_grid_r_uv (u2d,nxcase,nycase+1,1) call reverse_grid_r_uv (v2d,nxcase+1,nycase,1) endif - call fv3uv2earth(u2d(:,:),v2d(:,:),nxcase,nycase,uc2d,vc2d) + if (ensgrid) then + call fv3uv2earthens(u2d(:,:),v2d(:,:),nxcase,nycase,uc2d,vc2d) + else + call fv3uv2earth(u2d(:,:),v2d(:,:),nxcase,nycase,uc2d,vc2d) + end if ! NOTE on transfor to earth u/v: ! The u and v before transferring need to be in E-W/N-S grid, which is @@ -1922,8 +2116,13 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) ! and the last input parameter for fv3_h_to_ll is alway true: ! ! - call fv3_h_to_ll(uc2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) - call fv3_h_to_ll(vc2d,hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + if (ensgrid) then + call fv3_h_to_ll_ens(uc2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + call fv3_h_to_ll_ens(vc2d,hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + else + call fv3_h_to_ll(uc2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + call fv3_h_to_ll(vc2d,hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + end if enddo ! i if(fv3_io_layout_y > 1) then @@ -1942,7 +2141,7 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) deallocate(worksub) end subroutine gsi_fv3ncdf_readuv -subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) +subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin,ensgrid) !$$$ subprogram documentation block ! subprogram: gsi_fv3ncdf_readuv_v1 ! prgmmr: wu w org: np22 date: 2017-11-22 @@ -1970,7 +2169,7 @@ subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) use netcdf, only: nf90_nowrite,nf90_inquire,nf90_inquire_dimension use netcdf, only: nf90_inquire_variable use netcdf, only: nf90_inq_varid - use mod_fv3_lola, only: fv3_h_to_ll,fv3uv2earth + use mod_fv3_lola, only: fv3_h_to_ll,fv3_h_to_ll_ens use general_sub2grid_mod, only: sub2grid_info,general_grid2sub implicit none @@ -1978,6 +2177,7 @@ subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) real(r_kind) ,intent(out ) :: ges_u(grd_uv%lat2,grd_uv%lon2,grd_uv%nsig) real(r_kind) ,intent(out ) :: ges_v(grd_uv%lat2,grd_uv%lon2,grd_uv%nsig) type (type_fv3regfilenameg),intent (in) :: fv3filenamegin + logical, intent(in ) :: ensgrid real(r_kind),dimension(2,grd_uv%nlat,grd_uv%nlon,grd_uv%kbegin_loc:grd_uv%kend_alloc):: hwork character(len=:),allocatable :: filenamein real(r_kind),allocatable,dimension(:,:):: us2d,vw2d @@ -2000,8 +2200,13 @@ subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) mm1=mype+1 nloncase=grd_uv%nlon nlatcase=grd_uv%nlat - nxcase=nx - nycase=ny + if (ensgrid) then + nxcase=nxens + nycase=nyens + else + nxcase=nx + nycase=ny + end if kbgn=grd_uv%kbegin_loc kend=grd_uv%kend_loc allocate (us2d(nxcase,nycase+1),vw2d(nxcase+1,nycase)) @@ -2026,8 +2231,13 @@ subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) nz=grd_uv%nsig nzp1=nz+1 inative=nzp1-ilev - us_countloc= (/nlon_regional,nlat_regional+1,1/) - vw_countloc= (/nlon_regional+1,nlat_regional,1/) + if (ensgrid) then + us_countloc= (/nlon_regionalens,nlat_regionalens+1,1/) + vw_countloc= (/nlon_regionalens+1,nlat_regionalens,1/) + else + us_countloc= (/nlon_regional,nlat_regional+1,1/) + vw_countloc= (/nlon_regional+1,nlat_regional,1/) + end if us_startloc=(/1,1,inative+1/) vw_startloc=(/1,1,inative+1/) @@ -2042,11 +2252,19 @@ subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) uorv2d(:,j)=half*(us2d(:,j)+us2d(:,j+1)) enddo - call fv3_h_to_ll(uorv2d(:,:),hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + if (ensgrid) then + call fv3_h_to_ll_ens(uorv2d(:,:),hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + else + call fv3_h_to_ll(uorv2d(:,:),hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + end if do j=1,nx uorv2d(j,:)=half*(vw2d(j,:)+vw2d(j+1,:)) enddo - call fv3_h_to_ll(uorv2d(:,:),hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + if (ensgrid) then + call fv3_h_to_ll_ens(uorv2d(:,:),hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) + else + call fv3_h_to_ll(uorv2d(:,:),hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) + end if enddo ! iilevtoto call general_grid2sub(grd_uv,hwork,worksub) diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 23a21cd8e5..ad151fa33d 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -3841,7 +3841,8 @@ subroutine hybens_grid_setup ! 2010-02-20 parrish, adapt for dual resolution ! 2011-01-30 parrish, fix so regional application depends only on parameters regional ! and dual_res. Rename subroutine get_regional_gefs_grid to get_regional_dual_res_grid. -! +! +! 2022-03-01 X.Lu & X.Wang - add vars for hafs dual ens. POC: xuguang.wang@ou.edu ! input argument list: ! ! output argument list: @@ -3866,6 +3867,8 @@ subroutine hybens_grid_setup use constants, only: zero,one use control_vectors, only: cvars3d,nc2d,nc3d use gridmod, only: region_lat,region_lon,region_dx,region_dy + use hybrid_ensemble_parameters, only:regional_ensemble_option + use gsi_rfv3io_mod,only:gsi_rfv3io_get_ens_grid_specs implicit none @@ -3874,6 +3877,8 @@ subroutine hybens_grid_setup logical,allocatable::vector(:) real(r_kind) eps,r_e real(r_kind) rlon_a(nlon),rlat_a(nlat),rlon_e(nlon),rlat_e(nlat) + character(:),allocatable:: fv3_spec_grid_filename + integer :: ierr nord_e2a=4 ! soon, move this to hybrid_ensemble_parameters @@ -3960,6 +3965,10 @@ subroutine hybens_grid_setup else if(dual_res) then call get_region_dx_dy_ens(region_dx_ens,region_dy_ens) + if(regional_ensemble_option) then + fv3_spec_grid_filename="fv3_ens_grid_spec" + call gsi_rfv3io_get_ens_grid_specs(fv3_spec_grid_filename,ierr) + endif else region_dx_ens=region_dx region_dy_ens=region_dy diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 index 84f8144968..1c91b994da 100644 --- a/src/gsi/mod_fv3_lola.f90 +++ b/src/gsi/mod_fv3_lola.f90 @@ -18,12 +18,17 @@ module mod_fv3_lola ! fv3_ll_to_h ! 2019-11-01 wu - add checks in generate_anl_grid to present the mean ! longitude correctly to fix problem near lon=0 +! 2022-03-01 X.Lu & X.Wang - add functions for HAFS dual ens capability. POC: +! xuguang.wang@ou.edu ! ! subroutines included: ! sub generate_anl_grid +! sub definecoef_regular_grids ! sub earthuv2fv3 ! sub fv3uv2earth +! sub fv3uv2earthens ! sub fv3_h_to_ll +! sub fv3_h_to_ll_ens ! sub fv3_ll_to_h ! sub rotate2deg ! sub unrotate2deg @@ -65,6 +70,9 @@ module mod_fv3_lola public :: generate_anl_grid,fv3_h_to_ll,fv3_ll_to_h,fv3uv2earth,earthuv2fv3 public :: fv3dx,fv3dx1,fv3dy,fv3dy1,fv3ix,fv3ixp,fv3jy,fv3jyp,a3dx,a3dx1,a3dy,a3dy1,a3ix,a3ixp,a3jy,a3jyp public :: nxa,nya,cangu,sangu,cangv,sangv,nx,ny,bilinear + public :: definecoef_regular_grids,fv3_h_to_ll_ens,fv3uv2earthens + public :: fv3dxens,fv3dx1ens,fv3dyens,fv3dy1ens,fv3ixens,fv3ixpens,fv3jyens,fv3jypens,a3dxens,a3dx1ens,a3dyens,a3dy1ens,a3ixens,a3ixpens,a3jyens,a3jypens + public :: nxe,nye,canguens,sanguens,cangvens,sangvens,nxens,nyens logical bilinear integer(i_kind) nxa,nya,nx,ny @@ -73,6 +81,12 @@ module mod_fv3_lola real(r_kind) ,allocatable,dimension(:,:):: a3dx,a3dx1,a3dy,a3dy1 real(r_kind) ,allocatable,dimension(:,:):: cangu,sangu,cangv,sangv integer(i_kind),allocatable,dimension(:,:):: a3ix,a3ixp,a3jy,a3jyp + integer(i_kind) nxe,nye,nxens,nyens + real(r_kind) ,allocatable,dimension(:,:):: fv3dxens,fv3dx1ens,fv3dyens,fv3dy1ens + integer(i_kind),allocatable,dimension(:,:):: fv3ixens,fv3ixpens,fv3jyens,fv3jypens + real(r_kind) ,allocatable,dimension(:,:):: a3dxens,a3dx1ens,a3dyens,a3dy1ens + real(r_kind) ,allocatable,dimension(:,:):: canguens,sanguens,cangvens,sangvens + integer(i_kind),allocatable,dimension(:,:):: a3ixens,a3ixpens,a3jyens,a3jypens contains @@ -574,8 +588,403 @@ subroutine generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) enddo enddo deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) + deallocate(rlat_in,rlon_in) end subroutine generate_anl_grid +subroutine definecoef_regular_grids(nxens,nyens,grid_lon,grid_lont,grid_lat,grid_latt) +!$$$ subprogram documentation block +! . . . . +! subprogram: generate_??ens_grid +!clt modified from generate_regular_grid +! prgmmr: parrish +! +! abstract: define rotated lat-lon analysis grid which is centered on fv3 tile +! and oriented to completely cover the tile. +! +! program history log: +! 2017-05-02 parrish +! 2017-10-10 wu - 1. setup analysis A-grid, +! 2. compute/setup FV3 to A grid interpolation parameters +! 3. compute/setup A to FV3 grid interpolation parameters +! 4. setup weightings for wind conversion from FV3 to earth +! 2021-02-01 Lu & Wang - modify variable intent for HAFS dual ens. POC: +! xuguang.wang@ou.edu +! +! input argument list: +! nxens, nyens - number of cells = nxens*nyens +! grid_lon ,grid_lat - longitudes and latitudes of fv3 grid cell corners +! grid_lont,grid_latt - longitudes and latitudes of fv3 grid cell centers +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + use kinds, only: r_kind,i_kind + use constants, only: quarter,one,two,half,zero,deg2rad,rearth,rad2deg + use gridmod, only:grid_ratio_fv3_regional + use mpimod, only: mype + use hybrid_ensemble_parameters, only: nlon_ens,nlat_ens,region_lon_ens,region_lat_ens + implicit none + real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b + real(r_kind),allocatable,dimension(:)::ybh_a,ya_a,ya_b,yy + real(r_kind),allocatable,dimension(:,:)::xbh_b,ybh_b + real(r_kind) dlat,dlon,dyy,dxx,dyyi,dxxi + real(r_kind) dyyh,dxxh + + integer(i_kind), intent(in ) :: nxens,nyens ! fv3 tile x- and y-dimensions + real(r_kind) , intent(inout) :: grid_lon(nxens+1,nyens+1) ! fv3 cell corner longitudes + real(r_kind) , intent(inout) :: grid_lont(nxens,nyens) ! fv3 cell center longitudes + real(r_kind) , intent(inout) :: grid_lat(nxens+1,nyens+1) ! fv3 cell corner latitudes + real(r_kind) , intent(inout) :: grid_latt(nxens,nyens) ! fv3 cell center latitudes + integer(i_kind) i,j,ir,jr,n + real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in + real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an + real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon + integer(i_kind) nlonh,nlath,nxh,nyh + integer(i_kind) ib1,ib2,jb1,jb2,jj + integer (i_kind):: index0 + real(r_kind) region_lat_in(nlat_ens,nlon_ens),region_lon_in(nlat_ens,nlon_ens) + integer(i_kind) nord_e2a + real(r_kind)gxa,gya + + real(r_kind) x(nxens+1,nyens+1),y(nxens+1,nyens+1),z(nxens+1,nyens+1),xr,yr,zr,xu,yu,zu,rlat,rlon + real(r_kind) xv,yv,zv,vval + real(r_kind) cx,cy + real(r_kind) uval,ewval,nsval + + real(r_kind) d(4),ds + integer(i_kind) kk,k + + nord_e2a=4 + bilinear=.false. + +! create xc,yc,zc for the cell centers. + allocate(xc(nxens,nyens)) + allocate(yc(nxens,nyens)) + allocate(zc(nxens,nyens)) + allocate(gclat(nxens,nyens)) + allocate(gclon(nxens,nyens)) + allocate(gcrlat(nxens,nyens)) + allocate(gcrlon(nxens,nyens)) + do j=1,nyens + do i=1,nxens + xc(i,j)=cos(grid_latt(i,j)*deg2rad)*cos(grid_lont(i,j)*deg2rad) + yc(i,j)=cos(grid_latt(i,j)*deg2rad)*sin(grid_lont(i,j)*deg2rad) + zc(i,j)=sin(grid_latt(i,j)*deg2rad) + enddo + enddo + +! compute center as average x,y,z coordinates of corners of domain -- + + xcent=quarter*(xc(1,1)+xc(1,nyens)+xc(nxens,1)+xc(nxens,nyens)) + ycent=quarter*(yc(1,1)+yc(1,nyens)+yc(nxens,1)+yc(nxens,nyens)) + zcent=quarter*(zc(1,1)+zc(1,nyens)+zc(nxens,1)+zc(nxens,nyens)) + + rnorm=one/sqrt(xcent**2+ycent**2+zcent**2) + xcent=rnorm*xcent + ycent=rnorm*ycent + zcent=rnorm*zcent + centlat=asin(zcent)*rad2deg + centlon=atan2(ycent,xcent)*rad2deg + +!! compute new lats, lons + call rotate2deg(grid_lont,grid_latt,gcrlon,gcrlat, & + centlon,centlat,nxens,nyens) + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! compute analysis A-grid lats, lons +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +!--------------------------obtain analysis grid dimensions nxe,nye + nxe=nlon_ens + nye=nlat_ens + if(mype==0) print *,'nlat,nlon=nye,nxe= ',nlat_ens,nlon_ens + + allocate(rlat_in(nlat_ens,nlon_ens),rlon_in(nlat_ens,nlon_ens)) + region_lon_ens=region_lon_ens*rad2deg + region_lat_ens=region_lat_ens*rad2deg + call rotate2deg(region_lon_ens,region_lat_ens,rlon_in,rlat_in, & + centlon,centlat,nlat_ens,nlon_ens) + +!--------------------------obtain analysis grid spacing + dlat=(maxval(gcrlat)-minval(gcrlat))/(nyens-1) + dlon=(maxval(gcrlon)-minval(gcrlon))/(nxens-1) + + +!-----setup analysis A-grid from center of the domain +!--------------------compute all combinations of relative coordinates + + allocate(xbh_a(nxens),xbh_b(nxens,nyens),xa_a(nxe),xa_b(nxe)) + allocate(ybh_a(nyens),ybh_b(nxens,nyens),ya_a(nye),ya_b(nye)) + + nxh=nxens/2 + nyh=nyens/2 + + +!!!!!! fv3 rotated grid; not equal spacing, non_orthogonal !!!!!! + do j=1,nyens + jr=nyens+1-j + do i=1,nxens + ir=nxens+1-i + xbh_b(ir,jr)=gcrlon(i,j)/dlon + end do + end do + do j=1,nyens + jr=nyens+1-j + do i=1,nxens + ir=nxens+1-i + ybh_b(ir,jr)=gcrlat(i,j)/dlat + end do + end do + +!!!! define analysis A grid !!!!!!!!!!!!! + + index0=1 + do j=1,nxe + xa_a(j)= rlon_in(index0,j)/dlon + end do + do i=1,nye + ya_a(i)= rlat_in(i,index0)/dlat + end do + +!!!!!compute fv3 to A grid interpolation parameters !!!!!!!!! + allocate (fv3dxens(nxe,nye),fv3dx1ens(nxe,nye),fv3dyens(nxe,nye),fv3dy1ens(nxe,nye)) + allocate (fv3ixens(nxe,nye),fv3ixpens(nxe,nye),fv3jyens(nxe,nye),fv3jypens(nxe,nye)) + allocate(yy(nyens)) + +! iteration to find the fv3 grid cell + jb1=1 + ib1=1 + do j=1,nye + do i=1,nxe + do n=1,3 + gxa=xa_a(i) + if(gxa < xbh_b(1,jb1))then + gxa= 1 + else if(gxa > xbh_b(nxens,jb1))then + gxa= nxens + else + call grdcrd1(gxa,xbh_b(1,jb1),nxens,1) + endif + ib2=ib1 + ib1=gxa + do jj=1,nyens + yy(jj)=ybh_b(ib1,jj) + enddo + gya=ya_a(j) + if(gya < yy(1))then + gya= 1 + else if(gya > yy(nyens))then + gya= nyens + else + call grdcrd1(gya,yy,nyens,1) + endif + jb2=jb1 + jb1=gya + + if((ib1 == ib2) .and. (jb1 == jb2)) exit + if(n==3 ) then +!!!!!!! if not converge, find the nearest corner point + d(1)=(xa_a(i)-xbh_b(ib1,jb1))**2+(ya_a(j)-ybh_b(ib1,jb1))**2 + d(2)=(xa_a(i)-xbh_b(ib1+1,jb1))**2+(ya_a(j)-ybh_b(ib1+1,jb1))**2 + d(3)=(xa_a(i)-xbh_b(ib1,jb1+1))**2+(ya_a(j)-ybh_b(ib1,jb1+1))**2 + d(4)=(xa_a(i)-xbh_b(ib1+1,jb1+1))**2+(ya_a(j)-ybh_b(ib1+1,jb1+1))**2 + kk=1 + do k=2,4 + if(d(k) xa_a(nxe))then + gxa= nxe + else + call grdcrd1(gxa,xa_a,nxe,1) + endif + a3ixens(j,i)=int(gxa) + a3ixens(j,i)=min(max(1,a3ixens(j,i)),nxe) + a3dxens(j,i)=max(zero,min(one,gxa-a3ixens(j,i))) + a3dx1ens(j,i)=one-a3dxens(j,i) + a3ixpens(j,i)=min(nxe,a3ixens(j,i)+1) + end do + end do + + do i=1,nxens + do j=1,nyens + gya=ybh_b(i,j) + if(gya < ya_a(1))then + gya= 1 + else if(gya > ya_a(nye))then + gya= nye + else + call grdcrd1(gya,ya_a,nye,1) + endif + a3jyens(j,i)=int(gya) + a3jyens(j,i)=min(max(1,a3jyens(j,i)),nye) + a3dyens(j,i)=max(zero,min(one,gya-a3jyens(j,i))) + a3dy1ens(j,i)=one-a3dyens(j,i) + a3jypens(j,i)=min(nye,a3jyens(j,i)+1) + end do + end do + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!! find coefficients for wind conversion btw FV3 & earth +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + allocate (canguens(nxens,nyens+1),sanguens(nxens,nyens+1),cangvens(nxens+1,nyens),sangvens(nxens+1,nyens)) + +! 1. compute x,y,z at cell cornor from grid_lon, grid_lat + + do j=1,nyens+1 + do i=1,nxens+1 + x(i,j)=cos(grid_lat(i,j)*deg2rad)*cos(grid_lon(i,j)*deg2rad) + y(i,j)=cos(grid_lat(i,j)*deg2rad)*sin(grid_lon(i,j)*deg2rad) + z(i,j)=sin(grid_lat(i,j)*deg2rad) + enddo + enddo + +! 2 find angles to E-W and N-S for U edges + + do j=1,nyens+1 + do i=1,nxens +! center lat/lon of the edge + rlat=half*(grid_lat(i,j)+grid_lat(i+1,j)) + rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)) +! vector to center of the edge + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) +! vector of the edge + xu= x(i+1,j)-x(i,j) + yu= y(i+1,j)-y(i,j) + zu= z(i+1,j)-z(i,j) +! find angle with cross product + uval=sqrt((xu**2+yu**2+zu**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + canguens(i,j)=(-yr*xu+xr*yu)/ewval/uval + sanguens(i,j)=(-xr*zr*xu-zr*yr*yu+(xr*xr+yr*yr)*zu) / nsval/uval + enddo + enddo + +! 3 find angles to E-W and N-S for V edges + do j=1,nyens + do i=1,nxens+1 + rlat=half*(grid_lat(i,j)+grid_lat(i,j+1)) + rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)) + xr=cos(rlat*deg2rad)*cos(rlon*deg2rad) + yr=cos(rlat*deg2rad)*sin(rlon*deg2rad) + zr=sin(rlat*deg2rad) + xv= x(i,j+1)-x(i,j) + yv= y(i,j+1)-y(i,j) + zv= z(i,j+1)-z(i,j) + vval=sqrt((xv**2+yv**2+zv**2)) + ewval=sqrt((xr**2+yr**2)) + nsval=sqrt((xr*zr)**2+(zr*yr)**2+(xr*xr+yr*yr)**2) + cangvens(i,j)=(-yr*xv+xr*yv)/ewval/vval + sangvens(i,j)=(-xr*zr*xv-zr*yr*yv+(xr*xr+yr*yr)*zv) / nsval/vval + enddo + enddo + deallocate( xc,yc,zc,gclat,gclon,gcrlat,gcrlon) + deallocate(rlat_in,rlon_in) +end subroutine definecoef_regular_grids + subroutine earthuv2fv3(u,v,nx,ny,u_out,v_out) !$$$ subprogram documentation block ! . . . . @@ -679,6 +1088,51 @@ subroutine fv3uv2earth(u,v,nx,ny,u_out,v_out) return end subroutine fv3uv2earth +subroutine fv3uv2earthens(u,v,nxens,nyens,u_out,v_out) +!$$$ subprogram documentation block +! . . . . +! subprogram: fv3uv2earthens +! prgmmr: wu 2017-06-15 +! +! abstract: project fv3 UV to earth UV and interpolate to the center of the +! cells +! +! program history log: +! +! +! input argument list: +! u,v - fv3 winds on the cell boundaries +! nx,ny - dimensions +! +! output argument list: +! u_out,v_out - output earth wind components at center of the cell +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: r_kind,i_kind + use constants, only: half + implicit none + + integer(i_kind), intent(in ) :: nxens,nyens ! fv3 tile x- and y-dimensions + real(r_kind),intent(in ) :: u(nxens,nyens+1),v(nxens+1,nyens) + real(r_kind),intent( out) :: u_out(nxens,nyens),v_out(nxens,nyens) + integer(i_kind) i,j + + do j=1,nyens + do i=1,nxens + u_out(i,j)=half *((u(i,j)*sangvens(i,j)-v(i,j)*sanguens(i,j))/(canguens(i,j)*sangvens(i,j)-sanguens(i,j)*cangvens(i,j)) & + +(u(i,j+1)*sangvens(i+1,j)-v(i+1,j)*sanguens(i,j+1))/(canguens(i,j+1)*sangvens(i+1,j)-sanguens(i,j+1)*cangvens(i+1,j))) + v_out(i,j)=half *((u(i,j)*cangvens(i,j)-v(i,j)*canguens(i,j))/(sanguens(i,j)*cangvens(i,j)-canguens(i,j)*sangvens(i,j)) & + +(u(i,j+1)*cangvens(i+1,j)-v(i+1,j)*canguens(i,j+1))/(sanguens(i,j+1)*cangvens(i+1,j)-canguens(i,j+1)*sangvens(i+1,j))) + end do + end do + return +end subroutine fv3uv2earthens + subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma,rev_flg) !$$$ subprogram documentation block ! . . . . @@ -753,6 +1207,86 @@ subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma,rev_flg) return end subroutine fv3_h_to_ll +subroutine fv3_h_to_ll_ens(b_in,a,nb,mb,na,ma,rev_flg) +!$$$ subprogram documentation block +! . . . . +! subprogram: fv3_h_to_ll +! prgmmr: wu 2017-05-30 +! +! abstract: interpolate from rotated fv3 grid to A grid. +! Interpolation choices 1)bilinear both ways +! 2)inverse-distance weighting average +! reverse E-W and N-S directions & reverse i,j for output array a(nlat,nlon) +! +! program history log: +! +! +! input argument list: +! mb,nb - fv3 dimensions +! ma,na - a dimensions +! b - input variable b +! xb,yb - b array x and y coordinates +! xa,ya - a array coordinates (xa in xb units, ya in yb units) +! +! output argument list: +! a - output interpolated array +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + use mpimod, only: mype + use constants, only: zero,one + implicit none + + integer(i_kind),intent(in ) :: mb,nb,ma,na + real(r_kind) ,intent(in ) :: b_in(nb,mb) + logical ,intent(in ) :: rev_flg + real(r_kind) ,intent( out) :: a(ma,na) + + integer(i_kind) i,j,ir,jr,mbp,nbp + real(r_kind) b(nb,mb) + + mbp=mb+1 + nbp=nb+1 + bilinear=.false. + if(rev_flg) then +!!!!!!!!! reverse E-W and N-S + do j=1,mb + jr=mbp-j + do i=1,nb + ir=nbp-i + b(ir,jr)=b_in(i,j) + end do + end do + else + b(:,:)=b_in(:,:) + endif +!!!!!!!!! interpolate to A grid & reverse ij for array a(lat,lon) + if(bilinear)then ! bilinear interpolation + do j=1,ma + do i=1,na + a(j,i)=fv3dx1ens(i,j)*(fv3dy1ens(i,j)*b(fv3ixens(i,j),fv3jyens(i,j)) & + +fv3dyens(i,j)*b(fv3ixens(i,j),fv3jypens(i,j))) & + +fv3dxens(i,j)*(fv3dy1ens(i,j)*b(fv3ixpens(i,j),fv3jyens(i,j)) & + +fv3dyens(i,j)*b(fv3ixpens(i,j),fv3jypens(i,j))) + end do + end do + else ! inverse-distance weighting average + do j=1,ma + do i=1,na + a(j,i)=fv3dxens(i,j)*b(fv3ixens(i,j),fv3jyens(i,j)) & + +fv3dyens(i,j)*b(fv3ixens(i,j),fv3jypens(i,j)) & + +fv3dx1ens(i,j)*b(fv3ixpens(i,j),fv3jyens(i,j)) & + +fv3dy1ens(i,j)*b(fv3ixpens(i,j),fv3jypens(i,j)) + end do + end do + endif + + return +end subroutine fv3_h_to_ll_ens + subroutine fv3_ll_to_h(a,b,nxa,nya,nxb,nyb,rev_flg) !$$$ subprogram documentation block ! . . . . From 4a5bd0d21e4c7b98eb2b9a43682a60707bb7c8ab Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Wed, 2 Mar 2022 13:05:43 -0600 Subject: [PATCH 086/155] Clean up src/gsi so that it only contains FGAT related changes on top of the GSI/master. --- src/gsi/compute_derived.f90 | 6 ------ src/gsi/fv3_regional_interface.f90 | 1 + src/gsi/gesinfo.F90 | 2 +- src/gsi/guess_grids.F90 | 2 -- src/gsi/ncepnems_io.f90 | 4 ++-- src/gsi/observer.F90 | 2 -- src/gsi/prt_guess.f90 | 1 + src/gsi/radinfo.f90 | 1 - src/gsi/read_goesndr.f90 | 4 ---- src/gsi/read_obs.F90 | 1 + src/gsi/read_satwnd.f90 | 2 +- src/gsi/setupw.f90 | 1 + src/gsi/write_all.F90 | 5 +++-- 13 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/gsi/compute_derived.f90 b/src/gsi/compute_derived.f90 index 40d41b6a9c..46413d9986 100644 --- a/src/gsi/compute_derived.f90 +++ b/src/gsi/compute_derived.f90 @@ -321,15 +321,9 @@ subroutine compute_derived(mype,init_pass) ! NOTE: tropopause pressure is not needed for 2dvar option if(regional)then - call gsi_bundlegetpointer (gsi_metguess_bundle(it),'q',ges_q,ier) - if(ier == 0) then !clt for being now call tpause(mype,'temp') - endif else ! (regional) - call gsi_bundlegetpointer (gsi_metguess_bundle(it),'q',ges_q,ier)!clt for being now just to get ier - if(ier == 0) then !clt for being now call tpause(mype,'pvoz') - endif end if ! (regional) endif ! (init_pass) diff --git a/src/gsi/fv3_regional_interface.f90 b/src/gsi/fv3_regional_interface.f90 index d47bcd0c81..d24334fef9 100644 --- a/src/gsi/fv3_regional_interface.f90 +++ b/src/gsi/fv3_regional_interface.f90 @@ -29,6 +29,7 @@ subroutine convert_fv3_regional use kinds, only: r_single,r_kind,i_kind use gsi_rfv3io_mod, only: gsi_rfv3io_get_grid_specs use gsi_rfv3io_mod, only: bg_fv3regfilenameg + implicit none integer(i_kind) ierr character(128) grid_spec,ak_bk diff --git a/src/gsi/gesinfo.F90 b/src/gsi/gesinfo.F90 index 8d379247d4..5d86c04dc6 100644 --- a/src/gsi/gesinfo.F90 +++ b/src/gsi/gesinfo.F90 @@ -575,7 +575,7 @@ subroutine gesinfo fha(2)=nhr_assimilation endif call w3movdat(fha,ida,jda) - + iedate(1:5)=(/jda(1),jda(2),jda(3),jda(5),jda(6)/) iadateend=jda(1)*1000000+jda(2)*10000+jda(3)*100+jda(5) diff --git a/src/gsi/guess_grids.F90 b/src/gsi/guess_grids.F90 index b09e9de3dc..e19ce93638 100644 --- a/src/gsi/guess_grids.F90 +++ b/src/gsi/guess_grids.F90 @@ -745,8 +745,6 @@ subroutine create_chemges_grids(mype,istatus) ! When proper connection to ESMF is complete, ! the following will not be needed here ! ------------------------------------------ -!clt to think -!tothink call gsi_chemguess_get('dim',ntgases,istatus) if(istatus/=0) then if(mype==0) write(6,*) myname_, ': trouble getting number of chem/gases' diff --git a/src/gsi/ncepnems_io.f90 b/src/gsi/ncepnems_io.f90 index a2b1a9438c..73f06ffd07 100755 --- a/src/gsi/ncepnems_io.f90 +++ b/src/gsi/ncepnems_io.f90 @@ -339,7 +339,7 @@ subroutine read_ call gsi_bundlecreate(atm_bundle,atm_grid,'aux-atm-read',istatus,names2d=vars2d,names3d=vars3d) if(istatus/=0) then write(6,*) myname_,': trouble creating atm_bundle' - call stop2(2999) + call stop2(999) endif @@ -2340,7 +2340,7 @@ subroutine write_fv3atm_ (grd,sp_a,filename,mype_out,gfs_bundle,ibin) write(6,*) 'Missing some of the required fields' write(6,*) 'Aborting ... ' endif - call stop2(1999) + call stop2(999) endif if ( sp_a%jcap /= jcap_b ) then diff --git a/src/gsi/observer.F90 b/src/gsi/observer.F90 index f48b4dc685..00f51448ac 100644 --- a/src/gsi/observer.F90 +++ b/src/gsi/observer.F90 @@ -139,7 +139,6 @@ subroutine guess_init_ use compact_diffs,only: create_cdiff_coefs, inisph use mp_compact_diffs_mod1, only: init_mp_compact_diffs1 use mpeu_util, only: die - use mpimod, only: ierror,mpi_comm_world,npe,mpi_rtype,mype implicit none ! Declare passed variables @@ -304,7 +303,6 @@ subroutine set_ use mpeu_util, only: tell,die use gsi_io, only: mype_io - use mpimod, only: ierror,mpi_comm_world implicit none character(len=*), parameter :: Iam="observer_set" diff --git a/src/gsi/prt_guess.f90 b/src/gsi/prt_guess.f90 index 5a2b9211eb..e1e251195a 100644 --- a/src/gsi/prt_guess.f90 +++ b/src/gsi/prt_guess.f90 @@ -124,6 +124,7 @@ subroutine prt_guess(sgrep) ier=99 endif end if + if (ier/=0) return ! this is a fundamental routine, when some not found just return cvar( 1)='U ' cvar( 2)='V ' diff --git a/src/gsi/radinfo.f90 b/src/gsi/radinfo.f90 index d19ceee920..081d391db2 100644 --- a/src/gsi/radinfo.f90 +++ b/src/gsi/radinfo.f90 @@ -1147,7 +1147,6 @@ subroutine radinfo_read iuse_rad(j)=-1 end if end do - end if endif diff --git a/src/gsi/read_goesndr.f90 b/src/gsi/read_goesndr.f90 index 5888a4f44b..86fc1f0a5c 100644 --- a/src/gsi/read_goesndr.f90 +++ b/src/gsi/read_goesndr.f90 @@ -313,10 +313,6 @@ subroutine read_goesndr(mype,val_goes,ithin,rmesh,jsatid,infile,& ! if not proper satellite/detector read next bufr record if (ksatid /=lsatid) cycle read_loop if(obstype /= 'sndr')then - -!cltorg if(abs(hdr(8)-ldetect).gt. 100) cycle read_loop !cltthinkdeb to - !avoid large value of hdr(8) (100000??) would cause nint(hdr(8)) aborted when - !compiled with debug mode if(ldetect /= nint(hdr(8)))cycle read_loop end if diff --git a/src/gsi/read_obs.F90 b/src/gsi/read_obs.F90 index ff3a21293e..626952bf9d 100644 --- a/src/gsi/read_obs.F90 +++ b/src/gsi/read_obs.F90 @@ -1999,6 +1999,7 @@ subroutine read_obs(ndata,mype) write(lunsave) nobs_sub close(lunsave) endif + ! End of routine return end subroutine read_obs diff --git a/src/gsi/read_satwnd.f90 b/src/gsi/read_satwnd.f90 index 47d1a0a444..c47fd4ceea 100644 --- a/src/gsi/read_satwnd.f90 +++ b/src/gsi/read_satwnd.f90 @@ -72,7 +72,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! 2019-9-25 Su - modified ithin value criteria to distinguash thinning ! or hilber curve downweighting ! -! 2020-05-04 Wu - no rotate_wind for fv3_regional +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! ! diff --git a/src/gsi/setupw.f90 b/src/gsi/setupw.f90 index 3d5654a22b..33f0a62957 100644 --- a/src/gsi/setupw.f90 +++ b/src/gsi/setupw.f90 @@ -1697,6 +1697,7 @@ subroutine contents_binary_diag_(udiag,vdiag) if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information + uob_reg=data(iuob,i) vob_reg=data(ivob,i) dlon_e=data(ilone,i)*deg2rad diff --git a/src/gsi/write_all.F90 b/src/gsi/write_all.F90 index 94d0b574e9..b23d4eeed1 100644 --- a/src/gsi/write_all.F90 +++ b/src/gsi/write_all.F90 @@ -42,6 +42,7 @@ subroutine write_all(increment) use mpeu_util, only: die use control_vectors, only: control_vector + implicit none ! !INPUT PARAMETERS: @@ -121,8 +122,8 @@ subroutine write_all(increment) ! Regional output if (regional) then if (fv3_regional) then - call bg_fv3regfilenameg%init(ifilesig(ntguessig)) - call wrfv3_netcdf(bg_fv3regfilenameg) + call bg_fv3regfilenameg%init(ifilesig(ntguessig)) + call wrfv3_netcdf(bg_fv3regfilenameg) else call io%write_regional_analysis(mype) endif From 6d8db74fea755c6aa2f315ff1819f873227f9d91 Mon Sep 17 00:00:00 2001 From: "Bin.Liu" Date: Wed, 2 Mar 2022 13:17:38 -0600 Subject: [PATCH 087/155] Revert changes in regression/regression_param.sh regression/regression_var.sh so that they are identical to master version. --- regression/regression_param.sh | 2 +- regression/regression_var.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/regression/regression_param.sh b/regression/regression_param.sh index 02ce38b57f..65f6774daf 100755 --- a/regression/regression_param.sh +++ b/regression/regression_param.sh @@ -42,7 +42,7 @@ esac # Maximum memory per task for above machines # wcoss_c : 64 Gb / 24 cores = 2.67 Gb / core # wcoss_d : 128 Gb / 28 cores = 4.57 Gb / core -# hera : 83 Gb / 40 cores = 2.075 Gb / core +# theia : 64 Gb / 24 cores = 2.67 Gb / core # discover: # cheyenne: # Select minimim memory per core for regression tests diff --git a/regression/regression_var.sh b/regression/regression_var.sh index 260e87b6d8..37096edde1 100755 --- a/regression/regression_var.sh +++ b/regression/regression_var.sh @@ -109,7 +109,7 @@ case $machine in export noscrub="/scratch1/NCEPDEV/da/$LOGNAME/noscrub" elif [ -d /scratch1/NCEPDEV/global/$LOGNAME ]; then export noscrub="/scratch1/NCEPDEV/global/$LOGNAME/noscrub" - elif [ -d /scratch2/BMC/gsienkf/$LOGNAME ]; then + elif [ -d /scratch2/BMC/gsienkf/$LOGNAME ]; then export noscrub="/scratch2/BMC/gsienkf/$LOGNAME" fi @@ -131,7 +131,7 @@ case $machine in # On Hera, there are no scrubbers to remove old contents from stmp* directories. # After completion of regression tests, will remove the regression test subdirecories -# export clean=".true." + export clean=".true." ;; Jet) From bc031717f323cbe900aa5c89f7bb8e8a61556350 Mon Sep 17 00:00:00 2001 From: Li Bi Date: Fri, 4 Mar 2022 16:39:35 +0000 Subject: [PATCH 088/155] GitHub Issue NOAA-EMC/GSI#325. Merge FGAT capability for regional DA --- src/gsi/fv3_regional_interface.f90 | 9 +- src/gsi/gsi_rfv3io_mod.f90 | 311 ++++++++++++++++------------- src/gsi/read_guess.F90 | 10 +- src/gsi/setuprw.f90 | 2 +- src/gsi/setupw.f90 | 1 - src/gsi/write_all.F90 | 5 +- 6 files changed, 182 insertions(+), 156 deletions(-) diff --git a/src/gsi/fv3_regional_interface.f90 b/src/gsi/fv3_regional_interface.f90 index 80ce16ba88..c7035589a9 100644 --- a/src/gsi/fv3_regional_interface.f90 +++ b/src/gsi/fv3_regional_interface.f90 @@ -18,7 +18,7 @@ subroutine convert_fv3_regional ! 2017-04-08 parrish ! 2018-02-16 wu - read in grid and time infor from fv3 files ! read directly from fv3 files and not writeout GSI internal file -! +! 2020-11-19 Lu & Wang - add time label it for fgat. POC: xuguang.wang@ou.edu ! ! attributes: ! language: f90 @@ -28,18 +28,13 @@ subroutine convert_fv3_regional use kinds, only: r_single,r_kind,i_kind use gsi_rfv3io_mod, only: gsi_rfv3io_get_grid_specs - use gsi_rfv3io_mod, only: bg_fv3regfilenameg implicit none integer(i_kind) ierr - character(128) grid_spec,ak_bk !!!!!!!!!!! get grid specs !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - grid_spec='fv3_grid_spec' ! horizontal grid information - ak_bk='fv3_akbk' ! vertical grid information - call bg_fv3regfilenameg%init(grid_spec_input='fv3_grid_spec',ak_bk_input='fv3_akbk') - call gsi_rfv3io_get_grid_specs(bg_fv3regfilenameg,ierr) + call gsi_rfv3io_get_grid_specs(ierr) if(ierr/=0)then write(6,*)' problem in convert_fv3_regional - get_grid_specs Status = ',ierr call stop2 (555) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 496370e7c5..b06db77dd3 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -17,6 +17,7 @@ module gsi_rfv3io_mod ! 2022-01-07 Hu - add code to readi/write subdomain restart files. ! This function is needed when fv3 model sets ! io_layout(2)>1 +! 2022-02-15 Lu @ Wang - add time label it for FGAT. POC: xuguang.wang@ou.edu ! subroutines included: ! sub gsi_rfv3io_get_grid_specs ! sub read_fv3_files @@ -45,6 +46,7 @@ module gsi_rfv3io_mod use gsi_bundlemod, only : gsi_bundle use general_sub2grid_mod, only: sub2grid_info use gridmod, only: fv3_io_layout_y + use guess_grids, only: nfldsig,ntguessig,ifilesig implicit none public type_fv3regfilenameg public bg_fv3regfilenameg @@ -64,7 +66,7 @@ module gsi_rfv3io_mod integer(i_kind):: fv3sar_bg_opt=0 - type(type_fv3regfilenameg):: bg_fv3regfilenameg + type(type_fv3regfilenameg),allocatable:: bg_fv3regfilenameg(:) integer(i_kind) nx,ny,nz integer(i_kind),dimension(:),allocatable :: ny_layout_len,ny_layout_b,ny_layout_e real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) @@ -146,52 +148,51 @@ module gsi_rfv3io_mod type(gsi_bundle):: gsibundle_fv3lam_tracer_nouv contains - subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & - tracers_input,sfcdata_input,couplerres_input) + subroutine fv3regfilename_init(this,it) implicit None class(type_fv3regfilenameg),intent(inout):: this - character(*),optional :: grid_spec_input,ak_bk_input,dynvars_input, & - tracers_input,sfcdata_input,couplerres_input - if(present(grid_spec_input))then - - this%grid_spec=grid_spec_input - else + character(255):: filename + integer,intent(in) :: it + if (it == ntguessig) then this%grid_spec='fv3_grid_spec' - endif - if(present(ak_bk_input))then - this%ak_bk=ak_bk_input else - this%ak_bk='fv3_ak_bk' + write(filename,"(A14,I2.2)") 'fv3_grid_spec_',ifilesig(it) + this%grid_spec=trim(filename) endif - if(present(dynvars_input))then - - this%dynvars=dynvars_input + if (it == ntguessig) then + this%ak_bk='fv3_ak_bk' else - this%dynvars='fv3_dynvars' + write(filename,"(A10,I2.2)") 'fv3_ak_bk_',ifilesig(it) + this%ak_bk=trim(filename) endif - if(present(tracers_input))then - - this%tracers=tracers_input + if (it == ntguessig) then + this%dynvars='fv3_dynvars' else - this%tracers='fv3_tracer' + write(filename,"(A12,I2.2)") 'fv3_dynvars_',ifilesig(it) + this%dynvars=trim(filename) endif - if(present(sfcdata_input))then - - this%sfcdata=sfcdata_input + if (it == ntguessig) then + this%tracers='fv3_tracer' else - this%sfcdata='fv3_sfcdata' + write(filename,"(A11,I2.2)") 'fv3_tracer_',ifilesig(it) + this%tracers=trim(filename) endif - - if(present(couplerres_input))then - - this%couplerres=couplerres_input + if (it == ntguessig) then + this%sfcdata='fv3_sfcdata' else + write(filename,"(A12,I2.2)") 'fv3_sfcdata_',ifilesig(it) + this%sfcdata=trim(filename) + endif + if (it == ntguessig) then this%couplerres='coupler.res' + else + write(filename,"(A12,I2.2)") 'coupler.res_',ifilesig(it) + this%couplerres=trim(filename) endif end subroutine fv3regfilename_init -subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) +subroutine gsi_rfv3io_get_grid_specs(ierr) !$$$ subprogram documentation block ! . . . . ! subprogram: gsi_rfv3io_get_grid_specs @@ -236,7 +237,6 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) implicit none integer(i_kind) gfile_grid_spec - type (type_fv3regfilenameg) :: fv3filenamegin character(:),allocatable :: grid_spec character(:),allocatable :: ak_bk character(len=:),allocatable :: coupler_res_filenam @@ -252,9 +252,9 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) integer(i_kind),allocatable :: gfile_loc_layout(:) character(len=180) :: filename_layout - coupler_res_filenam=fv3filenamegin%couplerres - grid_spec=fv3filenamegin%grid_spec - ak_bk=fv3filenamegin%ak_bk + coupler_res_filenam='coupler.res' + grid_spec='fv3_grid_spec' + ak_bk='fv3_akbk' !!!!! set regional_time open(24,file=trim(coupler_res_filenam),form='formatted') @@ -495,6 +495,7 @@ subroutine read_fv3_files(mype) ! Declare local variables logical(4) fexist character(6) filename + character(14) filenames integer(i_kind) in_unit integer(i_kind) i,j,iwan,npem1 integer(i_kind) nhr_half @@ -503,6 +504,8 @@ subroutine read_fv3_files(mype) integer(i_kind),dimension(5):: idate5 real(r_kind) hourg,temp,t4dv real(r_kind),dimension(202,2):: time_ges + character*1 :: datein(4),dateout(4) + integer(i_kind) datecc !----------------------------------------------------------------------------- ! Start read_nems_nmmb_files here. @@ -527,14 +530,26 @@ subroutine read_fv3_files(mype) in_unit=15 iwan=0 !WWWWWW setup for one first guess file for now -! do i=0,9 !place holder for FGAT - i=3 + do i=0,9 !place holder for FGAT + if (i.eq.6) then + write(filenames,"(A11)") 'fv3_dynvars' + else + write(filenames,"(A12,I2.2)") 'fv3_dynvars_',i + endif + INQUIRE(FILE=filenames, EXIST=fexist) + if(.not.fexist) cycle !wwww read in from the external file directly, no internal files sigfxx for FV3 - idate5(1)= regional_time(1) - idate5(2)= regional_time(2) - idate5(3)= regional_time(3) - idate5(4)= regional_time(4) + datecc=regional_time(1)/100 + datein(1)=char(regional_time(1)-datecc*100) + datein(2)=char(regional_time(2)) + datein(3)=char(regional_time(3)) + datein(4)=char(regional_time(4)) + call w3fs15(datein,(i-6),dateout) + idate5(1)=ichar(dateout(1))+datecc*100 + idate5(2)=ichar(dateout(2)) + idate5(3)=ichar(dateout(3)) + idate5(4)=ichar(dateout(4)) idate5(5)= regional_time(5) isecond = regional_time(6) hourg = zero ! forcast hour @@ -546,20 +561,20 @@ subroutine read_fv3_files(mype) if (l4dvar.or.l4densvar) then if (t4dvwinlen) then write(6,*)'ges file not in time range, t4dv=',t4dv -! cycle ! place holder for FGAT + cycle ! place holder for FGAT endif else ndiff=nming2-nminanl !for test with the 3 hr files with FGAT if(abs(ndiff) > 60*nhr_half ) then write(6,*)'ges file not in time range, ndiff=',ndiff -! cycle ! place holder for FGAT + cycle ! place holder for FGAT endif endif iwan=iwan+1 time_ges(iwan,1) =real((nming2-iwinbgn),r_kind)*r60inv time_ges(iwan+100,1)=i+r0_001 -! end do ! i !place holder for FGAT + end do ! i !place holder for FGAT time_ges(201,1)=one time_ges(202,1)=one if(iwan > 1)then @@ -714,7 +729,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) use gsi_bundlemod, only: gsi_bundlecreate,gsi_bundledestroy use general_sub2grid_mod, only: general_sub2grid_create_info use mpeu_util, only: die - use guess_grids, only: ntguessig + use guess_grids, only: nfldsig,ntguessig use directDA_radaruse_mod, only: l_use_cvpqx, cvpqx_pval use directDA_radaruse_mod, only: l_use_dbz_directDA use directDA_radaruse_mod, only: l_cvpnr, cvpnr_pval @@ -726,10 +741,11 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) implicit none - type (type_fv3regfilenameg),intent (in) :: fv3filenamegin + type (type_fv3regfilenameg),intent (in) :: fv3filenamegin(:) + integer(i_kind) :: it character(len=24),parameter :: myname = 'read_fv3_netcdf_guess' integer(i_kind) k,i,j - integer(i_kind) it,ier,istatus + integer(i_kind) ier,istatus real(r_kind),dimension(:,:),pointer::ges_ps=>NULL() real(r_kind),dimension(:,:),pointer::ges_ps_readin=>NULL() real(r_kind),dimension(:,:),pointer::ges_z=>NULL() @@ -759,9 +775,14 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) integer(r_kind):: iuv,ndynvario3d,ntracerio3d !clt this block is still maintained for they would be needed for a certain 2d fields IO + it=ntguessig mype_2d=mod(1,npe) - allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) - allocate(displss(npe),displss2d(npe),displsz_g(npe) ) + if (.not.allocated(ijns)) allocate(ijns(npe)) + if (.not.allocated(ijns2d)) allocate(ijns2d(npe)) + if (.not.allocated(ijnz)) allocate(ijnz(npe)) + if (.not.allocated(displss)) allocate(displss(npe)) + if (.not.allocated(displss2d)) allocate(displss2d(npe)) + if (.not.allocated(displsz_g)) allocate(displsz_g(npe)) do i=1,npe ijns(i)=ijn_s(i)*nsig @@ -777,14 +798,12 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) displss2d(i)=displss2d(i-1)+ ijns2d(i-1) enddo - - - - it=ntguessig - - - allocate( name_metvars2d(GSI_MetGuess_Bundle(it)%n2d)) - allocate( name_metvars3d(GSI_MetGuess_Bundle(it)%n3d)) + if (.not.allocated(name_metvars2d)) then + allocate( name_metvars2d(GSI_MetGuess_Bundle(it)%n2d)) + end if + if (.not.allocated(name_metvars3d)) then + allocate( name_metvars3d(GSI_MetGuess_Bundle(it)%n3d)) + end if call gsi_bundleinquire (GSI_MetGuess_Bundle(it),'shortnames::2d', name_metvars2d,istatus) call gsi_bundleinquire (GSI_MetGuess_Bundle(it),'shortnames::3d', name_metvars3d,istatus) if(mype == 0) then @@ -893,7 +912,9 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) if (ndynvario2d > 0) then allocate(fv3lam_io_dynmetvars2d_nouv(ndynvario2d)) endif - if (ntracerio2d > 0) allocate(fv3lam_io_tracermetvars2d_nouv(ntracerio2d)) + if (ntracerio2d > 0) then + allocate(fv3lam_io_tracermetvars2d_nouv(ntracerio2d)) + end if jdynvar=0 jtracer=0 do i=1,size(name_metvars2d) @@ -998,93 +1019,99 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) - ier=0 - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'ps' ,ges_ps ,istatus );ier=ier+istatus - - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'z' , ges_z ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'u' , ges_u ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'v' , ges_v ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'tv' ,ges_tv ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'q' ,ges_q ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'oz' ,ges_oz ,istatus );ier=ier+istatus - if (l_use_dbz_directDA) then - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'ql' ,ges_ql ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qi' ,ges_qi ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qr' ,ges_qr ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'iqr' ,ges_iqr ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qs' ,ges_qs ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qg' ,ges_qg ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qnr',ges_qnr ,istatus );ier=ier+istatus - call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'w' , ges_w ,istatus );ier=ier+istatus - end if - - if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) - if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_readuv(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin) - else - call gsi_fv3ncdf_readuv_v1(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin) - endif - if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_read(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin) - call gsi_fv3ncdf_read(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin) - else - call gsi_fv3ncdf_read_v1(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv,fv3filenamegin%dynvars,fv3filenamegin) - call gsi_fv3ncdf_read_v1(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv,fv3filenamegin%tracers,fv3filenamegin) - endif - - if( fv3sar_bg_opt == 0) then - call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'delp' ,ges_delp ,istatus );ier=ier+istatus - if(istatus==0) ges_delp=ges_delp*0.001_r_kind - endif - call gsi_copy_bundle(gsibundle_fv3lam_dynvar_nouv,GSI_MetGuess_Bundle(it)) - call gsi_copy_bundle(gsibundle_fv3lam_tracer_nouv,GSI_MetGuess_Bundle(it)) - call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'tsen' ,ges_tsen_readin ,istatus );ier=ier+istatus - !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - do k=1,nsig - do j=1,lon2 - do i=1,lat2 - ges_tv(i,j,k)=ges_tsen_readin(i,j,k)*(one+fv*ges_q(i,j,k)) + do it=1,nfldsig + ier=0 + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'ps' ,ges_ps ,istatus );ier=ier+istatus + + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'z' , ges_z ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'u' , ges_u ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'v' , ges_v ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'tv' ,ges_tv ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'q' ,ges_q ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'oz' ,ges_oz ,istatus );ier=ier+istatus + if (l_use_dbz_directDA) then + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'ql' ,ges_ql ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qi' ,ges_qi ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qr' ,ges_qr ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'iqr' ,ges_iqr ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qs' ,ges_qs ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qg' ,ges_qg ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'qnr',ges_qnr ,istatus );ier=ier+istatus + call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'w' , ges_w ,istatus );ier=ier+istatus + end if + + if (ier/=0) call die(trim(myname),'cannot get pointers for fv3 met-fields, ier =',ier) + if( fv3sar_bg_opt == 0) then + call gsi_fv3ncdf_readuv(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin(it)) + else + call gsi_fv3ncdf_readuv_v1(grd_fv3lam_uv,ges_u,ges_v,fv3filenamegin(it)) + endif + if( fv3sar_bg_opt == 0) then + call gsi_fv3ncdf_read(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv & + & ,fv3filenamegin(it)%dynvars,fv3filenamegin(it)) + call gsi_fv3ncdf_read(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv & + & ,fv3filenamegin(it)%tracers,fv3filenamegin(it)) + else + call gsi_fv3ncdf_read_v1(grd_fv3lam_dynvar_ionouv,gsibundle_fv3lam_dynvar_nouv & + & ,fv3filenamegin(it)%dynvars,fv3filenamegin(it)) + call gsi_fv3ncdf_read_v1(grd_fv3lam_tracer_ionouv,gsibundle_fv3lam_tracer_nouv & + & ,fv3filenamegin(it)%tracers,fv3filenamegin(it)) + endif + + if( fv3sar_bg_opt == 0) then + call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'delp' ,ges_delp ,istatus );ier=ier+istatus + if(istatus==0) ges_delp=ges_delp*0.001_r_kind + endif + call gsi_copy_bundle(gsibundle_fv3lam_dynvar_nouv,GSI_MetGuess_Bundle(it)) + call gsi_copy_bundle(gsibundle_fv3lam_tracer_nouv,GSI_MetGuess_Bundle(it)) + call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'tsen' ,ges_tsen_readin ,istatus );ier=ier+istatus + !! tsen2tv !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + do k=1,nsig + do j=1,lon2 + do i=1,lat2 + ges_tv(i,j,k)=ges_tsen_readin(i,j,k)*(one+fv*ges_q(i,j,k)) + enddo enddo enddo - enddo - if( fv3sar_bg_opt == 0) then - allocate(ges_delp_bg(lat2,lon2,nsig)) - allocate(ges_ps_bg(lat2,lon2)) - ges_delp_bg=ges_delp - ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) - do i=nsig,1,-1 - ges_prsi(:,:,i,it)=ges_delp(:,:,i)+ges_prsi(:,:,i+1,it) - enddo - ges_ps(:,:)=ges_prsi(:,:,1,it) - ges_ps_bg=ges_ps - else - call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'ps' ,ges_ps_readin ,istatus );ier=ier+istatus - ges_ps_readin=ges_ps_readin*0.001_r_kind !which is from - ges_ps=ges_ps_readin - ges_ps_bg=ges_ps - ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) - do k=1,nsig - ges_prsi(:,:,k,it)=eta1_ll(k)+eta2_ll(k)*ges_ps - enddo - - - - endif - - call gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) - - if (l_use_dbz_directDA ) then - if( fv3sar_bg_opt == 0) then - ges_iqr=ges_qr - else - write(6,*) "FV3 IO READ for 'fv3sar_bg_opt == 0' is only available for now in direct reflectivity DA" - stop - end if - - call convert_qx_to_cvpqx(ges_qr, ges_qs, ges_qg, l_use_cvpqx, cvpqx_pval) ! convert Qx - call convert_nx_to_cvpnx(ges_qnr, l_cvpnr, cvpnr_pval) ! convert Qnx - - end if + if( fv3sar_bg_opt == 0) then + if (.not.allocated(ges_delp_bg))allocate(ges_delp_bg(lat2,lon2,nsig)) + if (.not.allocated(ges_ps_bg))allocate(ges_ps_bg(lat2,lon2)) + ges_delp_bg=ges_delp + ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) + do i=nsig,1,-1 + ges_prsi(:,:,i,it)=ges_delp(:,:,i)+ges_prsi(:,:,i+1,it) + enddo + ges_ps(:,:)=ges_prsi(:,:,1,it) + ges_ps_bg=ges_ps + else + call GSI_BundleGetPointer ( gsibundle_fv3lam_dynvar_nouv, 'ps' ,ges_ps_readin ,istatus );ier=ier+istatus + ges_ps_readin=ges_ps_readin*0.001_r_kind !which is from + ges_ps=ges_ps_readin + ges_ps_bg=ges_ps + ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) + do k=1,nsig + ges_prsi(:,:,k,it)=eta1_ll(k)+eta2_ll(k)*ges_ps + enddo + + + + endif + + call gsi_fv3ncdf2d_read(fv3filenamegin(it),it,ges_z) + + if (l_use_dbz_directDA ) then + if( fv3sar_bg_opt == 0) then + ges_iqr=ges_qr + else + write(6,*) "FV3 IO READ for 'fv3sar_bg_opt == 0' is only available for now in direct reflectivity DA" + stop + end if + + call convert_qx_to_cvpqx(ges_qr, ges_qs, ges_qg, l_use_cvpqx, cvpqx_pval) ! convert Qx + call convert_nx_to_cvpnx(ges_qnr, l_cvpnr, cvpnr_pval) ! convert Qnx + + end if + end do end subroutine read_fv3_netcdf_guess diff --git a/src/gsi/read_guess.F90 b/src/gsi/read_guess.F90 index ecd85aa983..9fcea533ab 100644 --- a/src/gsi/read_guess.F90 +++ b/src/gsi/read_guess.F90 @@ -75,6 +75,7 @@ subroutine read_guess(iyear,month,idd,mype) ! 2017-10-10 Wu W - add code for FV3 netcdf guess input ! 2019-09-18 martin - added new fields to save guess tsen, q, geop_hgt for writing increment ! 2019-09-23 martin - add code for FV3 GFS netcdf guess input +! 2020-11-19 Lu & Wang - modify file read for fgat, POC: xuguang.wang@ou.edu ! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! input argument list: @@ -91,7 +92,7 @@ subroutine read_guess(iyear,month,idd,mype) use kinds, only: r_kind,i_kind use jfunc, only: bcoption,clip_supersaturation,superfact use guess_grids, only: nfldsig,ges_tsen,load_prsges,load_geop_hgt,ges_prsl,& - ges_tsen1, geop_hgti, ges_geopi, ges_q1 + ges_tsen1,geop_hgti,ges_geopi,ges_q1 use m_gsiBiases,only : bkg_bias_correction,nbc use m_gsiBiases, only: gsi_bkgbias_bundle use gsi_bias, only: read_bias @@ -169,8 +170,11 @@ subroutine read_guess(iyear,month,idd,mype) else if (nems_nmmb_regional) then call nmm_binary_guess%read_nems_nmmb_guess(mype) else if (fv3_regional ) then - call bg_fv3regfilenameg%init - call read_fv3_netcdf_guess(bg_fv3regfilenameg) + allocate(bg_fv3regfilenameg(nfldsig)) + do it=1,nfldsig + call bg_fv3regfilenameg(it)%init(it) + end do + call read_fv3_netcdf_guess(bg_fv3regfilenameg) else if (cmaq_regional) then call read_cmaq_guess(mype) end if diff --git a/src/gsi/setuprw.f90 b/src/gsi/setuprw.f90 index c6155627a9..c32ea80ab7 100644 --- a/src/gsi/setuprw.f90 +++ b/src/gsi/setuprw.f90 @@ -1317,7 +1317,7 @@ subroutine contents_netcdf_diag_(odiag) real(r_kind),dimension(miter) :: obsdiag_iuse call nc_diag_metadata("Station_ID", station_id ) call nc_diag_metadata("Observation_Class", obsclass ) - call nc_diag_metadata("Observation_Type", data(iobs_type,i) ) + call nc_diag_metadata("Observation_Type", ictype(ikx) ) call nc_diag_metadata("Observation_Subtype", icsubtype(ikx) ) call nc_diag_metadata("Latitude", sngl(data(ilate,i)) ) call nc_diag_metadata("Longitude", sngl(data(ilone,i)) ) diff --git a/src/gsi/setupw.f90 b/src/gsi/setupw.f90 index 33f0a62957..3d5654a22b 100644 --- a/src/gsi/setupw.f90 +++ b/src/gsi/setupw.f90 @@ -1697,7 +1697,6 @@ subroutine contents_binary_diag_(udiag,vdiag) if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information - uob_reg=data(iuob,i) vob_reg=data(ivob,i) dlon_e=data(ilone,i)*deg2rad diff --git a/src/gsi/write_all.F90 b/src/gsi/write_all.F90 index 89483251d7..6bc3b70b05 100644 --- a/src/gsi/write_all.F90 +++ b/src/gsi/write_all.F90 @@ -42,7 +42,7 @@ subroutine write_all(increment) use mpeu_util, only: die use control_vectors, only: control_vector - + implicit none ! !INPUT PARAMETERS: @@ -96,6 +96,7 @@ subroutine write_all(increment) ! 2013-10-19 todling - metguess holds ges fields now ! 2014-10-05 todling - background biases now held in bundle ! 2017-10-10 Wu W - add FV3 option for regional output +! 2020-11-19 Lu & Wang - modify output filename option for fgat. POC: xuguang.wang@ou.edu ! ! !REMARKS: ! @@ -120,7 +121,7 @@ subroutine write_all(increment) ! Regional output if (regional) then if (fv3_regional) then - call wrfv3_netcdf(bg_fv3regfilenameg) + call wrfv3_netcdf(bg_fv3regfilenameg(ntguessig)) else call io%write_regional_analysis(mype) endif From f16e852643570f7d030dd467e83ec5ba7849260e Mon Sep 17 00:00:00 2001 From: "edward.safford" Date: Fri, 29 Apr 2022 14:39:22 +0000 Subject: [PATCH 089/155] Github issue #310. Correct mean correction time series plots. Fixes #310. --- .../image_gen/html/Install_html.sh | 37 ++-- .../image_gen/html/comp.html.glb | 90 --------- .../image_gen/html/comp.html.rgn | 90 --------- .../image_gen/html/install_glb.sh | 189 ++++++++---------- .../image_gen/html/install_rgn.sh | 88 ++------ .../image_gen/html/menu.html.glb | 53 ----- .../image_gen/html/menu.html.rgn | 53 ----- .../image_gen/html/mk_intro.sh | 51 +---- .../image_gen/html/sum_thumbs.tar | Bin 0 -> 204800 bytes .../src/radmon_ig_angle.fd/angle.f90 | 36 +--- util/Radiance_Monitor/parm/RadMon_config | 10 +- .../parm/RadMon_user_settings | 2 +- 12 files changed, 142 insertions(+), 557 deletions(-) delete mode 100755 util/Radiance_Monitor/image_gen/html/comp.html.glb delete mode 100644 util/Radiance_Monitor/image_gen/html/comp.html.rgn delete mode 100755 util/Radiance_Monitor/image_gen/html/menu.html.glb delete mode 100644 util/Radiance_Monitor/image_gen/html/menu.html.rgn create mode 100644 util/Radiance_Monitor/image_gen/html/sum_thumbs.tar diff --git a/util/Radiance_Monitor/image_gen/html/Install_html.sh b/util/Radiance_Monitor/image_gen/html/Install_html.sh index 8ecb71d1da..0d968be994 100755 --- a/util/Radiance_Monitor/image_gen/html/Install_html.sh +++ b/util/Radiance_Monitor/image_gen/html/Install_html.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -ax #-------------------------------------------------------------------- #-------------------------------------------------------------------- @@ -27,7 +26,7 @@ if [[ $nargs -ne 2 ]]; then exit 2 fi -RADMON_SUFFIX=$1 +export RADMON_SUFFIX=$1 echo RADMON_SUFFIX = $RADMON_SUFFIX export RAD_AREA=$2 @@ -36,28 +35,38 @@ this_dir=`dirname $0` top_parm=${this_dir}/../../parm -if [[ -s ${top_parm}/RadMon_config ]]; then - . ${top_parm}/RadMon_config -else - echo "ERROR: Unable to source ${top_parm}/RadMon_config" - exit +radmon_config=${radmon_config:-${top_parm}/RadMon_config} +if [[ ! -e ${radmon_config} ]]; then + echo "Unable to source ${radmon_config}" + exit 2 fi -if [[ -s ${top_parm}/RadMon_user_settings ]]; then - . ${top_parm}/RadMon_user_settings -else - echo "ERROR: Unable to source ${top_parm}/RadMon_user_settings" - exit +. ${radmon_config} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${radmon_config} file" + exit $? fi +radmon_user_settings=${radmon_user_settings:-${top_parm}/RadMon_user_settings} +if [[ ! -e ${radmon_user_settings} ]]; then + echo "Unable to locate ${radmon_user_settings} file" + exit 4 +fi + +. ${radmon_user_settings} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${radmon_user_settings} file" + exit $? +fi + #-------------------------------------------------------------- # call the appropriate child script for glb or rgn # if [[ $RAD_AREA == "glb" ]]; then - ${RADMON_IMAGE_GEN}/html/install_glb.sh $RADMON_SUFFIX + ${RADMON_IMAGE_GEN}/html/install_glb.sh else - ${RADMON_IMAGE_GEN}/html/install_rgn.sh $RADMON_SUFFIX + ${RADMON_IMAGE_GEN}/html/install_rgn.sh fi diff --git a/util/Radiance_Monitor/image_gen/html/comp.html.glb b/util/Radiance_Monitor/image_gen/html/comp.html.glb deleted file mode 100755 index e1f9d07680..0000000000 --- a/util/Radiance_Monitor/image_gen/html/comp.html.glb +++ /dev/null @@ -1,90 +0,0 @@ - - - - - Radiance Monitoring - - - - - - - - -

Comparison plots

- -
- - - - - -
Select Platform:
-

-

Click button to...
-
-
- - -
- - - - - diff --git a/util/Radiance_Monitor/image_gen/html/comp.html.rgn b/util/Radiance_Monitor/image_gen/html/comp.html.rgn deleted file mode 100644 index e1f9d07680..0000000000 --- a/util/Radiance_Monitor/image_gen/html/comp.html.rgn +++ /dev/null @@ -1,90 +0,0 @@ - - - - - Radiance Monitoring - - - - - - - - -

Comparison plots

- -
- - - - - -
Select Platform:
-

-

Click button to...
-
-
- - -
- - - - - diff --git a/util/Radiance_Monitor/image_gen/html/install_glb.sh b/util/Radiance_Monitor/image_gen/html/install_glb.sh index 4c70951df9..5a54b5ff97 100755 --- a/util/Radiance_Monitor/image_gen/html/install_glb.sh +++ b/util/Radiance_Monitor/image_gen/html/install_glb.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -ax +#!/bin/bash #-------------------------------------------------------------------- #-------------------------------------------------------------------- @@ -11,40 +10,57 @@ set -ax #-------------------------------------------------------------------- #-------------------------------------------------------------------- -function usage { - echo "Usage: install_glb.sh suffix" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." -} - echo "BEGIN install_glb.sh" echo "" +echo "" + +do_cmp=0 +cmp_src="" + +#-------------------------------------------------------------- +# Allow user to enable comparison plots +# +echo "Do you wish to enable data plots to include comparison to" +echo " operational GDAS data, or another data source?" +echo "" +echo -n " Enter YES to enable comparison plots, any other input to disable. > " +read text +short=`echo $text | cut -c1` + +if [[ $short = "Y" || $short = "y" ]]; then + do_cmp=1 + cmp_src="GDAS" + + echo "Please specify the suffix of your comparison data source," + echo " or just hit the return key to use the operational GDAS as " + echo " the comparison source" + echo "" + echo -n " > " + read text + + if [[ ${#text} -gt 0 ]]; then + cmp_src=${text} + fi -nargs=$# -if [[ $nargs -lt 0 ]]; then - usage - exit 2 + echo "${cmp_src} will be used as the comparison source." fi -SUFFIX=$1 -echo SUFFIX = $SUFFIX + +SUFFIX=$RADMON_SUFFIX RAD_AREA="glb" this_file=`basename $0` this_dir=`dirname $0` - - new_webdir=${WEBDIR}/${SUFFIX} -echo RAD_AREA = $RAD_AREA -echo TANKverf = $TANKverf - #-------------------------------------------------------------- # Create a temporary working directory. # workdir=$STMP_USER/${SUFFIX}_html -rmdir $workdir +if [[ -e $workdir ]]; then + rm -rf $workdir +fi mkdir $workdir cd $workdir @@ -56,13 +72,10 @@ cd $workdir #----------------------------------------------------------- # Find the first date with data. Start at today and work -# backwards. Stop after 90 days and exit. +# backwards. If not found stop after 90 days and exit. # PDATE=`${IG_SCRIPTS}/nu_find_cycle.pl --dir ${TANKverf} --cyc 1` -echo PDATE= $PDATE - limit=`$NDATE -2160 $PDATE` # 90 days -echo limit, PDATE = $limit, $PDATE #----------------------------------------------------------- # Build test_list which will contain all data files for @@ -81,14 +94,22 @@ while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do test_dir=${TANKverf}/${RUN}.${PDY} fi - echo "test_dir = ${test_dir}" - if [[ -d ${test_dir} ]]; then echo " test_dir is GO " - if [[ -e ${test_dir}/angle.tar ]]; then - test_list=`tar -tv ${test_dir}/angle.tar` + if [[ -e ${test_dir}/radmon_angle.tar || -e ${test_dir}/radmon_angle.tar.gz ]]; then + gzipped=0 + if [[ -e ${test_dir}/radmon_angle.tar.gz ]]; then + gunzip ${test_dir}/radmon_angle.tar.gz + gzipped=1 + fi + + test_list=`tar -tf ${test_dir}/radmon_angle.tar` data_found=1 + + if [[ $gzipped -eq 1 ]]; then + gzip ${test_dir}/radmon_angle.tar + fi else test=`ls ${test_dir}/angle.*${PDATE}*.ieee_d* | wc -l` if [[ $test -gt 0 ]]; then @@ -102,10 +123,10 @@ while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do if [[ data_found -eq 0 ]]; then PDATE=`$NDATE -24 $PDATE` - echo PDATE = $PDATE fi done + if [[ $data_found -eq 0 ]]; then echo Unable to locate any data files in the past 90 days for $SUFFIX echo in $TANKverf/angle. @@ -115,25 +136,24 @@ fi #----------------------------------------------------------- # Go through test_list and identify all unique # sat_instrument combinations. The results are the -# SATYPE list for this source. +# SATYPE list for this source. Avoid _anl and ctl files +# since they will give us duplicate satypes. # - for test in ${test_list}; do this_file=`basename $test` + + test_anl=`echo $this_file | grep "_anl"` + test_ctl=`echo $this_file | grep "ctl"` + if [[ $test_anl != "" || $test_ctl != "" ]]; then + continue + fi + tmp=`echo "$this_file" | cut -d. -f1` if [[ $tmp == "angle" ]]; then tmp=`echo "$this_file" | cut -d. -f2` fi - - #---------------------------------------------------------- - # remove sat/instrument_anl names so we don't end up - # with both "airs_aqua" and "airs_aqua_anl" if analysis - # files are being generated for this source. - #---------------------------------------------------------- - test_anl=`echo $tmp | grep "_anl"` - if [[ $test_anl = "" ]]; then - SATYPE_LIST="$SATYPE_LIST $tmp" - fi + + SATYPE_LIST="$SATYPE_LIST $tmp" done export SATYPE=$SATYPE_LIST @@ -143,7 +163,6 @@ if [[ ${#SATYPE} -le 0 ]]; then exit fi -echo $SATYPE #-------------------------------------------------------------- # Use the SATYPE list to construct the platform table. @@ -171,6 +190,7 @@ for satype in $SATYPE; do sat="GOES-${sat_num}" elif [[ $char == "n" ]]; then sat="NOAA-${sat_num}" + else sat=`echo $sat | tr 'a-z' 'A-Z'` fi @@ -178,9 +198,8 @@ for satype in $SATYPE; do sat=`echo $sat | tr 'a-z' 'A-Z'` fi - #----------------------------------------------------------------- - # + # Certain instruments require specific formatting. # amsu_test=`expr match ${ins} "amsu"` hirs_test=`expr match ${ins} "hirs"` @@ -203,7 +222,7 @@ done #-------------------------------------------------------------- # Sort the list by Satellite # -`sort -d $UNSORTED_LIST > $SORTED_LIST` +`sort -d -u $UNSORTED_LIST > $SORTED_LIST` #-------------------------------------------------------------- # Read the sorted list and create the platform table @@ -234,7 +253,6 @@ done < "$SORTED_LIST" imgndir=`dirname ${IMGNDIR}` - #-------------------------------------------------------------- # Edit the html files to add the platform table to each. # @@ -261,39 +279,16 @@ for html_file in $mod_html_files; do # switch all 'INSERT_SUFFIX' tags to the actual suffix # and route output to $html_file and we're done. sed s/INSERT_SUFFIX/${SUFFIX}/g ${tmp_html} > ${html_file} + rm ${tmp_html} done #-------------------------------------------------------------- -# Optionally enable comparison plots to the operational -# GDAS data +# Enable comparison plots # -set +ax -comp_html_files="plot_summary.html plot_time.html" - -echo "Do you wish to enable data plots to include comparison to" -echo " operational GDAS data, or another data source?" -echo "" -echo -n " Enter YES to enable comparison plots, any other input to disable. > " -read text -short=`echo $text | cut -c1` +if [[ $do_cmp == 1 ]]; then -if [[ $short = "Y" || $short = "y" ]]; then - - cmp_src="GDAS" - - echo "Please specify the suffix of your comparison data source," - echo " or just hit the return key to use the operational GDAS as " - echo " the comparison source" - echo "" - echo -n " > " - read text - - if [[ ${#text} -gt 0 ]]; then - cmp_src=${text} - fi - - echo "Enabling ${cmp_src} as the comparison source." + comp_html_files="plot_summary.html plot_time.html" #------------------------------------------------------------------------- # If cmp_src == GDAS we only have to uncomment the comparison check box @@ -327,8 +322,6 @@ if [[ $short = "Y" || $short = "y" ]]; then done fi -set -ax - #-------------------------------------------------------------- # Generate the intro.html file. # @@ -336,21 +329,7 @@ $NCP ${RADMON_IMAGE_GEN}/html/mk_intro.sh . $NCP ${RADMON_IMAGE_GEN}/html/intro.html intro.html.stock ./mk_intro.sh - - -#-------------------------------------------------------------- -# Copy the menu.html file and change "Experimental" to -# "Operational" if the suffix is wopr or nrx (operational GDAS -# or NDAS. -# -$NCP ${RADMON_IMAGE_GEN}/html/menu.html.$RAD_AREA . - -if [[ $SUFFIX == "wopr" || $SUFFIX == "nrx" ]]; then - tmp_menu=./tmp_menu.html.${RAD_AREA} - sed s/Experimental/Operational/1 menu.html.${RAD_AREA} > ${tmp_menu} - mv -f ${tmp_menu} menu.html.${RAD_AREA} -fi - +rm mk_intro.sh #-------------------------------------------------------------- # Copy the index.html file and change INSERT_SUFFIX to actual suffix. @@ -360,7 +339,7 @@ new_index="index.html" $NCP ${RADMON_IMAGE_GEN}/html/${index_file} . sed s/INSERT_SUFFIX/${SUFFIX}/g $index_file > ${tmp_index} -if [[ $SUFFIX == "wopr" || $SUFFIX == "nrx" ]]; then +if [[ $SUFFIX == "GFS" || $SUFFIX == "nrx" ]]; then sed s/Experimental/Operational/1 ${tmp_index} > ${new_index} fi @@ -372,16 +351,13 @@ if [[ ! -s ${new_index} ]]; then fi fi -support_files="jsuri-1.1.1.js stats.js latest_cycle.php" +rm ./${index_file} #-------------------------------------------------------------- # Make starting directory in $imgndir and copy over html, # misc, and thumb images. # -subdirs="angle bcoef bcor comp horiz summary time" -subdirs="summary" - if [[ ! -d ${IMGNDIR} ]]; then mkdir -p ${IMGNDIR} fi @@ -390,7 +366,7 @@ imgndir=`dirname ${IMGNDIR}` #----------------------- # move html files to imgndir # -all_html_files="${mod_html_files} index.html menu.html intro.html" +all_html_files="${mod_html_files} index.html intro.html" for file in $all_html_files; do $NCP ${file} ${imgndir}/${file} done @@ -398,6 +374,7 @@ done #----------------------- # mk image dirs # +subdirs="angle bcoef summary time" for dir in $subdirs; do mkdir -p ${imgndir}/pngs/${dir} done @@ -405,6 +382,7 @@ done #----------------------- # js files # +support_files="jsuri-1.1.1.js stats.js latest_cycle.php" for file in $support_files; do $NCP ${RADMON_IMAGE_GEN}/html/${file} ${imgndir}/. done @@ -419,7 +397,7 @@ done #----------------------- # summary thumb images -# If any are missing dummy one in using a copy of sndrdr1_g15. +# If any are missing dummy one in using ssmis_f18. # thumbs="sum_thumbs.tar" $NCP ${RADMON_IMAGE_GEN}/html/${thumbs} ${imgndir}/pngs/summary/. @@ -429,7 +407,7 @@ rm -f ${thumbs} for satype in $SATYPE; do if [[ ! -e ${satype}.summary.png ]]; then - $NCP sndrd1_g15.summary.png ${satype}.summary.png + $NCP ssmis_f18.summary.png ${satype}.summary.png fi done @@ -447,19 +425,24 @@ done #--------------------------------------------------- # if on wcoss then cd $imgndir and do the rsync here # -if [[ $MY_MACHINE = "wcoss" ]]; then +if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss2" ]]; then + if [[ ${imgndir} != "/" ]]; then # sanity check to avoid serious embarrassment /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} ${imgndir}/ \ - ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEBDIR}/ + ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEBDIR}/${SUFFIX}/ fi + + ssh ${WEB_USER}@${WEB_SVR} mkdir ${WEBDIR}/${SUFFIX}/gdas + ssh ${WEB_USER}@${WEB_SVR} ln -s ${WEBDIR}/${SUFFIX}/pngs ${WEBDIR}/${SUFFIX}/gdas/pngs + fi #------------------------ # clean up $workdir # -#cd $workdir -#cd ../ -#rm -rf $workdir +cd $workdir +cd ../ +rm -rf $workdir echo "" echo "END install_glb.sh" diff --git a/util/Radiance_Monitor/image_gen/html/install_rgn.sh b/util/Radiance_Monitor/image_gen/html/install_rgn.sh index 6ceb1a4caf..4a1a1666e6 100755 --- a/util/Radiance_Monitor/image_gen/html/install_rgn.sh +++ b/util/Radiance_Monitor/image_gen/html/install_rgn.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -ax #-------------------------------------------------------------------- #-------------------------------------------------------------------- @@ -10,60 +9,23 @@ set -ax # the server (rgn only, regional is handled by Install_html.sh). #-------------------------------------------------------------------- #-------------------------------------------------------------------- - -function usage { - echo "Usage: install_rgn.sh suffix" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." -} - echo "BEGIN install_rgn.sh" echo "" -nargs=$# -if [[ $nargs -lt 0 ]]; then - usage - exit 2 -fi - -SUFFIX=$1 -echo SUFFIX = $SUFFIX +SUFFIX=$RADMON_SUFFIX RAD_AREA="rgn" this_file=`basename $0` this_dir=`dirname $0` -top_parm=${this_dir}/../../parm - -if [[ -s ${top_parm}/RadMon_config ]]; then - . ${top_parm}/RadMon_config -else - echo "ERROR: Unable to source ${top_parm}/RadMon_config" - exit -fi - -if [[ -s ${top_parm}/RadMon_user_settings ]]; then - . ${top_parm}/RadMon_user_settings -else - echo "ERROR: Unable to source ${top_parm}/RadMon_user_settings" - exit -fi - - -#-------------------------------------------------------------- -# Get the area for this SUFFIX from the data_map file -# -new_webdir=${WEBDIR}/${SUFFIX} - -echo RAD_AREA = $RAD_AREA -echo TANKverf = $TANKverf - #-------------------------------------------------------------- # Create a temporary working directory. # workdir=$STMP_USER/${SUFFIX}_html -rmdir $workdir +if [[ -d ${workdir} ]]; then + rm -rf $workdir +fi mkdir $workdir cd $workdir @@ -75,13 +37,10 @@ cd $workdir #----------------------------------------------------------- # Find the first date with data. Start at today and work -# backwards. Stop after 90 days and exit. +# backwards. If not found, stop after 90 days and exit. # -PDATE=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKverf}` -echo PDATE= $PDATE - +PDATE=`${IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKverf}` limit=`$NDATE -2160 $PDATE` # 90 days -echo limit, PDATE = $limit, $PDATE #----------------------------------------------------------- # Build test_list which will contain all data files for @@ -106,8 +65,6 @@ while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do test_dir=${TANKverf}/${MONITOR}.${PDY} fi - echo "test_dir = ${test_dir}" - if [[ -d ${test_dir} ]]; then echo " test_dir is GO " @@ -134,7 +91,6 @@ while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do if [[ data_found -eq 0 ]]; then PDATE=`$NDATE -24 $PDATE` - echo PDATE = $PDATE fi done @@ -183,8 +139,6 @@ if [[ ${#SATYPE} -le 0 ]]; then exit fi -echo "SATYPE = $SATYPE" - #-------------------------------------------------------------- # Use the SATYPE list to construct the platform table. # @@ -245,9 +199,6 @@ done # `sort -d $UNSORTED_LIST > $SORTED_LIST` -echo -echo -cat $SORTED_LIST #-------------------------------------------------------------- # Read the sorted list and create the platform table @@ -285,7 +236,6 @@ imgndir=`dirname ${IMGNDIR}` mod_html_files="plot_summary.html.rgn plot_time.html.rgn plot_angle.html.rgn plot_bcoef.html.rgn" for html_file in $mod_html_files; do - echo "processing ${html_file}" $NCP ${RADMON_IMAGE_GEN}/html/${html_file} . tmp_html=./tmp_${html_file} @@ -304,7 +254,6 @@ for html_file in $mod_html_files; do # rm the .rgn extension on the html file names new_html_file=`echo $html_file | cut -d'.' -f-2` - echo "new_html_file = $new_html_file" # switch all 'INSERT_SUFFIX' tags to the actual suffix # and route output to $new_html_file and we're done. @@ -364,14 +313,6 @@ if [[ $SUFFIX == "wopr" || $SUFFIX == "nrx" ]]; then sed s/Experimental/Operational/1 ${tmp_index} > ${new_index} fi -#if [[ ! -s ${new_index} ]]; then -# if [[ -s ${tmp_index} ]]; then -# $NCP ${tmp_index} ${new_index} -# else -# $NCP ${index_file} ${new_index} -# fi -#fi - if [[ -s ${tmp_index} ]]; then rm ${tmp_index} fi @@ -440,7 +381,6 @@ done img_list=`ls *.png` # rm any images for sources not in $SATYPE for img in ${img_list}; do tmp=`echo "$img" | cut -d. -f1` - echo $tmp img_match=`echo $SATYPE | grep $tmp` if [[ ${#img_match} -le 0 ]]; then rm -f ${img} @@ -448,22 +388,24 @@ for img in ${img_list}; do done -#--------------------------------------------------- -# if on wcoss then cd $imgndir and do the rsync here +#------------------------------------------------------ +# if on wcoss_d then cd $imgndir and do the rsync here # -if [[ $MY_MACHINE = "wcoss" ]]; then +new_webdir=${WEBDIR}/regional/${SUFFIX} + +if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss2" ]]; then if [[ ${imgndir} != "/" ]]; then # sanity check to avoid serious embarrassment /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} ${imgndir}/ \ - ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEBDIR}/ + ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${new_webdir}/ fi fi #------------------------ # clean up $workdir # -#cd $workdir -#cd ../ -#rm -rf $workdir +cd $workdir +cd ../ +rm -rf $workdir echo "" echo "END install_rgn.sh" diff --git a/util/Radiance_Monitor/image_gen/html/menu.html.glb b/util/Radiance_Monitor/image_gen/html/menu.html.glb deleted file mode 100755 index 40a6a6fe45..0000000000 --- a/util/Radiance_Monitor/image_gen/html/menu.html.glb +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Radiance Data Monitoring - - - - - - - -

Experimental GDAS

-

Monitoring Plots

- - - - - - - -
- GDAS home page
- Radiance monitoring home page
- - Time and Angle dependent plots
- Horizontal data plots
- Bias correction coefficients
- Bias correction terms
- Summary plots
- Comparison plots
- -
- - diff --git a/util/Radiance_Monitor/image_gen/html/menu.html.rgn b/util/Radiance_Monitor/image_gen/html/menu.html.rgn deleted file mode 100644 index 95ae4be968..0000000000 --- a/util/Radiance_Monitor/image_gen/html/menu.html.rgn +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Radiance Data Monitoring - - - - - - - -

Experimental NDAS

-

Monitoring Plots

- - - - - - - -
- GDAS home page
- Radiance monitoring home page
- - Time and Angle dependent plots
- Horizontal data plots
- Bias correction coefficients
- Bias correction terms
- Summary plots
- Comparison plots
- -
- - diff --git a/util/Radiance_Monitor/image_gen/html/mk_intro.sh b/util/Radiance_Monitor/image_gen/html/mk_intro.sh index 0e2ae95301..9274395e6c 100755 --- a/util/Radiance_Monitor/image_gen/html/mk_intro.sh +++ b/util/Radiance_Monitor/image_gen/html/mk_intro.sh @@ -111,7 +111,6 @@ while read line; do echo ' ' >> $table # end table row if [[ $ctr != $num_sats ]]; then -# row_end=`expr $row_end + $num_rows` row_end=`expr $row_end + $cols` if [[ $extra < $remainder ]]; then row_end=`expr $row_end + 1` @@ -125,54 +124,20 @@ while read line; do done < "$SORTED_LIST" -#echo ' ' >> $table - -#---------------------------------------------------------------- -# process stock intro.html file and add in the customized table -# -table_start=0 -table_end=0 -table_dump=0 #-------------------------------------------------------------- -# Edit the html files to add the platform table to each. +# Edit infile to add the platform table. # -echo "processing ${infile}" - - # copy the $file from start to tag - sed -e '/
/,$d' ${infile} > ${outfile} - - # add the $PLATFORM_TBL (built above) - `cat $table >> ${outfile}` - # copy the $file from 'END_TABLE_INSERT' comment to end - sed -n '/<\/table>/,$p' ${infile} >> ${outfile} +# copy the $file from start to
tag +sed -e '/
/,$d' ${infile} > ${outfile} +# add the $PLATFORM_TBL (built above) +`cat $table >> ${outfile}` -#while read line; do -# echo $line -# test_start=`echo $line | grep "
"` -# test_end=`echo $line | grep "
"` -## echo "test_start len = ${#test_start} -## echo "test_end len = ${#test_end} -# -# if [[ $table_start -eq 0 && ${#test_start} -gt 0 ]]; then -# table_start=1 -# fi -# -# if [[ ${table_start} -eq 0 || ${table_end} -eq 1 ]]; then -# echo $line >> $outfile -# elif [[ ${table_start} -eq 1 && ${table_dump} -eq 0 ]]; then -# cat $table >> $outfile -# table_dump=1 -# fi -# -# if [[ $table_end -eq 0 && ${#test_end} -gt 0 ]]; then -# table_end=1 -# fi -# -#done < $infile - +# copy the $file from 'END_TABLE_INSERT' comment to end +sed -n '/<\/table>/,$p' ${infile} >> ${outfile} +rm ${infile} echo END mk_intro.sh echo diff --git a/util/Radiance_Monitor/image_gen/html/sum_thumbs.tar b/util/Radiance_Monitor/image_gen/html/sum_thumbs.tar new file mode 100644 index 0000000000000000000000000000000000000000..95d6498ba093c4883755062fe1ff789b0d4270b2 GIT binary patch literal 204800 zcmeFYWl&r}v@SXjk^n<+*Fa#9ATzi_a2Z^J!{Dw1A-KB_GB^Q(1Shx$cL)SY2oAv^ zcp%7~oLlwIId$Lrck8}-Rj;R}yLa1OtGoBwYkjLX%-qh@2Exzj;pyZAbAQk2>TCn} z-yOiHz|YGI0E4-C!Tb2HuJQ%{q&j$v)1pn_Q zU=o~Xs!Hv<5KkpKXhYfhVnD5~O_xw5SOSr66-G2_NgFPTep=cFuzD(&J-P=V7+=Nw#x}VWkop2`0^Y@73Bc zd+{gEs|(msP$YnTT&1-YOP;}gsp%7&41Ds^pH7xw=chqMYSx6cR8-fAK=um;hC=*a zp=N`s(fWpYT^*94)5}Y~yTB*tfc>_WBd-j3g+Ct?In{Mn{~_h}H) zp*l_bPLsg9KN^?>vR~I-k*cK{#8~tp4f^T&4ipwLa6xK(0zk(#0Gwb!ESs1Z2a(ZM z3O{k9eq53nt#>4k=vz-Jv0G}Q6ZgZH0!S`+N?|fkM!@RyFnF-(8|LHcst@o_H#Q0n z+Oo5=M=T3d*~ZQ?Oatt)fjcHqN(WeYjlIRSD=B6+EVB~`^_zIIEcdn{Hwn|n>l(!%?`hz96+vJNr{GVx2 zzs_&gU0*U-;8;MFSi_<=Tbv95;K7$0j{F{zbDr^0^9GZx_~xxf=#pk@!@LX@hbpfr zEMf}DBhUcFse?$#*S~|KB-g%Da0f3Od5I*v0^n>)zJk_|xVLt6cjr%78!x0;Q8;qv zPd!m_s7mENY&-IzYRS-4Vx_QnpBHI7N^TKHgZuo%UxQdv=|qe{iFF8evG#)858sh` z;_sMf0y{n$HU`=n8bz{=U+~J`_V)Hd7Qr1&rJbL1b2`Mb>sHUJFRUOJ{wMfgTNc~V zApPQzMuVp#bn$n5S`sfsAO8N?92@$*9Llx)0j#nRX@!QlZ~UHSJ8q=ud4$oYVg1-$ zwCx*iqQrz?yq+X9DWKE#zBRAc)MvTzU^-TG0NTro(8o%F3<)lZyqMblX z(jL=#jwp_;!C=ExTgcXXym48YzsS71c09-c&vgUjP|kGd1BZysX^q^zW7wU^Cp(gHv zm+g4-P-fxHaK7mruxyKVUncKI@?PSbxmNx?Jp2?xV>&d$tn=%x?k!=*6Pem)5LHIc6B=bwa^{GI?osl?6dROndMFNT&`}dcDu~Q9xi2zbZ=?TeDrlBBKZ6bbx zFUE8$?pru|&vt_;mokhkI=9g+J~A`JLVP|E|EO#xn`Khg4UR-S;-68U-RW3G*CMa; zJa7TRU(XMKv?{a;ek!wj7gA)8Ht^1k+mgSgh@_@3OZh1(^LJBDj%W4`X;W=aMemUVe|tNO`n^?yn0J ziIepMiznFHeLKf&StC~CX_j$8gMG(|iQV^H)1RB@R3ua}0}Y@TqNjuO1wI+)EKj#2 zcjF-w)iv|YP9Cjy6=vvwt2yiBk46;&_gAkO6j>YRCtHJJ&wzd zVG&?Ypb$QhMvUXPy(Qip0N>_ycZ^Rbte*blHjD zlN!HWeVbZ5Tv@JJ{8Si&77O9@tJ@l@TKdJ_Y$;E^15Wd8zIEPi|8zo?M7U3B&BLOs zK=|8-)>JzEYk-8pvjJSe#}E%eN$SvRGaO3_Vp;zC>OFCnfWI7b!aV8L<}ID!yia#} z$Q86$u#uBZn-OHbBU3XIoLME1~5&jurCe@B($qt5n=zl z$ps|Wq3Gh7bpEL_<@2PZD4{2L-G5G9hkmDk@9=s}%!ywxGst858l2nf^I~2~KO|M2 zdM80}zE`jpJna)dFD1fFa+K>LUQ@c4dV*>d(l~uBnEmx$%)q9l^Us5XW+QZy$rX2t zz8QcKCnhxf_;>oU^IZa<7=L(CFd+^y*}CS(`z&e~l8vzz$67Vy#yiOJk>TF*$+iFL z<-H~My33Bc%NLDeH|p#XtV`L|>%%D`^q|$i$4++Tll$-AGd1nomkE>SZx0U-udd`U z(Smez!bfE>-TeKH7d)4mX7_lvN>+QgUIuwQm%L~S&6aRR?QEGP`bLP z7hZmW!Ac%xLoaDbF@?hBZ#j~szTFUs2QBh$mM&KhPCmK$@{8?0pi$}7QvmJmYjc`e zRY^(mpWcQ7YyCG?{1=N&g(E%M9eH)jw%pKF*^K6k@+zZIb3eF?gOh%`mA;9INyLwH zCOzr6&1N5_FU!{N+V9~3t)ltWApw^PoROT|u4WB>(`?{SfeuyXc(f4cHl;>t>bIzUh&QD$T0Idz2XFinK68;qSK z?XO#!*egQu_|N$j%U-6F7Z*N|#KzxvkIwwrf(d7S?hKC^#kVY)QP`1vA6Q~O3<$=5 zGu4#lg8Rj?-qxaQS|I$~dC`l)< zt)FgLhuNhDXXGP)_x37b+$wJY+!<|birh})m0~}m4Nl#`vifDT5;@4%C6KL{ymH2m} z>@bjhN6lkI0!{w4tcLbNqelYm8r3RZR1R7qd57`Gz^BDCHe*1BGmM?s>!!cFh-h?K zmxUx#)2GsZst<&}HO(9B{IrYQg;TA~9-W4dYHbaLuioBMlrwiQpanNhk`u{l2s-5_ zQx2Wp-U=(G2*{!bO;7kbR^0)A;WoXP_%Y;VX~rVjt0;x9``)i%9z6(uL!+auy5f@o zXNKnJTcq5blD9VlfZ)=9wdqJ=LO1VAK=cWFu`f5#Lnm4yVAz$gWDmx zz{-O*yDXNN$*HN(+vcUCiHZ36+eo^Amd;M5!gnVt+jx!FPqiV#F9S~ zD+Y(;-X2xFCXMV%Ex&MN#WSoYZLrqIZs!ofLqvP`1D$)wvnQ-q^O_Q5`pg*mjmBo9 z9K_J@eJ5n)Hhl`Cx9-;IcI+17cRL&%#ns;UeV14vdRbq}nDhCa2wy;|gh|bn$SU<8 z;zh^mlVj@FnS!!babNqoZsn5M9GFvpJ(q&2f?R)-F$p>FJn7<1lvWbGT1SOM>Q^sH z#4b*GKgneeU=xgb$%GkUF=>~pyoGD9(($SB%Zo}NPwkkN!=m9Nz60eZ}gNEMl6mT>qr>O}KuF3!PIb9*OB571f^PzDURcl|8*C3kRgjMq?oebe8CVmgGmc1hEetH<_B+1_at7iEpJ%jpb5?=_D_EP3ZbL=JqF zJ5|W(sC>&JzVrUjxu4_C5{-vRjBIW~Ho}up>g{#DKwrTQ8A9R4$%dMHdrkeiE?sqW zrY*+}eK&WkljNQy3_7(@LY`tIS1!0bY;ls+{>g>iEkR!{3XB7F9m!Gepo_}M2d$u; z4^v1J|NM}YV*X;Ft9;A{eev2h7|4X&!VQ0t;C~P~q4s!QGyDB;?#Na2?6wQftwS^w zF(RsJKKVrmo)>aX5CmDPDEHHeI(M}HO=Q#1nIMbfEJpuaSy zraONoAWVK65ahrHCyGyi_6aJH*fsU?X^>VIX4bO^H0s`gr;0c8V?}#i zQkS+LVdRyKGTOwl$j*EHH(l8%nhPOrMy&w#Q|`>EYF{(NV@>l=>Rj=85k-%#T+;Rk=_jr(&< zqkvYrJm2KB)P$;9ZhsfZCi-&2qV;Oktt08H=MxsJ5W3UH^OMLEu31t4!i@=^*}7Zv zfcK^k^I7JfNO?wG5b0P1Fh<&=&#NaxZd*Cse8&N?*|%Q#?95PC04CzTnejc3r%dgn zQw8o|zc=k`gYn=fxr4yV?t^3hyvh6xEl(t=NN2}G^~qZudfTkmZ&#|Sa1gP8xH|T+ zEN4cai{L;LzWAz}dyhu)h}aXZ1Umr+bZ@mNdJJ*qjp(@ZTY681LZ4L^ABR1#RrA}C z?KU-Op*E)A{+rQJ_3#Y6qfvYKk8th!lh_7dd~4jSC``b$ZYAqT9xZ| z@9)w#@CJS_n{wiAS1%IVRJ8Imx%^d`b?UL*TDXCy%fZGyJD@VPT>fA2-g@M+sLCw0 zyMvFH2cYGC64e!Fv`cel?i{uY0;^MG`7wq2L;8hk3-LvpWxALObl6vl58A~&_l$(0 zjT39Mf7?v!(mn??)DCNBVgRMw#0orrRZ@9WNpyE>PNbBEX6T$QLfA%y-LZ-FeA!u(@n5~hMo`E&)`U5n&#v05UBWB==2UAu(Z zj6NrtTXO8geHmdu*KpTG0Gf^YseG41OlXE8=v9OxflXw|8Ai^!^o!qo-kNjIOtd&~ z*67-uGb{8?-!?r#dx`&Msn5|z6uU7gSYote=RYEeI$oU(pxu@5m5?~P<= zVRJ2IxY(aI>aOo4MlJHH=%-iAu{Cs?b`d(41t1irUK+*66%LbYEnNDEKM$&BFJjSD zdeLVVH&P!LHCjJ@o&(WMXW9`(fpT|#O4GikIy%TAoIZR`f(Vgd#E6W;GD_pWR!kwc z_|cR*VXZmZb<#KfXvlu2_RL2I6`lgt6U=OfP*9HRT-`xiTQypb5SjA{dXG;hXAC-^ zx8aWBjm7w@U)G-(&aA{ ze8mKp)q`8Y;8wyG?pCM-zzv4*azMZwU_ouLfH04MFrUzCFjyE2KFHM5_-`Fh(4n36 z`~T+-S^aBAs15){Syh>8DYKA&`TrvU_8<7K!2gT*FApCt3KRan@Lyi=f8f8o{Qp1x z`+s5s{IB>g1{45zqKWYYb@zB}xkFS!r4H4WeSCaGWq`1*C*W38^fw>` zFgy&?2|;zS*{D{$rA=pr0}_5IIlhyHszITA9BPT3l8_pRB-07%ju_pNS@D|1ake zT0^cVZgs