Commit 4b2b5f1f authored by dingwell's avatar dingwell
Browse files

Debugging netcdf output

Fixed length of variables
Removed redundant definintions
parent 7c041f72
......@@ -58,15 +58,15 @@ module netcdf_output_mod
#endif
! Common names used for defining output variables:
character, parameter :: vname_t = 'Times'
character, parameter :: vname_x = 'XLONG'
character, parameter :: vname_y = 'XLAT'
character, parameter :: vname_t = 'Times'
character, parameter :: vname_x*5 = 'XLONG'
character, parameter :: vname_y*4 = 'XLAT'
! Common names used for naming variable attributes:
character, parameter :: descr = 'description'
character, parameter :: units = 'units'
character, parameter :: coord = 'coordinates'
character, parameter :: coordxy = 'XLONG XLAT'
character, parameter :: descr*11 = 'description'
character, parameter :: units*5 = 'units'
character, parameter :: coord*11 = 'coordinates'
character, parameter :: coordxy*10 = 'XLONG XLAT'
contains
......@@ -327,7 +327,8 @@ module netcdf_output_mod
!integer ncdimsid_times(2) ! Used to defin time dimension variable
! NETCDF filename & attribute related variables
character descr*11,units*5,ncname*29,coord*11,coordxy*10
!character descr*11,units*5,ncname*29,coord*11,coordxy*10
character ncname*29
!integer coordxylen
character unit2d*10 ! unit for deposition fields
!integer unit2dlen ! length of character string
......@@ -521,11 +522,14 @@ module netcdf_output_mod
NF90_FLOAT,(/ncrepid,ncspcid,ncrecid/),ncrcovid)
#endif
call check_ncerror(ncret)
write(*,*) "A"
ncret = NF90_PUT_ATT(ncid,ncrcovid,descr, &
'CONCENTRATION AT RECEPTOR POINTS')
call check_ncerror(ncret)
write(*,*) "A"
ncret = NF90_PUT_ATT(ncid,ncrcovid,units,'ng m-3')
call check_ncerror(ncret)
write(*,*) "A"
endif
if ((iout.eq.2).or.(iout.eq.3)) then ! MIXING RATIO OUTPUT?
......@@ -744,7 +748,8 @@ module netcdf_output_mod
integer ncdimsid3(6),ncdimsid2(5) ! arrays of dimension ids for outgrid 3D & 2D
! NETCDF filename & attribute related variables
character descr*11,units*5,ncname*29,coord*11,coordxy*10
!character descr*11,units*5,coord*11,coordxy*10
character ncname*29
! NETCDF misc variables
integer ncid ! local container for netcdf file-id (either ncout or ncoutn)
......@@ -761,10 +766,10 @@ module netcdf_output_mod
real :: x_rep_tmpb,y_rep_tmpb
! Attribute notation:
descr = 'description'
units = 'units'
coord = 'coordinates'
coordxy = 'XLONG XLAT'
!descr = 'description'
!units = 'units'
!coord = 'coordinates'
!coordxy = 'XLONG XLAT'
! Determine current calendar date, needed for the file name
!**********************************************************
......@@ -916,10 +921,10 @@ module netcdf_output_mod
! XLONG
if (option_verbose.ge.10) write(*,10) 'XLONG dimension variable'
#ifdef NETCDF4_OUTPUT
ncret = NF90_DEF_VAR(ncid,vname_x,NF90_FLOAT,ncdimsid2(1:2),nclonvid, &
shuffle = shuffle, deflate_level=deflate_level)
ncret = NF90_DEF_VAR(ncid,vname_x,NF90_FLOAT,ncdimsid2(1:2),nclonvid, &
shuffle = shuffle, deflate_level=deflate_level)
#else
ncret = NF90_DEF_VAR(ncid,vname_x,NF90_FLOAT,ncdimsid2(1:2),nclonvid)
ncret = NF90_DEF_VAR(ncid,vname_x,NF90_FLOAT,ncdimsid2(1:2),nclonvid)
#endif
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid,descr, &
......@@ -927,11 +932,13 @@ module netcdf_output_mod
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid,units,'degree_east')
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'XLONG CORNER variable'
#ifdef NETCDF4_OUTPUT
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclonvid2, &
shuffle = shuffle, deflate_level=deflate_level)
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclonvid2, &
shuffle = shuffle, deflate_level=deflate_level)
#else
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclonvid2)
ncret = NF90_DEF_VAR(ncid,'XLONG_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclonvid2)
#endif
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclonvid2,descr, &
......@@ -942,6 +949,8 @@ module netcdf_output_mod
! XLAT
if (option_verbose.ge.10) write(*,10) 'XLAT dimension variable'
write(*,*) vname_y
write(*,*) vname_x
#ifdef NETCDF4_OUTPUT
ncret = NF90_DEF_VAR(ncid,vname_y,NF90_FLOAT,ncdimsid2(1:2),nclatvid, &
shuffle = shuffle, deflate_level=deflate_level)
......@@ -953,11 +962,13 @@ module netcdf_output_mod
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclatvid,units,'degree_north')
call check_ncerror(ncret)
if (option_verbose.ge.10) write(*,10) 'XLAT_CORNER variable'
#ifdef NETCDF4_OUTPUT
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclatvid2, &
shuffle = shuffle, deflate_level=deflate_level)
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclatvid2, &
shuffle = shuffle, deflate_level=deflate_level)
#else
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclatvid2)
ncret = NF90_DEF_VAR(ncid,'XLAT_CORNER',NF90_FLOAT,ncdimsid2(1:2),nclatvid2)
#endif
call check_ncerror(ncret)
ncret = NF90_PUT_ATT(ncid,nclatvid2,descr, &
......@@ -1417,14 +1428,14 @@ module netcdf_output_mod
! SAVE CREATED NETCDF TO FILE
!****************************
if (option_verbose.ge.1) write(*,*) 'nc_create_header: writing to disk'
if (option_verbose.ge.1) write(*,*) 'nc_create_header_outfile: writing to disk'
!ncret = nf_sync(ncid)
ncret = NF90_SYNC(ncid)
call check_ncerror(ncret)
return
10 format('nc_create_header: Setting up ',A)
10 format('nc_create_header_outfile: Setting up ',A)
!ncret=nf_close(ncid)
ncret=NF90_CLOSE(ncid)
......
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