Beispiel #1
0
def test_read_all_fields():

    mdvfile = MdvFile(pyart.testing.MDV_PPI_FILE)
    # read all fields
    assert mdvfile.fields_data[0] is None
    mdvfile.read_all_fields()
    assert mdvfile.fields_data[0] is not None
    assert_almost_equal(mdvfile.fields_data[0][0, 1, 2], 13.19, 2)
Beispiel #2
0
def test_read_all_fields():

    mdvfile = MdvFile(pyart.testing.MDV_PPI_FILE)
    # read all fields
    assert mdvfile.fields_data[0] is None
    mdvfile.read_all_fields()
    assert mdvfile.fields_data[0] is not None
    assert_almost_equal(mdvfile.fields_data[0][0, 1, 2], 13.19, 2)
Beispiel #3
0
def test_read_one_field():

    mdvfile = MdvFile(pyart.testing.MDV_PPI_FILE)
    # extract a field
    assert mdvfile.fields_data[0] is None
    sweeps = mdvfile.read_a_field(0)
    assert sweeps.shape == (1, 360, 110)
    assert_almost_equal(sweeps[0, 1, 2], 13.19, 2)
    assert mdvfile.fields_data[0] is not None

    # reread, should be faster
    sweeps = mdvfile.read_a_field(0)
    assert sweeps.shape == (1, 360, 110)
    assert_almost_equal(sweeps[0, 1, 2], 13.19, 2)
    assert mdvfile.fields_data[0] is not None
Beispiel #4
0
def test_read_one_field():

    mdvfile = MdvFile(pyart.testing.MDV_PPI_FILE)
    # extract a field
    assert mdvfile.fields_data[0] is None
    sweeps = mdvfile.read_a_field(0)
    assert sweeps.shape == (1, 360, 110)
    assert_almost_equal(sweeps[0, 1, 2], 13.19, 2)
    assert mdvfile.fields_data[0] is not None

    # reread, should be faster
    sweeps = mdvfile.read_a_field(0)
    assert sweeps.shape == (1, 360, 110)
    assert_almost_equal(sweeps[0, 1, 2], 13.19, 2)
    assert mdvfile.fields_data[0] is not None
Beispiel #5
0
def test_read_all_fields_on_creation():
    mdvfile2 = MdvFile(pyart.testing.MDV_PPI_FILE, read_fields=True)
    assert mdvfile2.fields_data[0] is not None
    assert_almost_equal(mdvfile2.fields_data[0][0, 1, 2], 13.19, 2)
    mdvfile2.close()
Beispiel #6
0
def test_read_all_fields_on_creation():
    mdvfile2 = MdvFile(pyart.testing.MDV_PPI_FILE, read_fields=True)
    assert mdvfile2.fields_data[0] is not None
    assert_almost_equal(mdvfile2.fields_data[0][0, 1, 2], 13.19, 2)
    mdvfile2.close()
Beispiel #7
0
def test_geometry_raises():
    mdvfile = MdvFile(pyart.testing.MDV_GRID_FILE)
    pytest.raises(NotImplementedError, mdvfile._calc_geometry)
Beispiel #8
0
import warnings
from datetime import datetime
from io import BytesIO

import numpy as np
from numpy.testing import assert_almost_equal
import pytest

import pyart
from pyart.io.mdv_common import MdvFile

#################
# MdvFile tests #
#################

mdvfile = MdvFile(pyart.testing.MDV_PPI_FILE)


def test_master_header():
    # test the master header
    ref_master_header = {
        'chunk_hdr_offset':
        2464,
        'data_collection_type':
        0,
        'data_dimension':
        0,
        'data_ordering':
        0,
        'data_set_info':
        'MDV radar volume file created by Dsr2Vol.',