File Formats

These classes provide support for reading data from specific formats.

NEXRAD

class metpy.io.nexrad.Level2File(filename)

A class that handles reading the NEXRAD Level 2 data and the various messages that are contained within.

This class attempts to decode every byte that is in a given data file. It supports both external compression, as well as the internal BZ2 compression that is used.

stid

str – The ID of the radar station

dt

Datetime instance – The date and time of the data

vol_hdr

namedtuple – The unpacked volume header

sweeps

list of tuples – Data for each of the sweeps found in the file

rda_status

namedtuple, optional – Unpacked RDA status information, if found

maintenance_data

namedtuple, optional – Unpacked maintenance data information, if found

maintenance_data_desc

dict, optional – Descriptions of maintenance data fields, if maintenance data present

vcp_info

namedtuple, optional – Unpacked VCP information, if found

clutter_filter_bypass_map

dict, optional – Unpacked clutter filter bypass map, if present

rda

dict, optional – Unpacked RDA adaptation data, if present

rda_adaptation_desc

dict, optional – Descriptions of RDA adaptation data, if adaptation data present

Notes

The internal data structure that things are decoded into is still to be determined.

Create instance of Level2File.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. Gzip-ed files are recognized with the extension ‘.gz’, as are bzip2-ed files with the extension .bz2 If fname is a file-like object, this will be read from directly.
__init__(filename)

Create instance of Level2File.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. Gzip-ed files are recognized with the extension ‘.gz’, as are bzip2-ed files with the extension .bz2 If fname is a file-like object, this will be read from directly.
msg1_data_hdr

alias of Msg1DataHdr

class metpy.io.nexrad.Level3File(filename)

A class that handles reading the wide array of NEXRAD Level 3 (NIDS) product files.

This class attempts to decode every byte that is in a given product file. It supports all of the various compression formats that exist for these products in the wild.

metadata

dict – Various general metadata available from the product

header

namedtuple – Decoded product header

prod_desc

namedtuple – Decoded product description block

siteID

str – ID of the site found in the header, empty string if none found

lat

float – Radar site latitude

lon

float – Radar site longitude

height

float – Radar site height AMSL

product_name

str – Name of the product contained in file

max_range

float – Maximum range of the product, taken from the NIDS ICD

map_data

Mapper – Class instance mapping data int values to proper floating point values

sym_block

list, optional – Any symbology block packets that were found

tab_pages

list, optional – Any tabular pages that were found

graph_pages

list, optional – Any graphical pages that were found

Notes

The internal data structure that things are decoded into is still to be determined.

Create instance of Level3File.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. If file-like object, this will be read from directly.
__init__(filename)

Create instance of Level3File.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. If file-like object, this will be read from directly.
metpy.io.nexrad.is_precip_mode(vcp_num)

Determine if the NEXRAD radar is operating in precipitation mode

Parameters:vcp_num (int) – The NEXRAD volume coverage pattern (VCP) number
Returns:bool – True if the VCP corresponds to precipitation mode, False otherwise

GINI

class metpy.io.gini.GiniFile(filename)

A class that handles reading the GINI format satellite images from the NWS.

This class attempts to decode every byte that is in a given GINI file.

Notes

The internal data structures that things are decoded into are subject to change. For a more stable interface, use the to_dataset() method.

Create instance of GiniFile.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. Gzip-ed files are recognized with the extension '.gz', as are bzip2-ed files with the extension '.bz2' If filename is a file-like object, this will be read from directly.
__init__(filename)

Create instance of GiniFile.

Parameters:filename (str or file-like object) – If str, the name of the file to be opened. Gzip-ed files are recognized with the extension '.gz', as are bzip2-ed files with the extension '.bz2' If filename is a file-like object, this will be read from directly.
prod_desc = None

desc – Decoded first section of product description block :type: namedtuple

prod_desc2 = None

desc – Decoded second section of product description block :type: namedtuple

proj_info = None

desc – Decoded geographic projection information :type: namedtuple

to_dataset()

Convert to a CDM dataset.

Gives a representation of the data in a much more user-friendly manner, providing easy access to Variables and relevant attributes.

Returns:Dataset