Metview's documentation is now on readthedocs!

Download source and data


Tephigram from BUFR Example
#Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************
#

# read BUFR data        
b = read("temp.bufr")

# extract thermo profile for a given station
prof = thermo_bufr(
    data        : b,
    station : stations(
           search_key : "ident",
           ident      : 96481
          )		
    )
 
# visual definition for t and td profile
vis = mthermo(
    thermo_temperature_line_colour         : "purplish_red",
    thermo_temperature_line_thickness      : 6,
    thermo_temperature_missing_data_colour : "purplish_red",
    thermo_temperature_missing_data_thickness : 6,
    thermo_dewpoint_line_colour            : "purplish_red",
    thermo_dewpoint_line_thickness         : 6,
    thermo_dewpoint_missing_data_colour    : "purplish_red",
    thermo_dewpoint_missing_data_thickness : 6
    ) 
 
# define the thermodynamic view
view = thermoview( type : "tephigram",
                   minimum_temperature : -120,
                   maximum_temperature : 35,
                   top_pressure: 100                  
                   )   
  
# define the output plot file
setoutput(pdf_output(output_name : 'tephigram_bufr'))    
  
# plot the profile   
plot(view, prof, vis)   

Tephigram from BUFR Example
#  **************************** LICENSE START ***********************************
# 
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************
#

import metview as mv

# read BUFR data        
b = mv.read("temp.bufr")

# extract thermo profile for a given station
prof = mv.thermo_bufr( 
    data        = b,
    station = mv.stations(
           search_key = "ident",
           ident      = 96481
          )		
    )

# define the thermodynamic view
view = mv.thermoview( 
       type = "tephigram",
       minimum_temperature = -120,
       maximum_temperature = 35,
       top_pressure = 100     
     )   
 
# visual definition for t and td profile
vis = mv.mthermo(
    thermo_temperature_line_colour         = "purplish_red",
    thermo_temperature_line_thickness      = 6,
    thermo_temperature_missing_data_colour = "purplish_red",
    thermo_temperature_missing_data_thickness = 6,
    thermo_dewpoint_line_colour            = "purplish_red",
    thermo_dewpoint_line_thickness         = 6,
    thermo_dewpoint_missing_data_colour    = "purplish_red",
    thermo_dewpoint_missing_data_thickness = 6
    )  
  
# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'tephigram_bufr'))    
  
# plot the profile   
mv.plot(view, prof, vis)