Passed
Push — master ( e2ee43...bdae2e )
by Stefan
06:05
created

test_level2_pp_cli.test_pp_netcdf()   A

Complexity

Conditions 1

Size

Total Lines 18
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nop 1
dl 0
loc 18
rs 9.55
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
2
# vim:fileencoding=utf-8
3
#
4
# Copyright (c) 2019 Stefan Bender
5
#
6
# This module is part of sciapy.
7
# sciapy is free software: you can redistribute it or modify
8
# it under the terms of the GNU General Public License as published
9
# by the Free Software Foundation, version 2.
10
# See accompanying LICENSE file or http://www.gnu.org/licenses/gpl-2.0.html.
11
"""SCIAMACHY level 2 post processing command line interface tests
12
13
Test functions to assure that the command line interface works in
14
most of the cases.
15
"""
16
import os
17
from subprocess import Popen
18
19
from nccmpx import (ncallclose, nccmpattrs, ncequal, ncidentical)
20
21
DATADIR = os.path.join(".", "tests", "data")
22
IFILE1 = os.path.join(DATADIR, "test_v2.2.nc")
23
IFILE2 = os.path.join(DATADIR, "test_v2.2x.nc")
24
25
26
def test_pp_help():
27
	p = Popen(["scia_post_process_l2.py", "-h"])
28
	p.communicate()
29
	p.wait()
30
	assert p.returncode == 0
31
32
33
def test_pp_netcdf(tmpdir):
34
	ofile = os.path.join(tmpdir, "test_v2.2_t.nc")
35
	p = Popen([
36
		"scia_post_process_l2.py",
37
		"-A", "The Dude",
38
		"-M", "2010-02",
39
		"-p", os.path.join(DATADIR, "l2"),
40
		"-s", os.path.join(DATADIR, "l1c"),
41
		"--mlt",
42
		ofile,
43
	])
44
	p.communicate()
45
	p.wait()
46
	assert p.returncode == 0
47
	ncallclose(IFILE1, ofile)
48
	nccmpattrs(IFILE1, ofile, ignore=["creation_time"])
49
	ncequal(IFILE1, ofile)
50
	ncidentical(IFILE1, ofile, ignore=["creation_time"])
51
52
53
def test_pp_xarray(tmpdir):
54
	ofile = os.path.join(tmpdir, "test_v2.2x_t.nc")
55
	p = Popen([
56
		"scia_post_process_l2.py",
57
		"-A", "The Dude",
58
		"-M", "2010-02",
59
		"-p", os.path.join(DATADIR, "l2"),
60
		"-s", os.path.join(DATADIR, "l1c"),
61
		"--mlt",
62
		"-X",
63
		ofile,
64
	])
65
	p.communicate()
66
	p.wait()
67
	assert p.returncode == 0
68
	ncallclose(IFILE2, ofile)
69
	nccmpattrs(IFILE2, ofile, ignore=["creation_time"])
70
	ncequal(IFILE2, ofile)
71
	ncidentical(IFILE2, ofile, ignore=["creation_time"])
72