import numpy as np
import os

###########################################

   ##
   ##  load the data into the numpy array
   ##

# Retrieve the environment variables for the input file
input_file = os.path.expandvars(os.environ['INPUT_FILE'])
try:
    met_data = np.loadtxt(input_file)
except NameError:
    print("Can't find the input file")

print(met_data.shape)
print(met_data.dtype)

###########################################

   ##
   ##  create the metadata dictionary
   ##

attrs = {

   'valid': '20050807_120000', 
   'init':  '20050807_000000', 
   'lead':  '120000', 
   'accum': '120000', 

   'name': 'Foo', 
   'long_name': 'FooBar', 
   'level': 'Surface',
   'units': 'None',

   'grid': {
      'type': 'Lambert Azimuthal Equal Area', 
      'name': 'FooGrid',

      'equatorial_radius_km': 6378.137,
      'polar_radius_km': 6356.752314,

      'lat_first': 44.517153, 
      'lon_first': -17.117129,

      'standard_lat': 54.9, 
      'central_lon': -2.5, 

      'dx_km': 12., 
      'dy_km': 15., 

      'nx': 185, 
      'ny': 129, 
   }

}

print(attrs)
