借助批处理和ENVI/IDL实现批量高分数据从解压缩到RPC校正(一)

前段时间,帮一项目负责人批量处理数据,虽然利用ENVI软件操作十分简单,选好RPC文件,点点按钮,等待处理完一景后,再重复点点按钮。然而,当数据量巨大,单景卫星数据影像RPC校正时间又长,让人去盯着,是不可能的事。

所需环境

  1. tar数据
  2. 安装7-zip

代码如下

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
@echo off
setlocal ENABLEDELAYEDEXPANSION

::----更换7z程序所在目录----
set rar="C:\Program Files (x86)\7-Zip\7z.exe"
set log="%~dp0rarlog.log"

::----压缩文件所在目录----
set p=".\Data"

cd %p%
for /r %%i in (.) do (
call:fun "%%i"
call:fun2 "%%i"
)
pause
goto:eof
::///////////////////////////////////////
:fun
cd %1
for /f "delims=" %%i in ('dir /a-d /b') do (
echo %%i
if "%%~xi" equ ".gz" (
%rar% e "%%i" -y
if !errorlevel! equ 0 (
::del /f/q "%%i"
>>%log% echo %date% %time% Success: %%~dpnxi
) else (
>>%log% echo %date% %time% Error: %%~dpnxi
)
)
)
:fun2
cd %1
for /f "delims=" %%i in ('dir /a-d /b') do (
echo %%i
if "%%~xi" equ ".tar" (
%rar% e "%%i" -y
if !errorlevel! equ 0 (
del /f/q "%%i"
>>%log% echo %date% %time% Success: %%~dpnxi
) else (
>>%log% echo %date% %time% Error: %%~dpnxi
)
)
)
goto:eof