Skip to content

pyfive API compatability #11

@davidhassell

Description

@davidhassell

We think it could be good that the contents of ppfive.File "looks like" the equivalent contents of pyfive.File

>>> a =  ppfive.File('test2.pp')
>>> tuple(a.items()) 
(('m01s15i201',
  <PP variable "m01s15i201": shape (3, 5, 110, 106), type "float32">),
 ('time', <ppfive.file._DimensionScale at 0x7f3854276f60>),
 ('air_pressure', <ppfive.file._DimensionScale at 0x7f383e710350>),
 ('grid_latitude', <ppfive.file._DimensionScale at 0x7f383e7104d0>),
 ('grid_longitude', <ppfive.file._DimensionScale at 0x7f383e710170>),
 ('rotated_latitude_longitude', <ppfive.file._ScalarVar at 0x7f383e7105f0>),
 ('latitude', <ppfive.file._AuxVar at 0x7f38543306b0>),
 ('longitude', <ppfive.file._AuxVar at 0x7f383e710680>))
>>> f = cf.read('test2.pp')
>>> cf.write(f, 'test2.nc')
>>> p = pyfive.File('test2.nc')
>>> tuple(p.items()) 
(('bounds2', <HDF5 dataset "bounds2": shape (2,), type ">f4">),
 ('time_bounds', <HDF5 dataset "time_bounds": shape (3, 2), type "float64">),
 ('time', <HDF5 dataset "time": shape (3,), type "float64">),
 ('air_pressure', <HDF5 dataset "air_pressure": shape (5,), type "float32">),
 ('bounds', <HDF5 dataset "bounds": shape (110, 2), type "float64">),
 ('grid_latitude', <HDF5 dataset "grid_latitude": shape (110,), type "float64">),
 ('bounds_1', <HDF5 dataset "bounds_1": shape (106, 2), type "float64">),
 ('grid_longitude', <HDF5 dataset "grid_longitude": shape (106,), type "float64">),
 ('bounds4', <HDF5 dataset "bounds4": shape (4,), type ">f4">),
 ('latitude_bounds', <HDF5 dataset "latitude_bounds": shape (110, 106, 4), type "float64">),
 ('latitude', <HDF5 dataset "latitude": shape (110, 106), type "float64">),
 ('bounds_2', <HDF5 dataset "bounds_2": shape (110, 106, 4), type "float64">),
 ('longitude', <HDF5 dataset "longitude": shape (110, 106), type "float64">),
 ('rotated_latitude_longitude', <HDF5 dataset "rotated_latitude_longitude": shape (), type "|S1">),
 ('UM_m01s15i201_vn405', <HDF5 dataset "UM_m01s15i201_vn405": shape (3, 5, 110, 106), type "float32">))

(Ignore the "extra" bounds variables for now - that's another ongoing converstation :))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions