Commit 10f811dd authored by dingwell's avatar dingwell
Browse files

Debugged (still need changes to classic format and ncconcout*)

parent fe03d417
......@@ -195,7 +195,7 @@ subroutine write_ncheader(itime,nesting_level)
!call check_ncerror(ncret)
if (ldirect.eq.1) then ! Forward simulation
if (option_verbose.ge.10) write(*,10) 'forward simulation attributes'
ncret = NF_PUT_ATT(ncid,NF90_GLOBAL,'SIMULATION_START_DATE',ibdate)
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'SIMULATION_START_DATE',ibdate)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'SIMULATION_START_TIME',ibtime)
call check_ncerror(ncret)
......@@ -283,18 +283,15 @@ subroutine write_ncheader(itime,nesting_level)
! Write information on output grid setup
!***************************************
if (option_verbose.ge.10) write(*,10) 'WEST-EAST_GRID_DIMENSION'
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'WEST-EAST_GRID_DIMENSION', &
nf_int,1,ncgrid_nx)
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'WEST-EAST_GRID_DIMENSION', ncgrid_nx)
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'SOUTH-NORTH_GRID_DIMENSION'
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'SOUTH-NORTH_GRID_DIMENSION', &
nf_int,1,ncgrid_ny)
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'SOUTH-NORTH_GRID_DIMENSION', ncgrid_ny)
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'BOTTOM-TOP_GRID_DIMENSION'
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'BOTTOM-TOP_GRID_DIMENSION', &
nf_int,1,numzgrid)
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'BOTTOM-TOP_GRID_DIMENSION',numzgrid)
if (option_verbose.ge.10) write(*,10) 'DX and DY'
ncret = NF90_PUT_ATT(ncid,NF90_GLOBAL,'DX',ncgrid_dx)
......@@ -372,13 +369,13 @@ subroutine write_ncheader(itime,nesting_level)
ncret = NF90_DEF_VAR(ncid,'XLONG',NF90_REAL,ncdimsid2(1:2),nclonvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid,descr,42, &
ncret = NF90_PUT_ATT(ncid,nclonvid,descr, &
'Longitude of center grid, west is negative')
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid,units,11,'degree_east')
ncret = NF90_PUT_ATT(ncid,nclonvid,units,'degree_east')
call check_ncerror(ncret)
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_REAL,ncdimsid2(1:2),nclonvid2,
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_REAL,ncdimsid2(1:2),nclonvid2, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid2,descr, &
......@@ -389,7 +386,7 @@ subroutine write_ncheader(itime,nesting_level)
! XLAT
if (option_verbose.ge.10) write(*,10) 'XLAT dimension variable'
ncret = NF90_DEF_VAR(ncid,'XLAT',NF90_REAL,ncdimsid2(1:2),nclatvid,
ncret = NF90_DEF_VAR(ncid,'XLAT',NF90_REAL,ncdimsid2(1:2),nclatvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclatvid,descr,'Latitude of center grid, south is negative')
......@@ -397,7 +394,7 @@ subroutine write_ncheader(itime,nesting_level)
ncret = NF90_PUT_ATT(ncid,nclatvid,units,'degree_north')
call check_ncerror(ncret)
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_REAL,ncdimsid2(1:2),nclatvid2,
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_REAL,ncdimsid2(1:2),nclatvid2, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclatvid2,descr, &
......@@ -408,7 +405,7 @@ subroutine write_ncheader(itime,nesting_level)
! ZTOP
if (option_verbose.ge.10) write(*,10) 'ZTOP dimension variable'
ncret = NF90_DEF_VAR(ncid,'ZTOP',NF90_REAL,ncdimsid3(3),nclvlvid,
ncret = NF90_DEF_VAR(ncid,'ZTOP',NF90_REAL,ncdimsid3(3),nclvlvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclvlvid,descr, &
......@@ -419,7 +416,7 @@ subroutine write_ncheader(itime,nesting_level)
! SPECIES
if (option_verbose.ge.10) write(*,10) 'SPECIES dimension variable'
ncret = NF90_DEF_VAR(ncid,'SPECIES',NF90_CHAR,(/ncstr1id,ncspcid/),ncspcvid,
ncret = NF90_DEF_VAR(ncid,'SPECIES',NF90_CHAR,(/ncstr1id,ncspcid/),ncspcvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncspcvid,descr,'NAME OF SPECIES')
......@@ -467,7 +464,7 @@ subroutine write_ncheader(itime,nesting_level)
if (option_verbose.ge.10) write(*,10) 'ReleaseXstart_end variable'
ncret = NF90_DEF_VAR(ncid,'ReleaseXstart_end', &
NF90_FLOAT,(/ncrseid,ncrelid/),ncrxvid,
NF90_FLOAT,(/ncrseid,ncrelid/),ncrxvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncrxvid,descr, &
......@@ -499,7 +496,7 @@ subroutine write_ncheader(itime,nesting_level)
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'ReleaseNP variable'
ncret = NF90_DEF_VAR(ncid,'ReleaseNP'NF90_INT,ncrelid,ncspvid, &
ncret = NF90_DEF_VAR(ncid,'ReleaseNP',NF90_INT,ncrelid,ncspvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncspvid,descr, &
......@@ -508,7 +505,7 @@ subroutine write_ncheader(itime,nesting_level)
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'ReleaseXMass variable'
ncret = NF90_DEF_VAR(ncid,'ReleaseXMass',
ncret = NF90_DEF_VAR(ncid,'ReleaseXMass', &
NF90_FLOAT,(/ncspcid,ncrelid/),ncrmvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
......@@ -518,7 +515,7 @@ subroutine write_ncheader(itime,nesting_level)
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'ReceptorLon variable'
ncret = NF90_DEF_VAR(ncid,'ReceptorLon',NF90_FLOAT,1,ncrepid,ncrexvid, &
ncret = NF90_DEF_VAR(ncid,'ReceptorLon',NF90_FLOAT,ncrepid,ncrexvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncrexvid,descr,'Longitude of receptor points')
......@@ -568,12 +565,12 @@ subroutine write_ncheader(itime,nesting_level)
NF90_FLOAT,ncdimsid2(1:2),ncarvid, &
shuffle = shuffle, deflate_level=deflate_level)
call check_ncerror(ncret)
ncret = nf_put_att_text(ncid,ncarvid,descr, &
ncret = NF90_PUT_ATT(ncid,ncarvid,descr, &
'SURFACE AREA OF EACH GRID CELL')
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncarvid,units,'m2')
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,ncarvid,coord,coordxylen,coordxy)
ncret = NF90_PUT_ATT(ncid,ncarvid,coord,coordxy)
call check_ncerror(ncret)
! EXIT DEFINE MODE, ENTER DATA MODE
......@@ -610,7 +607,7 @@ subroutine write_ncheader(itime,nesting_level)
ncret = NF90_PUT_VAR(ncid,nclonvid2,tmplon,start=xyvec)
call check_ncerror(ncret)
!ncret = nf_put_vara_real(ncid,nclatvid2,xyvec,ones2,tmplat)
ncret = NF90_PUT_VAR(ncid,nclatvid2,tmpat,start=xyvec)
ncret = NF90_PUT_VAR(ncid,nclatvid2,tmplat,start=xyvec)
call check_ncerror(ncret)
enddo
enddo
......@@ -682,7 +679,7 @@ subroutine write_ncheader(itime,nesting_level)
!ncret = nf_put_vara_real(ncid,ncrzvid, & !ReleaseZstart_end
! (/1,i/),(/2,1/),(/zpoint1(i),zpoint2(i)/))
ncret = NF90_PUT_VAR(ncid,ncrzvid, & ! ReleaseZstart_end
(/zp1,zp2/), &
(/zpoint1,zpoint2/), &
start=(/1,i/), count=(/2,1/) )
call check_ncerror(ncret)
......@@ -697,9 +694,8 @@ subroutine write_ncheader(itime,nesting_level)
if (option_verbose.ge.10) write(*,10) 'ReleaseNP data'
!ncret = nf_put_vara_int(ncid,ncspvid, & !ReleaseNP
! i,1,npart(i))
ncret = NF90_PUT_VAR(ncid,ncspvid, & ! ReleaseNP
npart(i), &
start=i)
ncret = NF90_PUT_VAR(ncid,ncspvid, npart(:)) !ReleaseNP
! For some reason I cannot get this to work with indices, they aren't need anyway..
call check_ncerror(ncret)
!Release Name/Comment
......@@ -744,8 +740,8 @@ subroutine write_ncheader(itime,nesting_level)
do while( j.lt.16 .and. receptorname(i)(j+1:j+1).ne." ")
j=j+1
enddo
ncret = nf_put_vara_text(ncid,ncrenvid,(/1,i/),(/j,1/),receptorname(i)(1:j))
ncret = NT90_PUT_VAR(ncid,ncrenvid,&
!ncret = nf_put_vara_text(ncid,ncrenvid,(/1,i/),(/j,1/),receptorname(i)(1:j))
ncret = NF90_PUT_VAR(ncid,ncrenvid,&
receptorname(i)(1:j), &
start=(/1,i/), count=(/j,1/) )
call check_ncerror(ncret)
......@@ -766,7 +762,7 @@ subroutine write_ncheader(itime,nesting_level)
! ncret = nf_put_vara_real(ncid,nctovid, &
! (/ix,1/),(/1,ncgrid_ny/),ncgrid_oro(ix,1:ncgrid_ny))
ncret = NF90_PUT_VAR(ncid,nctovid, &
ncgrid_oro(ix,1:ncgrid_ny),
ncgrid_oro(ix,1:ncgrid_ny), &
start=(/ix,1/), count=(/1,ncgrid_ny/) )
call check_ncerror(ncret)
enddo
......
......@@ -37,6 +37,7 @@ subroutine write_ncheader(itime,nesting_level)
! June 5 2013: J. Brioude: generate a header*nc *
! 2015-05-04: A. Dingwell: Added receptor points to netcdf output *
! 2015-05-07: A. Dingwell: Forced receptor coord to always be in lat-lon *
! 2015-06-04: A. Dingwell: Updated subroutine to use NetCDF F90 module. *
!*****************************************************************************
use point_mod
......@@ -307,8 +308,7 @@ subroutine write_ncheader(itime,nesting_level)
! Set up netcdf dimensions
!*************************
if (option_verbose.ge.10) write(*,10) 'main grid dimensions'
ncret = nf_def_dim(ncid,'Time',nf_unlimited,ncrecid)
ncret = nf_def_dim(ncid,'Time',NF90_UNLIMITED,ncrecid)
call check_ncerror(ncret)
ncret = nf_def_dim(ncid,'DateStrLen',15,ncstr3id) !TODO: WRF format
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment