[mpas-developers] attributes in grid generation code

Todd Ringler ringler at lanl.gov
Tue May 18 08:18:02 MDT 2010


Hi Michael,

This sounds like a good place to start. My recommendation is to commit  
the changes at your convenience.

Cheers,
Todd

On May 17, 2010, at 7:28 PM, Michael Duda wrote:

> Hi, All.
>
> Toward the goal of being able to distinguish between grids in the
> plane and grids on the sphere in MPAS, I'm proposing that we add
> two attributes to the grid.nc file, and make changes to our grid
> generation codes (global_scvt, periodic_hex, and periodic_quad)
> that will add these attributes to future grid.nc files. The two
> attributes are
>
>   on_a_sphere -- a character string, either 'YES' or 'NO'
>   sphere_radius -- the radius of the sphere
>
> I'd prefer on_a_sphere to be a logical, but it appears that having
> a logical global attribute in netCDF is not possible (which isn't
> to say that global attributes must be illogical!).
>
> The code changes to module_write_netcdf.F in the three grid
> generation codes mentioned above would essentially look like
>
> 95a96,97
>>      real (kind=8) :: sphere_radius
>>      character (len=16) :: on_a_sphere
> 104a107,109
>>      on_a_sphere = 'YES             '
>>      sphere_radius = 1.0
>>
> 110a116,117
>>      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)
>
> with YES being replaced by NO and 1.0 being replaced by 0.0 in the
> case of the doubly-periodic codes.
>
> Although 'YES' requires only three characters and 'NO' requires
> only two, I wanted both to be the same length, and I figured
> making the attribute be 16 characters rather than three would
> allow for some potential flexibility in future without adding an
> unreasonable amount of storage. For example, if not on the sphere,
> we might in future find it useful to be able to set on_a_sphere to
> something like 'NO (X-Y PLANE)'. Who knows.
>
> If there are no suggestions for improvements (or requests to see
> the changes as they appear in the module_write_netcdf.F files),
> I'll commit these changes. I can also update all of the existing
> grid.nc files available from
> http://www.mmm.ucar.edu/people/duda/files/mpas/ as well as provide
> a utility program to update any other grid.nc file with the
> new attributes.
>
> Cheers,
> Michael
> _______________________________________________
> mpas-developers mailing list
> mpas-developers at mailman.ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/mpas-developers



More information about the mpas-developers mailing list