Closed taylor13 closed 5 years ago
@taylor13 Do you have this file?
cmor_dataset_json(‘CMOR_input_example.json’)
yes:
{
"source_type": "AOGCM AER BGC",
"#note": "CMIP6 valid experiment_ids are found in CMIP6_CV.json",
"experiment_id": "ssp245",
"activity_id": "ScenarioMIP",
"sub_experiment_id": "none",
"realization_index": "3",
"initialization_index": "1",
"physics_index": "1",
"forcing_index": "1",
"#note": "Text stored in attribute variant_info (recommended, not required description of run variant)",
"run_variant": "3rd realization",
"parent_experiment_id": "historical",
"parent_activity_id": "CMIP",
"parent_source_id": "PCMDI-test-1-0",
"parent_variant_label": "r3i1p1f1",
"parent_time_units": "days since 1850-01-01",
"branch_method": "standard",
"branch_time_in_child": 59400.0,
"branch_time_in_parent": 59400.0,
"#note": "institution_id must be registered at https://github.com/WCRP-CMIP/CMIP6_CVs/issues/new ",
"institution_id": "PCMDI",
"#note": "source_id (model name) must be registered at https://github.com/WCRP-CMIP/CMIP6_CVs/issues/new ",
"source_id": "PCMDI-test-1-0",
"calendar": "360_day",
"grid": "native atmosphere regular grid (3x4 latxlon)"
"grid_label": "gn",
"nominal_resolution": “10000 km",
"license": "CMIP6 model data produced by Lawrence Livermore PCMDI is licensed under a Creative Commons Attribution ShareAlike 4.0 International License (https://creativecommons.org/licenses). Consult https://pcmdi.llnl.gov/CMIP6/TermsOfUse for terms of use governing CMIP6 output, including citation requirements and proper acknowledgment. Further information about this data, including some limitations, can be found via the further_info_url (recorded as a global attribute in this file) and at https:///pcmdi.llnl.gov/. The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law."
"#output": "Root directory for output (can be either a relative or full path)“,
"outpath": "CMIP6",
"#note": " **** The following descriptors are optional and may be set to an empty string ",
"contact ": "Python Coder (coder@a.b.c.com)",
"history": "Output from archivcl_A1.nce/giccm_03_std_2xCO2_2256.",
"comment": "",
"references": "Model described by Koder and Tolkien (J. Geophys. Res., 2001, 576-591). Also see http://www.GICC.su/giccm/doc/index.html. The ssp245 simulation is described in Dorkey et al. '(Clim. Dyn., 2003, 323-357.)'",
"#note": " **** The following will be obtained from the CV and do not need to be defined here",
"sub_experiment": "",
"institution": "",
"source": "",
"#note": " **** The following are set correctly for CMIP6 and should not normally need editing",
"_control_vocabulary_file": "CMIP6_CV.json",
"_AXIS_ENTRY_FILE": "CMIP6_coordinate.json",
"_FORMULA_VAR_FILE": "CMIP6_formula_terms.json",
"_cmip6_option": "CMIP6",
"mip_era": "CMIP6",
"parent_mip_era": "CMIP6",
"tracking_prefix": "hdl:21.14100",
"_history_template": "%s ;rewrote data to be consistent with <activity_id> for variable <variable_id> found in table <table_id>.",
"#output_path_template": "Template for output path directory using tables keys or global attributes",
"output_path_template": "<mip_era><activity_id><institution_id><source_id><experiment_id><_member_id><table><variable_id><grid_label><version>",
"output_file_template": "<variable_id><table><source_id><experiment_id><_member_id><grid_label>",
}
@taylor13 @dnadeau4 since fortran is not handling exceptiin nicely for CMOR, I ported Karl's code to python.
I get seg fault, that traceback to the same point as fortran:
Process 89226 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000010c47f4c3 _cmor.so`cmor_CV_checkSourceID(CV=<unavailable>) at cmor_CV.c:651
648 if (strncmp(CV_source_id->key, szSource_ID, CMOR_MAX_STRING) == 0) {
649 // Make sure that "source" exist.
650 if (cmor_has_cur_dataset_attribute(GLOBAL_ATT_SOURCE) != 0) {
-> 651 cmor_set_cur_dataset_attribute_internal(GLOBAL_ATT_SOURCE,
652 CV_source_id->aszValue
653 [0], 1);
654 }
So I think something is wrong in your CV file.
I need to
I'm attaching the python file that creates the seg fault.
@taylor13 @dnadeau4 ok I tracxe this back to Karl's common_input having an empty string for source, that caused the seg fault. I will try to catch this in a nicer way.
@taylor13 I think it's here: https://cmor.llnl.gov/mydoc_cmor3_fortran/
@doutriaux1 Can we get this code working? Also, I think we should provide an similar sample analysis code written and C and another written in python.
maybe wednesday... not much time until then....
Please let me know if I can help with this.
I tried to run the Fortran code but I ran into an error with the time axis and mrsos. Here's the error from the log file.
!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Error: While creating variable mrsos, you are passing axis 3 (named time) which has been defined using table 0 (Amon) but the current table is 1 (Lmon) (and isgridaxis says: -1) ! !!!!!!!!!!!!!!!!!!!!!!!!!
I discovered this issue also with the latitude axis and longitude axis. I then made separate time, latitude, and longitude axes for both Amon and Lmon table variables. This made the code run to completion but I was not sure if it was the correct way to set it up.
Here's my branch with the Fortran test https://github.com/PCMDI/cmor/tree/344_new_sample_code_for_CMIP6
@mauzey1 Could you point me to the netCDF file created by this code? After I check it, we can close this issue. Also where is the source code? thanks.
@taylor13 https://github.com/PCMDI/cmor/blob/master/Test/CMIP6_sample_CMOR_driver.f90
This code generates NetCDF files for multiple variables. Attached is output folder for this code. CMIP6_sample_CMOR_driver_output.zip
@mauzey1 The output and code both look good to me.
We should put it on our "to do" list to allow users to define axes that can be used with multiple tables instead of having to define duplicate axes as in the present code. Do you agree? Not sure it's exactly high priority, but would be nice.
@taylor13 Yes, being able to use the same axes for different tables could help reduce code complexity.
@taylor13 @doutriaux1 The Fortran sample code has already been added to the test suite of CMOR. Should a C and Python version of this test still be added to the test suite?
@mauzey1 I would say no, the test wouldn't really be testing much except the python interface. A C code wouldn't be adding any test at all acually since Fortran calls C.
I think https://github.com/PCMDI/cmor/blob/master/Test/ipcc_test_code.c probably is the c version. If that works, then I think we're good. There are several python sample codes already, so I don't think adding another is necessary. I'll close this.
Here is a code that I think we should use (after debugging) to illustrate a Fortran implementation of CMOR for CMIP6. You already have the CMOR_input_example file that the fortran code needs as input.
I think a similar sample code should be developed for C coders and for python.