PCMDI / cmor

Climate Model Output Rewriter
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

bounds required on singleton lon and lat? #728

Closed gleckler1 closed 9 months ago

gleckler1 commented 9 months ago

@mauzey1 @durack1 @taylor13 @chengzhuzhang

We are trying to prototype using CMOR for DOE ARM site data, i.e., where lon and lat each have only a single value. Our understanding is that it is possible to do this without lon/lat bounds (which have no meaning in this case), but we are getting an error message when trying to send lon and lat values without bounds. Any hints on what we need to do to circumvent the need for lon and lat bounds? Many thanks, @gleckler1

! ! Error: axis: latitude (table: obs4MIPs_Amon) must have bounds, you did not pass any when creating it via cmor_axis !

code currently setup on gates:
/home/gleckler1/git/obs4MIPs-cmor-tables/inputs/DOE-ARM/ARMBE python -i runCMOR_ARMBE.py

taylor13 commented 9 months ago

I reviewed what we did for CFMIP "site" data (see https://github.com/PCMDI/cmip6-cmor-tables/blob/main/Tables/CMIP6_CFsubhr.json), and for that we didn't store the location. If you want to store the location, you'll have to add a new longitude and latitude dimension (you could name them "longitude1" and "latitude1", for example) in the coordinate.json file (see https://github.com/PCMDI/cmip6-cmor-tables/blob/main/Tables/CMIP6_coordinate.json),. The only difference between longitude1 and the original longitude coordinate is its name and the key "must_have_bounds" value should be set to "no". That is:

            "longitude1": {                         ********************************
            "standard_name": "longitude", 
            "units": "degrees_east", 
            "axis": "X", 
            "long_name": "Longitude", 
            "climatology": "", 
            "formula": "", 
            "must_have_bounds": "no",    *********************************
            "out_name": "lon", 
            "positive": "", 
            "requested": "", 
            "requested_bounds": "", 
            "stored_direction": "increasing", 
            "tolerance": "", 
            "type": "double", 
            "valid_max": "360.0", 
            "valid_min": "0.0", 
            "value": "", 
            "z_bounds_factors": "", 
            "z_factors": "", 
            "bounds_values": "", 
            "generic_level_name": ""
        }, 

For each "site" variable, you'll have to define in a cmor table the variable, and it will have the dimensions longitude1 and latitude1 included.

For example for surface latent heat flux at a site define:

        "hfls": {
            "frequency": "subhrPt", 
            "modeling_realm": "atmos", 
            "standard_name": "surface_upward_latent_heat_flux", 
            "units": "W m-2", 
            "cell_methods": "area: point time: point", 
            "cell_measures": "", 
            "long_name": "Surface Upward Latent Heat Flux", 
            "comment": "whatever you want to say", 
            "dimensions": "longitude1 latitude1 time1",  ***********************
            "out_name": "hfls", 
            "type": "real", 
            "positive": "up", 
            "valid_min": "", 
            "valid_max": "", 
            "ok_min_mean_abs": "", 
            "ok_max_mean_abs": ""
        }, 

If it's a time-mean, the time coordinate should be "time" not "time1". Also, if you want to include the name of the site, there's probably a way to add a scalar dimension with "labels" associated with an index value. But why don't you try the above first. I'm not positive CMOR will be able to handle a single lat/lon, but I'm pretty sure it can. Let me know if you want me to look at your new variable and coordinate entries before trying to run CMOR.

chengzhuzhang commented 9 months ago

@taylor13 thank you for the pointers! I'm trying to update the obs4mips tables according your instruction. I have updated the coordinate entries, but not sure how to add new variables. In the ARM BE case, the variables are all in hourly frequency. It seems that I need to define a new obs4mips table for adding ARM BE variables. I can follow the example of /CMIP6_CFsubhr.json, but I suppose I need to "register" the new table to obs4mip? Does it make sense to name a new file with obs4MIPs_CFsubhr.json or something different? maybe this is a question to @gleckler1 ?

gleckler1 commented 9 months ago

@chengzhuzhang @taylor13 ... I was trying to include the CFsubhr json yesterday, still having some difficulties getting it working. Gates is down today. I'll get back to you when it's back up.

chengzhuzhang commented 9 months ago

@gleckler1 thanks for the updates! I think I need to understand the inner workings of using the Tables. Thanks for working on this! Guess I will learn more from your code changes in this case...

gleckler1 commented 9 months ago

@chengzhuzhang Yes, we need to get the CMOR working first, after that it will get more interesting.