Changeset 876 for TI01-discovery/trunk


Ignore:
Timestamp:
03/05/06 17:40:57 (14 years ago)
Author:
lawrence
Message:

Update the NumSim example to conform with the current schema.
Python code for a kludgy html representation of some aspects of the
NumSim instances.

Location:
TI01-discovery/trunk/schema/numsim
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/trunk/schema/numsim/HADCM3 PUM 4.5 Beowulf.xml

    r695 r876  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <NS_Simulated xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    3     xsi:noNamespaceSchemaLocation="http://ndg.nerc.ac.uk/schema/NumSim006.xsd"> 
     2<NS_Simulated xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" 
     3    xsi:noNamespaceSchemaLocation="NumSim.xsd"> 
    44    <!-- Note that this is a handcoded example XML file which should not be regarded as 
    55    authoratative about the COAPEC 500 year run, Bryan Lawrence, September 2005 --> 
     
    1212        <NS_Name>HadCM3 PUM V4.5 COAPEC Beowulf</NS_Name> 
    1313        <NS_Category>GCM</NS_Category> 
    14         <NS_RelatedModel> 
    15             <NS_URI>http://www.met-office.gov.uk/research/hadleycentre/models/HadCM3.html</NS_URI> 
    16                 <NS_Relationship>This version was slightly modified from the Met Office Cray version to run 
    17                 in the beowulf environment and is V4.5 (cf V4.4 for the original HadCM3). Amongst 
    18                 the key physics differences:In the atmosphere: updated spectral coefficients for 
    19                 longwave radiation, a 3-dimensional CO field, and an accurate treatment of 
     14        <NS_RelatedModel 
     15            xlink:href="http://www.met-office.gov.uk/research/hadleycentre/models/HadCM3.html" 
     16            xlink:title="HadCM3"> 
     17            <NS_Relationship>This version was slightly modified from the Met Office Cray version to 
     18                run in the beowulf environment and is V4.5 (cf V4.4 for the original HadCM3). 
     19                Amongst the key physics differences:In the atmosphere: updated spectral coefficients 
     20                for longwave radiation, a 3-dimensional CO field, and an accurate treatment of 
    2021                precipitation phase change; in the ocean, the Griffies isopycnal diffusion scheme 
    2122                replacing the older Redi scheme, and a new parameterisation of Mediterranean and 
    2223                Hudson bay outflow.See also Lawrence and Iwi for other subtle differences. 
    23                 </NS_Relationship> 
     24            </NS_Relationship> 
    2425        </NS_RelatedModel> 
    2526        <NS_References> 
    26             <NS_Reference>Iwi and Lawrence (2004). A comparison between HadCM3 integrations for COAPEC 
    27                 using Beowulf (UM version 4.5) and Cray T3E (UM version 4.4) 
     27            <NS_Reference>Iwi and Lawrence (2004). A comparison between HadCM3 integrations for 
     28                COAPEC using Beowulf (UM version 4.5) and Cray T3E (UM version 4.4) 
    2829                http://home.badc.rl.ac.uk/iwi/um/downloads/comparison.pdf</NS_Reference> 
    29                 <NS_Reference>Gordon, C., C. Cooper, C.A. Senior, H. Banks, J.M. Gregory, T.C. Johns, 
     30            <NS_Reference>Gordon, C., C. Cooper, C.A. Senior, H. Banks, J.M. Gregory, T.C. Johns, 
    3031                J.F.B. Mitchell and R.A. Wood, 2000: The simulation of SST, sea ice extents and 
    3132                ocean heat transports in a version of the Hadley Centre coupled model without flux 
     
    3637            <NS_ComponentType>Atmosphere</NS_ComponentType> 
    3738            <NS_Description>The atmospheric component of HadCM3 has 19 levels with a horizontal 
    38                 resolution of 2.5° of latitude by 3.75° of longitude, which produces a global grid 
     39                resolution of 2.5 degrees of latitude by 3.75 degrees of longitude, which produces a global grid 
    3940                of 96 x 73 grid cells. This is equivalent to a surface resolution of about 417 km x 
    40                 278 km at the Equator, reducing to 295 km x 278 km at 45° of latitude (comparable to 
     41                278 km at the Equator, reducing to 295 km x 278 km at 45 degrees of latitude (comparable to 
    4142                a spectral resolution of T42).Note that while the atmospheric component of the model 
    4243                also optionally allows the emission, transport, oxidation and deposition of sulphur 
     
    4546                aerosols to be modelled given scenarios for sulphur emissions and oxidants, this 
    4647                option was not used in this integration.</NS_Description> 
    47             <NS_RelatedModel> 
    48                 <NS_URI>Need a URI to "official" HADAM3</NS_URI> 
     48            <NS_RelatedModel xlink:href="unknown" xlink:title="Need a URI to 'official' HADAM3"> 
    4949                <NS_Relationship>Portable Version</NS_Relationship> 
    5050            </NS_RelatedModel> 
    5151            <NS_References> 
    52                 <NS_Reference>Pope, V. D., M. L. Gallani, P. R. Rowntree and R. A. Stratton, 2000: The 
    53                     impact of new physical parametrizations in the Hadley Centre climate model -- 
    54                     HadAM3. Climate Dynamics, 16: 123-146. </NS_Reference> 
     52                <NS_Reference>Pope, V. D., M. L. Gallani, P. R. Rowntree and R. A. Stratton, 2000: 
     53                    The impact of new physical parametrizations in the Hadley Centre climate model 
     54                    -- HadAM3. Climate Dynamics, 16: 123-146. </NS_Reference> 
    5555            </NS_References> 
    5656            <NS_Component> 
     
    6565                        radiation code. I: Choosing a configuration for a large scale model. Quart. 
    6666                        J. Roy. Meteor. Soc. 122: 689-719. </NS_Reference> 
    67                     <NS_Reference>Cusack S., A. Slingo, J.M. Edwards, and M. Wild, 1998: The radiative 
    68                         impact of a simple aerosol climatology on the Hadley Centre GCM. Quart. J. 
    69                         Roy. Meteor. Soc. 124: 2517-2526. </NS_Reference> 
     67                    <NS_Reference>Cusack S., A. Slingo, J.M. Edwards, and M. Wild, 1998: The 
     68                        radiative impact of a simple aerosol climatology on the Hadley Centre GCM. 
     69                        Quart. J. Roy. Meteor. Soc. 124: 2517-2526. </NS_Reference> 
    7070                </NS_References> 
    7171            </NS_Component> 
     
    7373                <NS_Name>Land Surface Scheme</NS_Name> 
    7474                <NS_ComponentType>LandSurface</NS_ComponentType> 
    75                 <NS_Description>Includes a representation of the freezing and melting of soil moisture, 
    76                     as well as surface runoff and soil drainage; the formulation of evaporation 
    77                     includes the dependence of stomatal resistance on temperature, vapour pressure 
    78                     and CO2 concentration. The surface albedo is a function of snow depth, 
    79                     vegetation type and also of temperature over snow and ice.</NS_Description> 
    80                 <NS_References> 
    81                     <NS_Reference>Cox, P., R. Betts, C. Bunton, R. Essery, P.R. Rowntree, and J. Smith, 
    82                         1999: The impact of new land surface physics on the GCM simulation of 
    83                         climate and climate sensitivity. Climate Dynamics 15: 183-203. </NS_Reference> 
     75                <NS_Description>Includes a representation of the freezing and melting of soil 
     76                    moisture, as well as surface runoff and soil drainage; the formulation of 
     77                    evaporation includes the dependence of stomatal resistance on temperature, 
     78                    vapour pressure and CO2 concentration. The surface albedo is a function of snow 
     79                    depth, vegetation type and also of temperature over snow and ice.</NS_Description> 
     80                <NS_References> 
     81                    <NS_Reference>Cox, P., R. Betts, C. Bunton, R. Essery, P.R. Rowntree, and J. 
     82                        Smith, 1999: The impact of new land surface physics on the GCM simulation of 
     83                        climate and climate sensitivity. Climate Dynamics 15: 183-203. 
     84                    </NS_Reference> 
    8485                </NS_References> 
    8586            </NS_Component> 
     
    9293                    <NS_Reference>Gregory, D., R. Kershaw and P.M. Inness, 1997: Parametrization of 
    9394                        momentum transport by convection. II: tests in single column and general 
    94                         circulation models. Quart. J. Roy. Meteor. Soc. 123: 1153-1183. </NS_Reference> 
     95                        circulation models. Quart. J. Roy. Meteor. Soc. 123: 1153-1183. 
     96                    </NS_Reference> 
    9597                </NS_References> 
    9698            </NS_Component> 
     
    103105                        sub-grid scale orographic forcing on systematic errors in a global NWP 
    104106                        model. Mon. Weath. Rev. 124: 2023-2045. </NS_Reference> 
    105                     <NS_Reference>Gregory, D., G.J. Shutts and J.R. Mitchell, 1998: A new gravity wave 
    106                         drag scheme incorporating anisotropic orography and low level wave breaking: 
    107                         Impact upon the climate of the UK Meteorological Office Unified Model. 
    108                         Quart. J. Roy. Meteor. Soc. 124: 463-493. </NS_Reference> 
     107                    <NS_Reference>Gregory, D., G.J. Shutts and J.R. Mitchell, 1998: A new gravity 
     108                        wave drag scheme incorporating anisotropic orography and low level wave 
     109                        breaking: Impact upon the climate of the UK Meteorological Office Unified 
     110                        Model. Quart. J. Roy. Meteor. Soc. 124: 463-493. </NS_Reference> 
    109111                </NS_References> 
    110112            </NS_Component> 
    111113            <NS_Component> 
    112114                <NS_Name>Precip and Cloud Scheme</NS_Name> 
    113                 <NS_Description> The large-scale precipitation and cloud scheme is formulated in terms 
    114                     of an explicit cloud water variable following Smith (1990). The effective radius 
    115                     of cloud droplets is a function of cloud water content and droplet number 
     115                <NS_Description> The large-scale precipitation and cloud scheme is formulated in 
     116                    terms of an explicit cloud water variable following Smith (1990). The effective 
     117                    radius of cloud droplets is a function of cloud water content and droplet number 
    116118                    concentration (Martin et al 1994). Note that this version of the code may differ 
    117119                    slightly from those described in these references (Lawrence and Iwi, 2004). </NS_Description> 
     
    123125                        parametrization of effective radius of droplets in warm stratocumulus 
    124126                        clouds. J. Atmos. Sci. 51: 1823-1842. </NS_Reference> 
    125                     <NS_Reference>Iwi and Lawrence (2004). A comparison between HadCM3 integrations for 
    126                         COAPEC using Beowulf (UM version 4.5) and Cray T3E (UM version 4.4) 
     127                    <NS_Reference>Iwi and Lawrence (2004). A comparison between HadCM3 integrations 
     128                        for COAPEC using Beowulf (UM version 4.5) and Cray T3E (UM version 4.4) 
    127129                        http://home.badc.rl.ac.uk/iwi/um/downloads/comparison.pdf</NS_Reference> 
    128130                </NS_References> 
     
    132134            <NS_Name>Ocean</NS_Name> 
    133135            <NS_ComponentType>Ocean</NS_ComponentType> 
    134             <NS_Description>The oceanic component of HadCM3 has 20 levels with a horizontal resolution 
    135                 of 1.25 x 1.25°. At this resolution it is possible to represent important details in 
    136                 oceanic current structures. Horizontal mixing of tracers uses a version of the Gent 
    137                 and McWilliams (1990) adiabatic diffusion scheme with a variable thickness 
    138                 diffusivity (Wright 1997; Visbeck et al. 1997) is used. There is no explicit 
    139                 horizontal diffusion of tracers. The along-isopycnal diffusivity of tracers is 1000 
    140                 m2 s-1 and horizontal momentum viscosity varies with latitude between 3000 and 6000 
    141                 m2 s-1 at the poles and equator respectively. Near-surface vertical mixing is 
    142                 parametrized partly by a Kraus-Turner mixed layer scheme for tracers (Kraus and 
     136            <NS_Description>The oceanic component of HadCM3 has 20 levels with a horizontal 
     137                resolution of 1.25 x 1.25 degrees. At this resolution it is possible to represent important 
     138                details in oceanic current structures. Horizontal mixing of tracers uses a version 
     139                of the Gent and McWilliams (1990) adiabatic diffusion scheme with a variable 
     140                thickness diffusivity (Wright 1997; Visbeck et al. 1997) is used. There is no 
     141                explicit horizontal diffusion of tracers. The along-isopycnal diffusivity of tracers 
     142                is 1000 m2 s-1 and horizontal momentum viscosity varies with latitude between 3000 
     143                and 6000 m2 s-1 at the poles and equator respectively. Near-surface vertical mixing 
     144                is parametrized partly by a Kraus-Turner mixed layer scheme for tracers (Kraus and 
    143145                Turner 1967), and a K-theory scheme (Pacanowski and Philander 1981) for momentum. 
    144146                Below the upper layers the vertical diffusivity is an increasing function of depth 
     
    172174                    specification of eddy transfer coefficients in coarse resolution ocean 
    173175                    circulation models. J. Phys. Oceanogr. 27: 381-402. </NS_Reference> 
    174                 <NS_Reference>Wright, D.K., 1997: A new eddy mixing parametrization and ocean general 
    175                     circulation model. International WOCE newsletter, 26: 27-29. </NS_Reference> 
     176                <NS_Reference>Wright, D.K., 1997: A new eddy mixing parametrization and ocean 
     177                    general circulation model. International WOCE newsletter, 26: 27-29. 
     178                </NS_Reference> 
    176179            </NS_References> 
    177180        </NS_Component> 
     
    179182            <NS_Name>Sea Ice</NS_Name> 
    180183            <NS_ComponentType>Cryosphere</NS_ComponentType> 
    181             <NS_Description> The sea ice model uses a simple thermodynamic scheme including leads and 
    182                 snow-cover. Ice is advected by the surface ocean current, with convergence prevented 
    183                 when the depth exceeds 4 m.There is no explicit representation of iceberg calving, 
    184                 so a prescribed water flux is returned to the ocean at a rate calibrated to balance 
    185                 the net snowfall accumulation on the ice sheets, geographically distributed within 
    186                 regions where icebergs are found.</NS_Description> 
     184            <NS_Description> The sea ice model uses a simple thermodynamic scheme including leads 
     185                and snow-cover. Ice is advected by the surface ocean current, with convergence 
     186                prevented when the depth exceeds 4 m.There is no explicit representation of iceberg 
     187                calving, so a prescribed water flux is returned to the ocean at a rate calibrated to 
     188                balance the net snowfall accumulation on the ice sheets, geographically distributed 
     189                within regions where icebergs are found.</NS_Description> 
    187190            <NS_References> 
    188                 <NS_Reference>Cattle, H. and J. Crossley, 1995: Modelling Arctic climate change. Phil 
    189                     Trans R Soc London A352: 201-213. </NS_Reference> 
     191                <NS_Reference>Cattle, H. and J. Crossley, 1995: Modelling Arctic climate change. 
     192                    Phil Trans R Soc London A352: 201-213. </NS_Reference> 
    190193            </NS_References> 
    191194        </NS_Component> 
     
    193196            <NS_Name>Atmos-Ocean Coupler</NS_Name> 
    194197            <NS_ComponentType>Coupler</NS_ComponentType> 
    195             <NS_Description>The atmosphere and ocean exchange information once per day. Heat and water 
    196                 fluxes are conserved exactly in the transfer between their different grids. 
     198            <NS_Description>The atmosphere and ocean exchange information once per day. Heat and 
     199                water fluxes are conserved exactly in the transfer between their different grids. 
    197200            </NS_Description> 
    198201        </NS_Component> 
  • TI01-discovery/trunk/schema/numsim/NumSim.xsd

    r736 r876  
    179179    </xs:simpleType> 
    180180    <xs:complexType name="NS_InitialCondition" mixed="false"> 
     181        <xs:annotation><xs:documentation> 
     182            Multiple initial condition elements can appear to cover how different parts of the model system were initialized.   
     183            If present, the main requirement is that the initial condition be described in the description element and those  
     184            parameters which are controlled by the initial condition be identified if possible.   
     185            Failing a description (or as well as) the type attribute can identify the sort of initial condition from the  
     186            InitialConditionTypes controlled vocabulary.</xs:documentation><xs:documentation> 
     187            Where the initial condition is in fact a perturbed version of the “real” values for the starting time  
     188            (perhaps as part of an ensemble), the perturbed Boolean attribute can be set true (the default is false).  
     189            Where the perturbation is physically meaningful (for example, using singular vectors), this can be indicated  
     190            in the description. 
     191        </xs:documentation></xs:annotation> 
    181192        <xs:sequence> 
    182193            <xs:element name="NS_Description" type="NS_Description" minOccurs="0" maxOccurs="1"/> 
  • TI01-discovery/trunk/schema/numsim/NumSim2Html.py

    r711 r876  
    55#  See useful ideas at http://effbot.org/zone/element-iterparse.htm#plist 
    66 
    7 class ElementWrapper: 
     7class WrapGetText: 
    88        '''Return the character text tab from any subelement (returns None for 
    99        missing attributes/subelements unless they begin with __).''' 
     
    1515            return self._element.findtext(tag) 
    1616             
    17 def hyperlink(target,name): 
    18         return '<a href="%s">%s</a>'%(target,name) 
    19  
    20 unmarshallers = { 
    21         # simple HTML 
    22         "anyURI": lambda x: hyperlink(x) 
    23              
    24              
    25  
    26  
    27 def RelatedTo(element,linkName='hyperlink',title=False): 
    28         '''Return html for a hyperlink to a related URI''' 
    29         s='' 
    30         link=element.find('NS_URI').text 
    31         linkHTML=hyperlink(link,linkName) 
    32         if title: s+='<b>%s</b>:'%linkHTML 
    33         s+=element.find('NS_Relationship').text 
    34         if not title:s+='(%s)'%linkHTML 
     17def hyperlink(e): 
     18        ''' Takes an element object which has an NS_link attribute 
     19        set and returns a hyperlink''' 
     20        href='{http://www.w3.org/1999/xlink}href' 
     21        title='{http://www.w3.org/1999/xlink}title' 
     22        try: 
     23                s='<a href="%s">%s</a>'%(e.attrib.get(href),e.attrib.get(title)) 
     24        except: 
     25                s='' 
    3526        return s 
    3627 
     28def References(e): 
     29        ''' Takes a reference list and formats it (currently doesn't support ISO option)''' 
     30        if e is None: return '' 
     31        s='<DIV id="RefList"><p>References:<ul>' 
     32        for item in e.findall('NS_Reference'): 
     33                s+='<li>%s</li>'%item.text 
     34        s+='</ul></p></DIV>' 
     35        return s 
     36         
     37 
     38def RelatedModel(e): 
     39        '''Return html for a related model''' 
     40        if e is None: return '' 
     41        r=e.find('NS_Relationship') 
     42        s='<p><b>%s</b>: %s'%(e.tag[3:],hyperlink(e)) 
     43        if r is not None: 
     44                s+='<br/>'+r.text 
     45        s+='</p>' 
     46        return s 
     47         
    3748def Description(element): 
    3849        '''Takes a description element and formats it appropriately''' 
    3950        # note that there may be between zero and many related URIs 
    40         related=element.getiterator('NS_RelatedURI') 
     51        if element is None: return '' 
     52        related=element.findall('NS_RelatedURI') 
    4153        s='<p>'+element.text 
    42         if len(related)>0: links=True 
    43         if links: s+='<br/>Related Links<ul>' 
    44         for uri in related: 
    45                 s+='<li>'+RelatedTo(uri)+'</li>' 
    46         if links: s+='</ul>' 
    47         s='</p>' 
     54        if len(related)>0:  
     55                links=True 
     56                s+='<ul>' 
     57                for uri in related: 
     58                        s+='<li>'+RelatedTo(uri)+'</li>' 
     59                s+='</ul>' 
     60        s+='</p>' 
     61        return s 
    4862         
    49 def main(): 
    50         xml=''' <NS_RelatedModel> 
    51             <NS_URI>http://www.met-office.gov.uk/research/hadleycentre/models/HadCM3.html</NS_URI> 
    52             <NS_Relationship>This version was slightly modified from the Met Office Cray version to 
    53                 run in the beowulf environment and is V4.5 (cf V4.4 for the original HadCM3). 
    54                 Amongst the key physics differences:In the atmosphere: updated spectral coefficients 
    55                 for longwave radiation, a 3-dimensional CO field, and an accurate treatment of 
    56                 precipitation phase change; in the ocean, the Griffies isopycnal diffusion scheme 
    57                 replacing the older Redi scheme, and a new parameterisation of Mediterranean and 
    58                 Hudson bay outflow.See also Lawrence and Iwi for other subtle differences. 
    59             </NS_Relationship> 
    60         </NS_RelatedModel>''' 
    61         elem=ET.fromstring(xml) 
    62         print RelatedTo(elem,linkName='Related Model',title=True) 
     63def Model(e): 
     64        ''' Parse a model element ''' 
     65        html='' 
     66        if e is None: return html 
     67        html='<DIV id="NumSimCom"><table border="1"><tbody>' 
     68        html+='<tr><td colspan="2">%s</td></tr>'%e.find('NS_Name').text 
     69        html+='<tr><td colspan="2">%s</td></tr>'%Description(e.find('NS_Description')) 
     70        html+='<tr><td colspan="2">%s</td></tr>'%References(e.find('NS_References')) 
     71        html+='<tr><td colspan="2">%s</td></tr>'%RelatedModel(e.find('NS_RelatedModel')) 
     72        for item in e.findall('NS_Component'): 
     73                html+='<tr><td>%s</td><td>%s</td></tr>'%( 
     74                            item.find('NS_Name').text,Model(item)) 
     75        html+='</tbody></table></DIV>' 
     76        return html 
    6377         
    64 main() 
     78def Simulated(element): 
     79        html='<h2>Simulated Data</h2>' 
     80        html+=Description(element.find('NS_Description')) 
     81        html+='<h4>%s</h4>'%element.find('NS_Model/NS_Name').text 
     82        html+=Model(element.find('NS_Model')) 
     83        return html 
     84         
     85if __name__=="__main__": 
     86        x=ET.parse('HADCM3 PUM 4.5 Beowulf.xml').getroot() 
     87        html=Simulated(x) 
     88        print html 
Note: See TracChangeset for help on using the changeset viewer.