Opened 9 years ago

Closed 9 years ago

#378 closed help (fixed)

Adding UKCA field codes to convsh

Reported by: kipling Owned by: jeff
Component: UM Tools Keywords:
Cc: Platform:
UM Version: 7.1

Description

I'm using convsh (v1.91) to convert output from UM 7.1 + UKCA-MODE to netCDF.

Although I've got the relevant user-STASHmaster files loaded for UKCA-MODE, and thus correct long_name attributes, convsh doesn't know about the new 18xx PP fieldcodes used — as a result, short names are not meaningful and the "units" attribute is not set correctly.

Is there a mechanism for providing convsh with information about the additional field codes?

Change History (5)

comment:1 Changed 9 years ago by jeff

  • Owner changed from um_support to jeff
  • Status changed from new to accepted

Hi

The only way to do it automatically is for me to put it into the source code and rebuild xconv/convsh. If you want to send me the new pp codes along with what you want the short names and units to be, then I can make sure they are in the next xconv release.

You can add these lines to your convsh script to change the shortname and units for each field, changing 18xx to the actual ppcode.

set id [lsearch -exact [get_shortname -1] field18xx]
set_shortname $id "newname"
set_unit $id "newunit"

Jeff.

comment:2 Changed 9 years ago by kipling

Thanks; however that seems to only fix the first instance of a given field code (e.g. it won't pick up what becomes field18xx_n). The following variation seems to do the trick:

proc map_field { field shortname unit } {

foreach id [lsearch -all -exact [get_shortname -1] $field] {

set_shortname $id $shortname
set_unit $id $unit

}

}

# UKCA-MODE fields, taken from an email from Colin Johnson
map_field "field1860" "vmr" "" ; # Volumetric Mixing Ratio
map_field "field1861" "mmr" "kg kg-1" ; # Mass Mixing Ratio
map_field "field1862" "pnd" "m-3" ; # Particle Number Density
map_field "field1863" "pndc" "cm-3" ; # Particle Number Density
map_field "field1864" "pad" "m2 m-3" ; # Particle Area Density
map_field "field1865" "mold" "mol m-3" ; # Molar Density
map_field "field1866" "molecd" "cm-3" ; # Molecular Density
map_field "field1867" "md" "kg m-3" ; # Mass Density
map_field "field1868" "molarity" "mol l-1" ; # Molarity
map_field "field1869" "molality" "mol kg-1" ; # Molality
map_field "field1870" "molecfluxd" "s-1 cm-3" ; # Molecular flux density
map_field "field1871" "molfluxd" "mol s-1 m-3" ; # Molar flux density
map_field "field1872" "mfluxd" "kg s-1 m-3" ; # Mass flux density
map_field "field1873" "pfluxd" "s-1 m-3" ; # Particle flux density
map_field "field1874" "molecflux" "s-1 cm-2" ; # Molecular surface flux
map_field "field1875" "molflux" "mol s-1 m-2" ; # Molar surface flux
map_field "field1876" "mflux" "kg s-1 m-2" ; # Mass surface flux
map_field "field1877" "pflux" "s-1 m-2" ; # Particle surface flux

I'm not sure this is a definitive or complete list yet, however (PP codes up to 1883 appear in the STASH files). The short names are my own choices, not necessarily standard ones.

comment:3 Changed 9 years ago by kipling

Oops, Trac mangled the above…

proc map_field { field shortname unit } {
    foreach id [lsearch -all -exact [get_shortname -1] $field] {
        set_shortname $id $shortname set_unit $id $unit
    }
}

# UKCA-MODE fields, taken from an email from Colin Johnson
map_field "field1860" "vmr" "" ; # Volumetric Mixing Ratio
map_field "field1861" "mmr" "kg kg-1" ; # Mass Mixing Ratio
map_field "field1862" "pnd" "m-3" ; # Particle Number Density
map_field "field1863" "pndc" "cm-3" ; # Particle Number Density
map_field "field1864" "pad" "m2 m-3" ; # Particle Area Density
map_field "field1865" "mold" "mol m-3" ; # Molar Density
map_field "field1866" "molecd" "cm-3" ; # Molecular Density
map_field "field1867" "md" "kg m-3" ; # Mass Density
map_field "field1868" "molarity" "mol l-1" ; # Molarity
map_field "field1869" "molality" "mol kg-1" ; # Molality
map_field "field1870" "molecfluxd" "s-1 cm-3" ; # Molecular flux density
map_field "field1871" "molfluxd" "mol s-1 m-3" ; # Molar flux density
map_field "field1872" "mfluxd" "kg s-1 m-3" ; # Mass flux density
map_field "field1873" "pfluxd" "s-1 m-3" ; # Particle flux density
map_field "field1874" "molecflux" "s-1 cm-2" ; # Molecular surface flux
map_field "field1875" "molflux" "mol s-1 m-2" ; # Molar surface flux
map_field "field1876" "mflux" "kg s-1 m-2" ; # Mass surface flux
map_field "field1877" "pflux" "s-1 m-2" ; # Particle surface flux

comment:4 Changed 9 years ago by jeff

I'll add these names/units to the next xconv release. Let me know if you have any more to add.

Jeff.

comment:5 Changed 9 years ago by jeff

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.