Skip to content
Snippets Groups Projects
Commit 22924b39 authored by Robert Butora's avatar Robert Butora
Browse files

cutout: adds preliminary imcopydav and removes unused temp_dir param from imcopy

parent f9e83565
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,11 @@ DEPS_INC := $(foreach d, $(DEPS_DIR), $d/include)
DEPS_LIB := $(foreach d, $(DEPS_DIR), $d/lib)
#================================================================================
INC_DIR = $(DEPS_INC) \
/usr/include/davix \
/usr/include/cfitsio \
/usr/local/include \
/usr/local/cfitsio/include
LIB_DIR = $(DEPS_LIB) \
/usr/lib64/ast \
/usr/local/lib \
/usr/local/cfitsio/lib
#================================================================================
......@@ -27,7 +28,7 @@ CFLAGS_COMMON = -c -Wstrict-prototypes $(FLAGS_COMMON)
CXX_DEBUG_FLAGS = -g -DVERBOSE_DEBUG -DFDB_DEBUG
CXX_RELEASE_FLAGS = -O3
CXX_DEFAULT_FLAGS = -c -std=c++11 $(FLAGS_COMMON)
LDFLAGS = -Wall -lvlkbcommon -lcfitsio -lcsv -last -last_grf_2.0 -last_grf_3.2 -last_grf_5.6 -last_grf3d -last_err -lstdc++ -lm
LDFLAGS = -Wall -lvlkbcommon -ldavix -lcfitsio -lcsv -last -last_pal -last_cminpack -last_grf_2.0 -last_grf_3.2 -last_grf_5.6 -last_grf3d -last_err -lstdc++ -lm
INC_PARM=$(foreach d, $(INC_DIR), -I$d)
LIB_PARM=$(foreach d, $(LIB_DIR), -L$d)
#================================================================================
......
......@@ -31,7 +31,7 @@ int stream_cutout(string pathname, int extnum, string region)
{
string pixfilter{ to_cfitsio_format(bnds) };
imcopy(pathname, extnum, pixfilter, "dummy");
imcopy(pathname, extnum, pixfilter);
return EXIT_SUCCESS;
}
......@@ -59,13 +59,12 @@ int fits_copy_image_section2(
void imcopy(std::string filename, int extnum, std::string pixfilter, std::string temp_root)
void imcopy(std::string filename, int extnum, std::string pixfilter)
{
LOG_trace(__func__);
LOG_STREAM << filename << " EXT: " << extnum << endl;
LOG_STREAM << "pixfilter: " << pixfilter << endl;
LOG_STREAM << "temp_root: " << temp_root << endl;
int status = 0;
......
......@@ -3,7 +3,7 @@
#include <string>
void imcopy(std::string filename, int extnum, std::string pixfilter, std::string temp_root);
void imcopy(std::string filename, int extnum, std::string pixfilter);
int stream_cutout(std::string pathname, int extnum, std::string region);
#endif
This diff is collapsed.
#ifndef IMCOPYDAV_HPP
#define IMCOPYDAV_HPP
#include <string>
void imcopydav(std::string url, int extnum, std::string pixfilter);
int stream_cutout_dav(std::string url, int extnum, std::string region);
#endif
......@@ -5,6 +5,7 @@
#include "multicutout.hpp"
#include "ast.hpp"
#include "imcopy.hpp" // imcopy() vlkb_cutout()
#include "imcopydav.hpp" // imcopydav()
#include "ast4vl.hpp" // uint_bounds needed
#include "fitsfiles.hpp"
#include "service_string.hpp" // to_cftsio_format() needed
......@@ -42,7 +43,7 @@ namespace vlkb
std::cerr
<< "Usage: " << progname << " <command> [cmd-options] [cmd-args]" << endl
<< "\n where commands are:\n "
<< "\n\t cutout imcopy cutpixels multicutout mergefiles\n"
<< "\n\t cutout imcopy imcopydav cutpixels multicutout mergefiles\n"
<< "\n\t listbounds header headermodif headerwcs skyvertices overlap\n"
<< "\n\t nullvals dropdegen checkcard addcard modcard rawdelcard\n"
<< std::endl
......@@ -54,7 +55,7 @@ namespace vlkb
// program recognizes following commands
enum cmd_set {
multicutout, mergefiles, cutout, imcopy, cutpixels,
multicutout, mergefiles, cutout, imcopy, imcopydav, cutpixels,
listbounds, header, headermodif, headerwcs, overlap, skyvertices,
nullvals, dropdegen, checkcard, addcard, modcard, rawdelcard};
......@@ -69,6 +70,7 @@ namespace vlkb
else if(cmdstr.compare("mergefiles") == 0) cmd = mergefiles;
else if(cmdstr.compare("cutout") == 0) cmd = cutout;
else if(cmdstr.compare("imcopy") == 0) cmd = imcopy;
else if(cmdstr.compare("imcopydav") == 0) cmd = imcopydav;
else if(cmdstr.compare("cutpixels") == 0) cmd = cutpixels;
else if(cmdstr.compare("listbounds") == 0) cmd = listbounds;
else if(cmdstr.compare("header") == 0) cmd = header;
......@@ -187,15 +189,47 @@ int cmd_mergefiles(int argc, char * argv[])
int cmd_imcopy(int argc, char * argv[])
{
if((argc == 4) || (argc == 5))
if((argc == 4))
{
std::string infilename{argv[1]};
int extnum = std::stoi(std::string{argv[2]});
std::string pixfilter{argv[3]};
try
{
imcopy(infilename, extnum, pixfilter);
}
catch(const std::exception & ex)
{
std::cerr << ex.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
else
{
std::cerr
<< "Usage: imcopy filename.fits extnum [a:b c:d ...]\n"
<< "\n"
<< "Send to stdout a subimage of N-dimesional FITS-file HDU with N-element pixel filter.\n"
<< "HDU is given by extension number (0=Primary HDU, 1=Ext1, ...)"
<< "Examples: \n"
<< " vlkb imcopy /rootvialactea/CHaMP/region7.fits 0 [1:100,1:100,1:100]\n";
return EXIT_FAILURE;
}
}
int cmd_imcopydav(int argc, char * argv[])
{
if((argc == 4) || (argc == 5))
{
std::string url{argv[1]};
int extnum = std::stoi(std::string{argv[2]});
std::string pixfilter{argv[3]};
std::string temp_root = ((argc == 5) ? argv[4] : "/tmp" );
try
{
imcopy(infilename, extnum, pixfilter, temp_root);
imcopydav(url, extnum, pixfilter);
}
catch(const std::exception & ex)
{
......@@ -207,19 +241,20 @@ int cmd_imcopy(int argc, char * argv[])
else
{
std::cerr
<< "Usage: imcopy filename.fits extnum [a:b c:d ...] <temp-root>\n"
<< "Usage: imcopydav url extnum [a:b c:d ...] <temp-root>\n"
<< "\n"
<< "Send to stdout a subimage of N-dimesional FITS-file HDU with N-element pixel filter.\n"
<< "HDU is given by extension number (0=Primary HDU, 1=Ext1, ...)"
<< "<temp-root> is rw storage to hold the fits-cut while streaming (optional, default is '/tmp')"
<< "Examples: \n"
<< " vlkb imcopy /rootvialactea/CHaMP/region7.fits 0 [1:100,1:100,1:100]\n";
<< " vlkb imcopydav http://localhost:80/tmp/testfile.fits 0 [1:100,1:100,1:100]\n";
return EXIT_FAILURE;
}
}
int cmd_cutout(int argc, char * argv[])
{
if (argc != 4)
......@@ -707,6 +742,7 @@ int main (int argc, char * argv[])
{
case vlkb::cutout: rc = cmd_cutout(cmd_argc, cmd_argv); break;
case vlkb::imcopy: rc = cmd_imcopy(cmd_argc, cmd_argv); break;
case vlkb::imcopydav: rc = cmd_imcopydav(cmd_argc, cmd_argv); break;
case vlkb::cutpixels: rc = cmd_cutpixels(cmd_argc, cmd_argv); break;
case vlkb::multicutout: rc = cmd_multicutout(cmd_argc, cmd_argv); break;
case vlkb::mergefiles: rc = cmd_mergefiles(cmd_argc, cmd_argv); break;
......
......@@ -114,13 +114,12 @@ class SodaImpl implements Soda
String pixFilterString = pixels_valid ? pixels : boundsString;
String[] cmdCut = new String[6];
String[] cmdCut = new String[5];
cmdCut[0] = "/usr/local/bin/vlkb";
cmdCut[1] = "imcopy";
cmdCut[2] = absPathname;
cmdCut[3] = String.valueOf(hdunum-1);
cmdCut[4] = pixFilterString;
cmdCut[5] = fitsPaths.cutouts();
if(outputStream == null)
LOGGER.finest("supplied outputStream for cut-file is null");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment