Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limited area #1

Closed
doutriaux1 opened this issue May 23, 2013 · 2 comments
Closed

limited area #1

doutriaux1 opened this issue May 23, 2013 · 2 comments
Assignees

Comments

@doutriaux1
Copy link
Collaborator

Hello Charles,

I'm getting very confused as to what should and shouldn't work in cmor. I thought I had a work around to the grid problem below, but I'm still not sure CMOR is working quite right (it seems to want to reverse the longitudes when it shouldn't). When I was trying to produce a test case demonstrating my current problem I managed to generate yet a different set of errors. I've attached the test case which is throwing up the new (and I think incorrect - but please review the test) errors.

This is causing us some frustration as its delaying us distributing some data from a regional model. If you could find some time to have a look at the problem it would be appreciated.

Thanks,

Jamie

Sample code:

import cmor
import numpy

def cmor_initialisation():
    cmor.setup(inpath='/net/home/h03/hadju/Projects/MipTables/cmip5-cmor-tables/Tables',
               netcdf_file_action = cmor.CMOR_REPLACE_3,
               create_subdirectories = 0)
    cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
                 institute_id = 'ukmo',
                 model_id = 'HadCM3',
                 history = 'some global history',
                 forcing = 'N/A',
                 parent_experiment_id = 'N/A',
                 parent_experiment_rip = 'N/A',
                 branch_time = 0.,
                 contact = 'bob',
                 outpath = '/data/local/hadju/test')

def setup_data():
    axes = [ {'table_entry': 'time',
              'units': 'days since 2000-01-01 00:00:00'
              },
             {'table_entry': 'latitude',
              'units': 'degrees',
              'coord_vals': [0],
              'cell_bounds': [-0.5, 0.5]},
             {'table_entry': 'longitude',
              'units': 'degrees',
              'coord_vals': [359., 1.],
              'cell_bounds': [[359. - 1., 359. + 1.],
                              [1. - 1., 1. + 1.]]},
             ]

    values = numpy.array([359., 1.], numpy.float32)
    return values, axes

def cmor_define_and_write(values, axes):
    table = 'CMIP5_Amon'
    cmor.load_table(table)

    axis_ids = list()
    for axis in axes:
       axis_ids.append(cmor.axis(**axis))

    table = 'CMIP5_Amon'
    cmor.load_table(table)

    varid = cmor.variable('rlut',
                          'W m-2',
                          axis_ids,
                          history = 'variable history',
                          missing_value = -99,
                          positive = 'up'
                          )

    cmor.write(varid, values, time_vals = [15], time_bnds = [0, 30])

def version(cmor):
   return '%s.%s.%s' % (cmor.CMOR_VERSION_MAJOR,
                        cmor.CMOR_VERSION_MINOR,
                        cmor.CMOR_VERSION_PATCH)

def main():
    assert version(cmor) == '2.8.3'
    cmor_initialisation()
    values, axes = setup_data()
    cmor_define_and_write(values, axes)
    cmor.close()

if __name__ == '__main__':

    main()
@ghost ghost assigned doutriaux1 May 23, 2013
@doutriaux1
Copy link
Collaborator Author

@jkettleb I think this is fixed right?

@jkettleb
Copy link
Contributor

Hello Charles - from what I remember Karl said he thought CMOR should not deal with this kind of specification of the longitudes. But I can't remember all the details. I'm happy for you to close this and we can reopen as necessary.

Jamie

dnadeau4 pushed a commit that referenced this issue Feb 9, 2016
Modified tracking prefix check to match against const array in cmor.h
mauzey1 pushed a commit that referenced this issue Jul 26, 2019
Add test_cmor_append_associated_point to Makefile.in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants