Commit f85f88d9 authored by kbk's avatar kbk
Browse files

stricter COARDS conforming

parent c2c2caa7
!$Id: init_grid_ncdf.F90,v 1.1 2005-04-25 09:32:34 kbk Exp $ !$Id: init_grid_ncdf.F90,v 1.2 2005-04-29 12:45:41 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -40,7 +40,10 @@ ...@@ -40,7 +40,10 @@
! Original author(s): Lars Umlauf ! Original author(s): Lars Umlauf
! !
! $Log: init_grid_ncdf.F90,v $ ! $Log: init_grid_ncdf.F90,v $
! Revision 1.1 2005-04-25 09:32:34 kbk ! Revision 1.2 2005-04-29 12:45:41 kbk
! stricter COARDS conforming
!
! Revision 1.1 2005/04/25 09:32:34 kbk
! added NetCDF IO rewrite + de-stag of velocities - Umlauf ! added NetCDF IO rewrite + de-stag of velocities - Umlauf
! !
! !
...@@ -94,18 +97,18 @@ ...@@ -94,18 +97,18 @@
case (2) case (2)
xname = 'lonc' xname = 'lonc'
yname = 'latc' yname = 'latc'
xunits = 'deg' xunits = 'degrees_east'
yunits = 'deg' yunits = 'degrees_north'
case (3) case (3)
xname = 'xic' xname = 'xic'
yname = 'etac' yname = 'etac'
xunits = '-' xunits = ' '
yunits = '-' yunits = ' '
case (4) case (4)
xname = 'xic' xname = 'xic'
yname = 'etac' yname = 'etac'
xunits = '-' xunits = ' '
yunits = '-' yunits = ' '
case default case default
end select end select
...@@ -113,13 +116,13 @@ ...@@ -113,13 +116,13 @@
select case (vert_cord) select case (vert_cord)
case (1) case (1)
zname = 'sigma' zname = 'sigma'
zunits = '' zunits = 'sigma_level'
case (2) case (2)
zname = 'z' zname = 'z'
zunits = 'm' zunits = 'm'
case (3) case (3)
zname = 'level' zname = 'level'
zunits = '' zunits = 'level'
case default case default
end select end select
endif endif
...@@ -298,13 +301,13 @@ ...@@ -298,13 +301,13 @@
status = nf_def_var(ncid,'xc',NF_REAL,1,axisdim,xc_id) status = nf_def_var(ncid,'xc',NF_REAL,1,axisdim,xc_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","xc -") "init_grid_ncdf()","xc -")
call set_attributes(ncid,xc_id,units=xunits) call set_attributes(ncid,xc_id,units=trim(xunits))
axisdim(1) = y_dim axisdim(1) = y_dim
status = nf_def_var(ncid,'yc',NF_REAL,1,axisdim,yc_id) status = nf_def_var(ncid,'yc',NF_REAL,1,axisdim,yc_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","yc -") "init_grid_ncdf()","yc -")
call set_attributes(ncid,yc_id,units=yunits) call set_attributes(ncid,yc_id,units=trim(yunits))
case (2) case (2)
...@@ -312,26 +315,26 @@ ...@@ -312,26 +315,26 @@
status = nf_def_var(ncid,'dlon',NF_REAL,0,scalar,dlon_id) status = nf_def_var(ncid,'dlon',NF_REAL,0,scalar,dlon_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","dlon -") "init_grid_ncdf()","dlon -")
call set_attributes(ncid,dlon_id,units='deg', & call set_attributes(ncid,dlon_id,units=trim(xunits), &
long_name='grid spacing (lon)') long_name='grid spacing (lon)')
status = nf_def_var(ncid,'dlat',NF_REAL,0,scalar,dlat_id) status = nf_def_var(ncid,'dlat',NF_REAL,0,scalar,dlat_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","dlat -") "init_grid_ncdf()","dlat -")
call set_attributes(ncid,dlat_id,units='deg', & call set_attributes(ncid,dlat_id,units=trim(yunits), &
long_name='grid spacing (lat)') long_name='grid spacing (lat)')
! global offset ! global offset
status = nf_def_var(ncid,'lon0',NF_REAL,0,scalar,lon0_id) status = nf_def_var(ncid,'lon0',NF_REAL,0,scalar,lon0_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","lon0 -") "init_grid_ncdf()","lon0 -")
call set_attributes(ncid,lon0_id,units='deg', & call set_attributes(ncid,lon0_id,units=trim(xunits), &
long_name='offset (lon)') long_name='offset (lon)')
status = nf_def_var(ncid,'lat0',NF_REAL,0,scalar,lat0_id) status = nf_def_var(ncid,'lat0',NF_REAL,0,scalar,lat0_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","lat0 -") "init_grid_ncdf()","lat0 -")
call set_attributes(ncid,lat0_id,units='m', & call set_attributes(ncid,lat0_id,units=trim(yunits), &
long_name='offset (lat)') long_name='offset (lat)')
! coordinate variables ! coordinate variables
...@@ -339,13 +342,13 @@ ...@@ -339,13 +342,13 @@
status = nf_def_var(ncid,'lonc',NF_REAL,1,axisdim,lonc_id) status = nf_def_var(ncid,'lonc',NF_REAL,1,axisdim,lonc_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","lonc -") "init_grid_ncdf()","lonc -")
call set_attributes(ncid,lonc_id,units=xunits) call set_attributes(ncid,lonc_id,units=trim(xunits))
axisdim(1) = y_dim axisdim(1) = y_dim
status = nf_def_var(ncid,'latc',NF_REAL,1,axisdim,latc_id) status = nf_def_var(ncid,'latc',NF_REAL,1,axisdim,latc_id)
if (status .ne. NF_NOERR) call netcdf_error(status, & if (status .ne. NF_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","latc -") "init_grid_ncdf()","latc -")
call set_attributes(ncid,latc_id,units=yunits) call set_attributes(ncid,latc_id,units=trim(yunits))
case (3) case (3)
! no netcdf support for coordinate variables ! no netcdf support for coordinate variables
! for irregularly spaced coordinates ! for irregularly spaced coordinates
...@@ -423,7 +426,7 @@ ...@@ -423,7 +426,7 @@
vr(1) = -90. vr(1) = -90.
vr(2) = 90. vr(2) = 90.
call set_attributes(ncid,latc_id, & call set_attributes(ncid,latc_id, &
long_name='latitude',units='deg', & long_name='latitude',units='degrees_north', &
FillValue=fv,missing_value=mv,valid_range=vr) FillValue=fv,missing_value=mv,valid_range=vr)
status = nf_def_var(ncid,'lonc',NF_REAL,2,f2_dims,lonc_id) status = nf_def_var(ncid,'lonc',NF_REAL,2,f2_dims,lonc_id)
...@@ -434,7 +437,7 @@ ...@@ -434,7 +437,7 @@
vr(1) = -180. vr(1) = -180.
vr(2) = 180. vr(2) = 180.
call set_attributes(ncid,lonc_id, & call set_attributes(ncid,lonc_id, &
long_name='longitude',units='deg', & long_name='longitude',units='degrees_east', &
FillValue=fv,missing_value=mv,valid_range=vr) FillValue=fv,missing_value=mv,valid_range=vr)
endif endif
...@@ -448,7 +451,7 @@ ...@@ -448,7 +451,7 @@
vr(1) = -180. vr(1) = -180.
vr(2) = 180. vr(2) = 180.
call set_attributes(ncid,convc_id, & call set_attributes(ncid,convc_id, &
long_name='grid rotation',units='deg', & long_name='grid rotation',units='degrees', &
FillValue=fv,missing_value=mv,valid_range=vr) FillValue=fv,missing_value=mv,valid_range=vr)
endif endif
......
Markdown is supported
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