AIRS Code Collection
select_ret.c
Go to the documentation of this file.
1/*
2 This file is part of the AIRS Code Collection.
3
4 the AIRS Code Collections is free software: you can redistribute it
5 and/or modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation, either version 3 of
7 the License, or (at your option) any later version.
8
9 The AIRS Code Collection is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with the AIRS Code Collection. If not, see
16 <http://www.gnu.org/licenses/>.
17
18 Copyright (C) 2019-2025 Forschungszentrum Juelich GmbH
19*/
20
26#include "libairs.h"
27
28int main(
29 int argc,
30 char *argv[]) {
31
32 static ret_t ret;
33
34 /* Check arguments... */
35 if (argc < 3)
36 ERRMSG("Give parameters: <ctl> [<airs1.nc> <airs2.c> ...]");
37
38 /* Get control parameters... */
39 const double lon0 =
40 (int) scan_ctl(argc, argv, "SELECT_LON0", -1, "-180", NULL);
41 const double lon1 =
42 (int) scan_ctl(argc, argv, "SELECT_LON1", -1, "180", NULL);
43 const double lat0 =
44 (int) scan_ctl(argc, argv, "SELECT_LAT0", -1, "-90", NULL);
45 const double lat1 =
46 (int) scan_ctl(argc, argv, "SELECT_LAT1", -1, "90", NULL);
47
48 /* Loop over retrieval files... */
49 for (int i = 2; i < argc; i++) {
50
51 /* Read AIRS data... */
52 read_retr(argv[i], &ret);
53
54 /* Check position... */
55 if (ret.lon[ret.nds / 2][0] >= lon0
56 && ret.lon[ret.nds / 2][0] <= lon1
57 && ret.lat[ret.nds / 2][0] >= lat0 && ret.lat[ret.nds / 2][0] <= lat1)
58 printf("select: %s %.2f %g %g\n", argv[i], ret.time[ret.nds / 2][0],
59 ret.lon[ret.nds / 2][0], ret.lat[ret.nds / 2][0]);
60 }
61
62 return EXIT_SUCCESS;
63}
double scan_ctl(int argc, char *argv[], const char *varname, int arridx, const char *defvalue, char *value)
Search control parameter file for variable entry.
Definition: jurassic.c:5114
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
void read_retr(char *filename, ret_t *ret)
Read AIRS retrieval data.
Definition: libairs.c:1219
AIRS Code Collection library declarations.
int main(int argc, char *argv[])
Definition: select_ret.c:28
Retrieval results.
Definition: libairs.h:237
double lat[NDS][NPG]
Latitude [deg].
Definition: libairs.h:255
int nds
Number of data sets.
Definition: libairs.h:240
double time[NDS][NPG]
Time (seconds since 2000-01-01T00:00Z).
Definition: libairs.h:246
double lon[NDS][NPG]
Longitude [deg].
Definition: libairs.h:252