<p><b>ringler@lanl.gov</b> 2010-07-15 21:34:02 -0600 (Thu, 15 Jul 2010)</p><p><br>
add on_the_sphere and sphere_radius as global attributes to grid.nc file<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/grid_gen_ocean/pop_to_mpas/module_write_netcdf.F
===================================================================
--- branches/ocean_projects/grid_gen_ocean/pop_to_mpas/module_write_netcdf.F        2010-07-15 18:01:57 UTC (rev 377)
+++ branches/ocean_projects/grid_gen_ocean/pop_to_mpas/module_write_netcdf.F        2010-07-16 03:34:02 UTC (rev 378)
@@ -73,6 +73,8 @@
contains
subroutine write_netcdf_init( &
+ on_a_sphere, &
+ sphere_radius, &
nCells, &
nEdges, &
nVertices, &
@@ -86,6 +88,8 @@
include 'netcdf.inc'
+ character (len=16), intent(in) :: on_a_sphere
+ real (kind=8), intent(in) :: sphere_radius
integer, intent(in) :: nCells
integer, intent(in) :: nEdges
integer, intent(in) :: nVertices
@@ -97,7 +101,6 @@
integer :: nferr
integer, dimension(10) :: dimlist
-
wrLocalnCells = nCells
wrLocalnEdges = nEdges
wrLocalnVertices = nVertices
@@ -105,12 +108,14 @@
wrLocalnVertLevels = nVertLevels
wrLocalnTracers = nTracers
wrLocalnVertexDegree = nVertexDegree
-
+
nferr = nf_create('grid.nc', IOR(NF_CLOBBER,NF_64BIT_OFFSET), wr_ncid)
!
! Define dimensions
!
+ nferr = nf_put_att_text(wr_ncid, NF_GLOBAL, 'on_a_sphere', 16, on_a_sphere)
+ nferr = nf_put_att_double(wr_ncid, NF_GLOBAL, 'sphere_radius', NF_DOUBLE, 1, sphere_radius)
nferr = nf_def_dim(wr_ncid, 'nCells', nCells, wrDimIDnCells)
nferr = nf_def_dim(wr_ncid, 'nEdges', nEdges, wrDimIDnEdges)
nferr = nf_def_dim(wr_ncid, 'nVertices', nVertices, wrDimIDnVertices)
Modified: branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas.F
===================================================================
--- branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas.F        2010-07-15 18:01:57 UTC (rev 377)
+++ branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas.F        2010-07-16 03:34:02 UTC (rev 378)
@@ -22,6 +22,11 @@
real, parameter :: a_unit = 1.0 ! Radius of unit sphere
real, parameter :: xscale = 1.01
+
+ character (len=16) :: on_a_sphere
+ real (kind=8) :: sphere_radius
+
+
integer, allocatable, dimension(:) :: indexToCellID, indexToEdgeID, indexToVertexID
integer, allocatable, dimension(:) :: nEdgesOnCell, nEdgesOnEdge
integer, allocatable, dimension(:,:) :: cellsOnCell, edgesOnCell, verticesOnCell
@@ -62,6 +67,10 @@
!
! begin
!
+
+ on_a_sphere = 'YES '
+ sphere_radius = a
+
call cell_indexing_read_nl()
allocate(POP_uLat(nx,ny), POP_uLon(nx,ny), POP_Angle(nx,ny))
@@ -1105,7 +1114,7 @@
!
! Write grid to grid.nc file
!
- call write_netcdf_init( nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
+ call write_netcdf_init(on_a_sphere, sphere_radius, nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
call write_netcdf_fields( 1, &
latCell, lonCell, xCell, yCell, zCell, indexToCellID, &
Modified: branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_ChannelQuad.F
===================================================================
--- branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_ChannelQuad.F        2010-07-15 18:01:57 UTC (rev 377)
+++ branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_ChannelQuad.F        2010-07-16 03:34:02 UTC (rev 378)
@@ -29,6 +29,9 @@
beta = 1.4e-11, &
f0 = -1.1e-4
+ character (len=16) :: on_a_sphere
+ real (kind=8) :: sphere_radius
+
real (kind=8) :: ymid, ytmp, ymax, xmid, xloc, yloc, pert, ymin
real (kind=8), allocatable, dimension(:,:,:) :: utmp
@@ -72,6 +75,10 @@
!
! begin
!
+
+ on_a_sphere = 'NO '
+ sphere_radius = a
+
call cell_indexing_read_nl()
allocate(utmp(0:nx+1, 0:ny+1, 2))
@@ -912,7 +919,7 @@
!
! Write grid to grid.nc file
!
- call write_netcdf_init( nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
+ call write_netcdf_init(on_a_sphere, sphere_radius, nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
call write_netcdf_fields( 1, &
latCell, lonCell, xCell, yCell, zCell, indexToCellID, &
Modified: branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_UniformQuad.F
===================================================================
--- branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_UniformQuad.F        2010-07-15 18:01:57 UTC (rev 377)
+++ branches/ocean_projects/grid_gen_ocean/pop_to_mpas/pop_to_mpas_UniformQuad.F        2010-07-16 03:34:02 UTC (rev 378)
@@ -29,6 +29,9 @@
beta = 2.0e-11, &
f0 = 1.4e-4
+ character (len=16) :: on_a_sphere
+ real (kind=8) :: sphere_radius
+
real (kind=8) :: ymid, ytmp, ymax, xmid, xloc, yloc, pert
real (kind=8), allocatable, dimension(:,:,:) :: utmp
@@ -72,6 +75,11 @@
!
! begin
!
+
+
+ on_a_sphere = 'NO '
+ sphere_radius = a
+
call cell_indexing_read_nl()
allocate(utmp(0:nx+1, 0:ny+1, 2))
@@ -915,7 +923,7 @@
!
! Write grid to grid.nc file
!
- call write_netcdf_init( nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
+ call write_netcdf_init(on_a_sphere, sphere_radius, nCells, nEdges, nVertices, maxEdges, nVertLevels, nTracers, nVertexDegree)
call write_netcdf_fields( 1, &
latCell, lonCell, xCell, yCell, zCell, indexToCellID, &
</font>
</pre>