Closed lizziel closed 3 years ago
@bena-nasa Following our discussion last week I tried adding each of these to HISTORY.rc, specifying gridcomp 'GOCART': 'AEROSOLS%MSA' 'AERO%AEROSOLS%MSA' 'AERO%MSA' 'MSA' 'AERO'
All of these combinations failed with MAPL_StateGet errors in History. Do you know for certain that export bundle fields can be output via MAPL History?
Lizzie, First, we never add states to state like that in the addexport, importspec. If you add the spec like you do in the example I'm sure it will not work.
In SetServices you create the bundle in the export state like this:
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'AERO', &
LONG_NAME = 'aerosol_mass_mixing_ratios', &
UNITS = 'kg kg-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
DATATYPE = MAPL_BundleItem, __RC__)
Then in the component declaring this after generic intialize has run you can retrieve the bundle from the state.
call ESMF_StateGet(EXPORT, 'AERO', AERO, RC=STATUS); VERIFY_(STATUS)
At that point you can add fields to it with the appropriate MAPL or ESMF call like MAPL_FieldBundleAdd
Like I said, if those fields are not created the way History expects, (i.e. the way they are created by the AddExport/Import/InternalSpec call which adds multiple attributes to the field such as units, long_name, and dimensionality information) it will have problems. Most of the time we are adding fields to bundles with all this friendly business so it is usually pulling them from other components.
The bundle retrieval definitely works. Our chemistry people have been using.
@bena-nasa My example code is cut and pasted from GOCART in a fairly recent version of GEOSgcm. I did not edit it beyond omitting non-relevant lines of code. It seems to work okay for exporting the aerosol bundle from GOCART to Radiation since it has been in place for a while. I believe Elliot Sherman is working to rewrite GOCART to clean up the code. Perhaps this is an area that could be made more standard?
I am going to close this issue since it is no longer a problem for me. I am getting the array values I want to History via other means.
I have a general MAPL history question. I have code below that creates an ‘MSA’ field in the ‘AEROSOLS’ bundle within the ‘AERO’ export.
In SetServices:
In Initialize:
My question is how do I output the ‘MSA’ field via History? Is there syntax for specifying export/bundle/field? I realize perhaps outputting the internal state here is a better option, but I would like to know how to get at the AERO export contents directly.