-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_iasi_compress.m
executable file
·48 lines (40 loc) · 1.74 KB
/
run_iasi_compress.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function run_iasi_compress()
addpath(genpath('~/git/rtp_prod2'));
addpath('~/git/iasi_pcc');
% grab the slurm array index for this process
slurmindex = str2num(getenv('SLURM_ARRAY_TASK_ID'));
fprintf(1, 'Processing start %s\n', datetime)
chunk = 8;
for i = 1:chunk
dayindex = (slurmindex*chunk) + i;
fprintf(1, '> chunk %d dayindex %d\n', i, dayindex);
% File iasi_file_list is a list of filepaths to the input
% files or this processing. For the initial runs, this was
% generated by a call to 'ls' while sitting in the directory
% /asl/iasi/iasi1/l1c/2020/164
% ls $PWD/IASI_xxx_1C_M02_* > ~/git/iasi_pcc/iasi_file_list
%
% iasi_file_list, then, contains lines like:
% /asl/iasi/iasi1/l1c/2020/164/IASI_xxx_1C_M02_20200612130854Z_20200612131157Z
[status, infile] = system(sprintf('sed -n "%dp" %s | tr -d "\n"', ...
dayindex, '~/git/iasi_pcc/iasi_file_list'));
% granule file name base will remain the same. path will change
% from l1c -> pcc
[pathstr, name, ext] = fileparts(infile);
IASI_PCC_DIR = strrep(pathstr, 'l1c', 'pcc');
outfile = fullfile(IASI_PCC_DIR, [name, '.pcc']);
% if output file already exists, jump to next
if exist(outfile) ~= 0
fprintf(1, '>>> Output file %s exists. Next granule.\n', outfile)
continue
end
if exist(IASI_PCC_DIR) == 0
fprintf(1, '>>>> %s does not exist. Creating\n', IASI_PCC_DIR);
mkdir(IASI_PCC_DIR);
end
fprintf(1, '>> Writing compressed granule to %s\n', outfile)
% call the processing function
fprintf(1, '>> Compressing granule %s\n', infile)
iasi_pcc_compress_granule(infile, outfile);
end
fprintf(1, 'Processing complete %s\n', datetime)