diff --git a/e3sm_to_cmip/lib.py b/e3sm_to_cmip/lib.py index 7c720fa3..1e6569a5 100644 --- a/e3sm_to_cmip/lib.py +++ b/e3sm_to_cmip/lib.py @@ -526,6 +526,7 @@ def handle_variables( ) data.update(new_data) get_dims = False + print_message(new_data.keys(),"debug") if simple and not loaded_one: loaded_one = True @@ -539,8 +540,10 @@ def handle_variables( if "lev" in new_data.keys(): dims = (timename, "lev", "lat", "lon") - elif "plev" in new_data.keys(): + elif "plev" in new_data.keys() and "lon" in new_data.keys(): dims = (timename, "plev", "lat", "lon") + else: + dims = (timename, "plev", "lat") ds[outvar_name] = (dims, new_data[var_name]) for d in dims: ds.coords[d] = new_data[d][:] @@ -651,15 +654,24 @@ def get_dimension_data(filename, variable, levels=None, get_dims=False): # load the lon and lat and time info & bounds if get_dims: - data.update( - { - "lat": ds["lat"], - "lon": ds["lon"], - "lat_bnds": ds["lat_bnds"], - "lon_bnds": ds["lon_bnds"], - "time": ds["time"], - } - ) + try: + data.update( + { + "lat": ds["lat"], + "lon": ds["lon"], + "lat_bnds": ds["lat_bnds"], + "lon_bnds": ds["lon_bnds"], + "time": ds["time"], + } + ) + except: + data.update( + { + "lat": ds["lat"], + "lat_bnds": ds["lat_bnds"], + "time": ds["time"], + } + ) try: time2 = ds["time2"] except KeyError: @@ -752,19 +764,21 @@ def load_axis(data, levels=None, has_time=True): lev = cmor.axis(name, units=units, coord_vals=coord_vals) # add lon/lat - lat = cmor.axis( - "latitude", - units=data["lat"].units, - coord_vals=data["lat"].values, - cell_bounds=data["lat_bnds"].values, - ) + if data["lat"]: + lat = cmor.axis( + "latitude", + units=data["lat"].units, + coord_vals=data["lat"].values, + cell_bounds=data["lat_bnds"].values, + ) - lon = cmor.axis( - "longitude", - units=data["lon"].units, - coord_vals=data["lon"].values, - cell_bounds=data["lon_bnds"].values, - ) + if data["lon"]: + lon = cmor.axis( + "longitude", + units=data["lon"].units, + coord_vals=data["lon"].values, + cell_bounds=data["lon_bnds"].values, + ) if levels and time is not None: axes = [time, lev, lat, lon] diff --git a/e3sm_to_cmip/resources/qboi_template.json b/e3sm_to_cmip/resources/qboi_template.json new file mode 100644 index 00000000..5b66d7ff --- /dev/null +++ b/e3sm_to_cmip/resources/qboi_template.json @@ -0,0 +1,85 @@ +{ + "_control_vocabulary_file": "CMIP6_CV.json", + + "_AXIS_ENTRY_FILE": "CMIP6_coordinate.json", + + "_FORMULA_VAR_FILE": "CMIP6_formula_terms.json", + + "_cmip6_option": "CMIP6", + + "tracking_prefix": "hdl:21.14100", + + "activity_id": "CMIP", + + "outpath": "CMIP6", + + "experiment_id": "piControl", + + "sub_experiment_id": "none", + + "sub_experiment": "none", + + "source_type": "AOGCM AER", + + "mip_era": "CMIP6", + + "calendar": "noleap", + + "realization_index": "1", + + "initialization_index": "1", + + "physics_index": "1", + + "forcing_index": "1", + + "project PI": "Dave Bader (bader2@llnl.gov)", + + "data contact": "E3SM-DATA-SUPPORT@LISTSERV.LLNL.GOV", + + "history": "Output from 20180129.DECKv1b_piControl.ne30_oEC.edison", + + "comment": "", + + "references": "Golaz, J.-C., L. P. Van Roekel, X. Zheng and co-authors, 2022: The DOE E3SM Model Version 2: Overview of the physical model and initial model evaluation. JAMES, doi: 10.1029/2022MS003156; http://e3sm.org", + + "grid": "gs1x1", + + "grid_label": "gr", + + "nominal_resolution": "100 km", + + "institution_id": "E3SM-Project", + + "branch_time_in_parent": "0.0D0", + + "branch_time_in_child": "0.0D0", + + "parent_experiment_id": "piControl-spinup", + + "parent_activity_id": "CMIP", + + "parent_mip_era": "CMIP6", + + "parent_source_id": "E3SM-1-0", + + "parent_time_units": "days since 0001-01-01", + + "parent_variant_label": "r1i1p1f1", + + "branch_method": "Spin-up documentation", + + "run_variant": "", + + "source_id": "E3SM-1-0", + + "source": "E3SM 1.0 (2018)", + + "_history_template": "%s ;rewrote data to be consistent with for variable found in table .", + + "output_path_template": "<_member_id>", + + "output_file_template": "
<_member_id>", + + "license": "CMIP6 model data produced by E3SM-Project is licensed under a Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/). 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." +} diff --git a/e3sm_to_cmip/util.py b/e3sm_to_cmip/util.py index c07edb89..7f3e0cc3 100644 --- a/e3sm_to_cmip/util.py +++ b/e3sm_to_cmip/util.py @@ -35,6 +35,12 @@ "CMIP6_CF3hr.json", "CMIP6_CFday.json", "CMIP6_fx.json", + "QBOi_monZ.json", + "QBOi_mon.json", + "QBOi_dayZ.json", + "QBOi_day.json", + "QBOi_6hrPt.json", + "QBOi_3hr.json", ] LAND_TABLES = ["CMIP6_Lmon.json", "CMIP6_LImon.json"]