Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add qv and rh to soundings output files #1030

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/core_atmosphere/diagnostics/soundings.F
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ subroutine soundings_setup(configs, all_pools, simulation_clock, dminfo)

if (dminfo % my_proc_id == IO_NODE) then
inquire(file='sounding_locations.txt', exist=exists)
!$OMP MASTER
call EXECUTE_COMMAND_LINE ('[ ! -d "SOUNDINGS" ] && mkdir -p SOUNDINGS')
!$OMP END MASTER
end if
call mpas_dmpar_bcast_logical(dminfo, exists)

Expand Down Expand Up @@ -221,7 +224,7 @@ subroutine soundings_compute()
character(len=StrKIND) :: nowString
integer :: yyyy, mm, dd, h, m, s
character(len=StrKIND) :: fname
character(len=10) :: stid
character(len=20) :: stid


if (MPAS_is_alarm_ringing(simulationClock, 'soundingAlarm')) then
Expand All @@ -246,17 +249,17 @@ subroutine soundings_compute()
if (stationOwned(iStn)) then
! call mpas_log_write('Writing sounding for station '//trim(stationNames(iStn)))

write(fname,'(a,i4.4,i2.2,i2.2,i2.2,i2.2,a)') trim(stationNames(iStn))//'.', yyyy, mm, dd, h, m, '.snd'
write(fname,'(a,i4.4,i2.2,i2.2,i2.2,i2.2,a)') trim('SOUNDINGS/'//stationNames(iStn))//'.', yyyy, mm, dd, h, m, '.snd'
open(97,file=trim(fname),form='formatted',status='replace')

write(stid,'(a)') trim(stationNames(iStn))

write(97,'(a)') ' SNPARM = PRES;HGHT;TMPC;DWPC;DRCT;SPED;'
write(97,'(a)') ' SNPARM = PRES;HGHT;TMPC;DWPC;DRCT;SPED;QV;RH'
write(97,'(a)') ''
write(97,'(a,i2.2,i2.2,i2.2,a,i2.2,i2.2)') ' STID = '//stid//' STNM = 99999 TIME = ', mod(yyyy,100), mm, dd,'/', h, m
write(97,'(a,f6.2,a,f7.2,a)') ' SLAT = ', stationLats(iStn), ' SLON = ', stationLons(iStn), ' SELV = -999'
write(97,'(a)') ''
write(97,'(a)') ' PRES HGHT TMPC DWPC DRCT SPED'
write(97,'(a)') ' PRES HGHT TMPC DWPC DRCT SPEED QV RH'

do k=1,nVertLevels
tmpc = theta_m(k,stationCells(iStn)) / (1.0_RKIND + rvord * scalars(index_qv,k,stationCells(iStn))) * exner(k,stationCells(iStn))
Expand All @@ -281,13 +284,15 @@ subroutine soundings_compute()
end if
dir = dir * 180.0_RKIND / pi_const
end if
write(97,'(f10.2,f10.2,f9.2,f9.2,f9.2,f9.2)') &
write(97,'(f10.2,f10.2,f9.2,f9.2,f9.2,f9.2,F10.6,F7.2)') &
pres, &
0.5 * (zgrid(k,stationCells(iStn)) + zgrid(k+1,stationCells(iStn))), & ! Avg to layer midpoint
tmpc, &
tdpc, &
dir, &
spd
spd, &
scalars(index_qv,k,stationCells(iStn)), &
rh*100.
end do

close(97)
Expand Down