Skip to content

Commit

Permalink
GitHub Issue NOAA-EMC#13. Continuing to clear through coding standard…
Browse files Browse the repository at this point in the history
… issues in the master. Finished through src/gsi/intlwcp.f90.
  • Loading branch information
MichaelLueken committed Jun 19, 2020
1 parent 766e4e1 commit 81acc83
Show file tree
Hide file tree
Showing 17 changed files with 1,304 additions and 1,299 deletions.
48 changes: 25 additions & 23 deletions src/gsi/inc2guess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,34 @@ subroutine inc2guess(sval)
character(len=10),allocatable,dimension(:) :: guess
integer(i_kind) i,j,k,it,ii,ic,id,ngases,nguess,ier,istatus
real(r_kind) :: zt
real(r_kind),pointer,dimension(:,: ) :: ptr2dinc=>NULL()
real(r_kind),pointer,dimension(:,: ) :: ptr2dges=>NULL()
real(r_kind),pointer,dimension(:,:,:) :: ptr3dinc=>NULL()
real(r_kind),pointer,dimension(:,:,:) :: ptr3dges=>NULL()
real(r_kind),pointer,dimension(:,:,:) :: ges_div_it=>NULL()
real(r_kind),pointer,dimension(:,:,:) :: ges_vor_it=>NULL()
real(r_kind),pointer,dimension(:,: ) :: ptr2dinc=>null()
real(r_kind),pointer,dimension(:,: ) :: ptr2dges=>null()
real(r_kind),pointer,dimension(:,:,:) :: ptr3dinc=>null()
real(r_kind),pointer,dimension(:,:,:) :: ptr3dges=>null()
real(r_kind),pointer,dimension(:,:,:) :: ges_div_it=>null()
real(r_kind),pointer,dimension(:,:,:) :: ges_vor_it=>null()

! Inquire about guess fields
call gsi_metguess_get('dim',nguess,istatus)
if (nguess>0) then
allocate(guess(nguess))
call gsi_metguess_get('gsinames',guess,istatus)
endif
call gsi_metguess_get('dim',nguess,istatus)
if (nguess>0) then
allocate(guess(nguess))
call gsi_metguess_get('gsinames',guess,istatus)
endif

! Inquire about chemistry fields
call gsi_chemguess_get('dim',ngases,istatus)
if (ngases>0) then
allocate(gases(ngases))
call gsi_chemguess_get('gsinames',gases,istatus)
endif
call gsi_chemguess_get('dim',ngases,istatus)
if (ngases>0) then
allocate(gases(ngases))
call gsi_chemguess_get('gsinames',gases,istatus)
endif

!*******************************************************************************

! Overwrite guess fields by increments
do it=1,nfldsig
if (nobs_bins>1) then
zt = hrdifsig(it)
ii = NINT(zt/hr_obsbin)+1
ii = nint(zt/hr_obsbin)+1
else
ii = 1
endif
Expand All @@ -113,7 +113,7 @@ subroutine inc2guess(sval)
call gsi_bundlegetpointer (sval(ii), guess(ic),ptr3dinc,istatus)
call gsi_bundlegetpointer (gsi_metguess_bundle(it),guess(ic),ptr3dges,istatus)
if (trim(guess(ic))=='oz'.or.trim(guess(ic))=='q') then
call copy_positive_fldr3_(ptr3dges,ptr3dinc)
call copy_positive_fldr3_(ptr3dges,ptr3dinc)
else
ptr3dges = ptr3dinc
endif
Expand Down Expand Up @@ -146,7 +146,7 @@ subroutine inc2guess(sval)
end do

if(ngases>0)then
deallocate(gases)
deallocate(gases)
endif

call gsi_bundlegetpointer (sval(ii),'sst',ptr2dinc,istatus)
Expand All @@ -164,8 +164,9 @@ subroutine inc2guess(sval)
return
contains
subroutine copy_positive_fldr2_(ges,xinc)
real(r_kind),pointer :: ges(:,:)
real(r_kind),pointer :: xinc(:,:)
implicit none
real(r_kind),pointer,intent(inout) :: ges(:,:)
real(r_kind),pointer,intent(in ) :: xinc(:,:)
real(r_kind) ana
do j=1,lon2
do i=1,lat2
Expand All @@ -175,8 +176,9 @@ subroutine copy_positive_fldr2_(ges,xinc)
end do
end subroutine copy_positive_fldr2_
subroutine copy_positive_fldr3_(ges,xinc)
real(r_kind),pointer :: ges(:,:,:)
real(r_kind),pointer :: xinc(:,:,:)
implicit none
real(r_kind),pointer,intent(inout) :: ges(:,:,:)
real(r_kind),pointer,intent(in ) :: xinc(:,:,:)
real(r_kind) ana
do k=1,nsig
do j=1,lon2
Expand Down
67 changes: 35 additions & 32 deletions src/gsi/insitu_info.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ module insitu_info
subroutine mbuoy_info(mype)
!**************************************************************************
!
! assign the depth dependent moored buoy station ID
! assign the depth dependent moored buoy station id
!
implicit none

integer(i_kind), intent(in) :: mype
allocate(cid_mbuoy(n_3mdiscus))
Expand All @@ -60,13 +61,13 @@ subroutine mbuoy_info(mype)
!
cid_mbuoy = ' '
!
! COMPS moored buoy (depth = 1.2m)
! comps moored buoy (depth = 1.2m)
!
cid_mbuoy( 1) = '42022'
cid_mbuoy( 2) = '42023'
cid_mbuoy( 3) = '42024'
!
! SCRIPPS moored buoy (depth = 0.45m)
! scripps moored buoy (depth = 0.45m)
!
cid_mbuoy( 4) = '31201'
cid_mbuoy( 5) = '41112'
Expand Down Expand Up @@ -106,7 +107,7 @@ subroutine mbuoy_info(mype)
cid_mbuoy(39) = '51203'
cid_mbuoy(40) = '52200'
!
! TRITON buoys (depth = 1.5m)
! triton buoys (depth = 1.5m)
!
cid_mbuoy(41) = '52071'
cid_mbuoy(42) = '52072'
Expand All @@ -133,7 +134,7 @@ subroutine mbuoy_info(mype)
cid_mbuoy(63) = '52045'
cid_mbuoy(64) = '52046'
!
! NDBC 3-meter buoy (depth = 0.6m)
! ndbc 3-meter buoy (depth = 0.6m)
!
cid_mbuoy(71) = '41004'
cid_mbuoy(72) = '41008'
Expand Down Expand Up @@ -193,7 +194,7 @@ subroutine mbuoy_info(mype)
cid_mbuoy(126) = '51001'
cid_mbuoy(127) = '51028'
!
! Canadian 3-meter buoy (depth = 0.6m)
! canadian 3-meter buoy (depth = 0.6m)
!
cid_mbuoy(128) = '44258'
cid_mbuoy(129) = '45132'
Expand All @@ -219,7 +220,7 @@ subroutine mbuoy_info(mype)
cid_mbuoy(149) = '46207'
cid_mbuoy(150) = '46208'
!
! MBARI moored buoy (depth = 0.6m)
! mbari moored buoy (depth = 0.6m)
!
cid_mbuoy(151) = '46091'
cid_mbuoy(152) = '46092'
Expand All @@ -233,8 +234,9 @@ end subroutine mbuoy_info
subroutine mbuoyb_info(mype)
!**************************************************************************
!
! assign the depth dependent moored buoyb station ID
! assign the depth dependent moored buoyb station id
!
implicit none

integer(i_kind), intent(in) :: mype
allocate(cid_mbuoyb(n_3mdiscus))
Expand All @@ -243,13 +245,13 @@ subroutine mbuoyb_info(mype)
!
cid_mbuoyb = ' '
!
! COMPS moored buoy (depth = 1.2m)
! comps moored buoy (depth = 1.2m)
!
cid_mbuoyb( 1) = '4200022'
cid_mbuoyb( 2) = '4200023'
cid_mbuoyb( 3) = '4200024'
!
! SCRIPPS moored buoy (depth = 0.45m)
! scripps moored buoy (depth = 0.45m)
!
cid_mbuoyb( 4) = '3100201'
cid_mbuoyb( 5) = '4100112'
Expand Down Expand Up @@ -289,7 +291,7 @@ subroutine mbuoyb_info(mype)
cid_mbuoyb(39) = '5100203'
cid_mbuoyb(40) = '5200200'
!
! TRITON buoys (depth = 1.5m)
! triton buoys (depth = 1.5m)
!
cid_mbuoyb(41) = '5200071'
cid_mbuoyb(42) = '5200072'
Expand All @@ -316,7 +318,7 @@ subroutine mbuoyb_info(mype)
cid_mbuoyb(63) = '5200045'
cid_mbuoyb(64) = '5200046'
!
! NDBC 3-meter buoy (depth = 0.6m)
! ndbc 3-meter buoy (depth = 0.6m)
!
cid_mbuoyb(71) = '4100004'
cid_mbuoyb(72) = '4100008'
Expand Down Expand Up @@ -376,7 +378,7 @@ subroutine mbuoyb_info(mype)
cid_mbuoyb(126) = '5100001'
cid_mbuoyb(127) = '5100028'
!
! Canadian 3-meter buoy (depth = 0.6m)
! canadian 3-meter buoy (depth = 0.6m)
!
cid_mbuoyb(128) = '4400258'
cid_mbuoyb(129) = '4500132'
Expand All @@ -402,7 +404,7 @@ subroutine mbuoyb_info(mype)
cid_mbuoyb(149) = '4600207'
cid_mbuoyb(150) = '4600208'
!
! MBARI moored buoy (depth = 0.6m)
! mbari moored buoy (depth = 0.6m)
!
cid_mbuoyb(151) = '4600091'
cid_mbuoyb(152) = '4600092'
Expand All @@ -418,26 +420,27 @@ subroutine read_ship_info(mype)
!
! read ship info from an external file to determine the depth and instrument
!
integer(i_kind), intent(in) :: mype
implicit none
integer(i_kind), intent(in) :: mype

integer(i_kind) ios
logical iexist
integer(i_kind) ios
logical iexist

filename='insituinfo'
inquire(file=trim(filename),exist=iexist)
if(iexist) then
open(lunship,file=filename,form='formatted',iostat=ios)
allocate (ship%id(n_ship),ship%depth(n_ship),ship%sensor(n_ship))
if(ios==0) then
do i = 1, n_ship
read(lunship,'(a10,f6.1,1x,a5)') ship%id(i),ship%depth(i),ship%sensor(i)
enddo
endif
else
n_ship=0
allocate (ship%id(n_ship),ship%depth(n_ship),ship%sensor(n_ship))
endif
filename='insituinfo'
inquire(file=trim(filename),exist=iexist)
if(iexist) then
open(lunship,file=filename,form='formatted',iostat=ios)
allocate (ship%id(n_ship),ship%depth(n_ship),ship%sensor(n_ship))
if(ios==0) then
do i = 1, n_ship
read(lunship,'(a10,f6.1,1x,a5)') ship%id(i),ship%depth(i),ship%sensor(i)
enddo
endif
else
n_ship=0
allocate (ship%id(n_ship),ship%depth(n_ship),ship%sensor(n_ship))
endif

if(mype == 0) write(6,*) ' in read_ship_info, n_ship = ', n_ship
if(mype == 0) write(6,*) ' in read_ship_info, n_ship = ', n_ship
end subroutine read_ship_info
end module insitu_info
Loading

0 comments on commit 81acc83

Please sign in to comment.