Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topds4 #4246

Merged
merged 35 commits into from
Jan 12, 2021
Merged

Topds4 #4246

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5d605e1
Removed compile and deprication warnings. Fixes #4110
scsides Nov 23, 2020
09e077d
Updated from github
scsides Dec 14, 2020
6c951c4
updated
scsides Dec 16, 2020
c6e3d58
temp add of to pds 4 test
scsides Dec 16, 2020
a47b9e4
updated
scsides Dec 17, 2020
1631994
Initial topds4 app and cmake updates to include inja (#4207)
krlberry Dec 17, 2020
591cd29
update
scsides Dec 21, 2020
5fcc94c
Added conda-forge inja
jessemapel Dec 21, 2020
290d280
add template file
scsides Dec 22, 2020
7d77806
Merge branch 'topds4' of github.com:USGS-Astrogeology/ISIS3 into topds4
scsides Dec 22, 2020
c692604
Adds PVL to JSON converters (#4212)
jessemapel Dec 22, 2020
2c20edf
Merge branch 'topds4' of github.com:USGS-Astrogeology/ISIS3 into topds4
scsides Dec 22, 2020
6618a0d
Topds4 real parameters (#4223)
scsides Jan 4, 2021
b4f07c9
Add full orex pds4 template (#4233)
scsides Jan 4, 2021
6ca277d
Added callbacks and tests (#4226)
jessemapel Jan 4, 2021
132c366
Adds Xml2Json capability to topds4 branch (#4228)
krlberry Jan 4, 2021
cc2cbb7
Normalized topds4 and added tests (#4234)
jessemapel Jan 5, 2021
2975cb1
Added more template elements and callback for file size (#4236)
scsides Jan 5, 2021
d5d4e73
Added Extra data source parameters to topds4 (#4239)
jessemapel Jan 6, 2021
5a6586c
Add writing a cube out to topds4 (#4241)
krlberry Jan 7, 2021
67f1e73
Add copy of topds4 templates to CMakeLists.txt (#4242)
krlberry Jan 7, 2021
05cf919
Fixed callbacks and doc updates (#4243)
jessemapel Jan 7, 2021
a088ca8
Added original xml label and tests
scsides Jan 8, 2021
54efa4e
Update cubeattribute to include an option to supply CubeAttributeInpu…
krlberry Jan 8, 2021
0541f57
Update CHANGELOG to include topds4 addition
krlberry Jan 8, 2021
95ea365
Merge branch 'dev' into topds4
jessemapel Jan 11, 2021
5fcd8b9
Delete osirisrex.xml.tpl
scsides Jan 11, 2021
9323a48
Delete 20190612T090019S776_map_L0pan.xml.full
scsides Jan 11, 2021
9bc187e
Delete 20190612T090019S776_map_L0pan.xml.tpl
scsides Jan 11, 2021
c56d5c4
Added mis-deleted file (#4249)
scsides Jan 11, 2021
cfc58cf
Update XmlToJson.cpp
krlberry Jan 11, 2021
4b4f9cf
Update topds4.xml
krlberry Jan 11, 2021
102e320
Update topds4.xml
krlberry Jan 11, 2021
1abb8d3
Update topds4.xml
krlberry Jan 11, 2021
33a404d
Add setting of virtual bands to topds4 and remove unneeded header fil…
krlberry Jan 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ update the Unreleased link so that it compares against the latest release tag.
- Added warning to ocams2isis about the model being out of date. [#4200](https://github.com/USGS-Astrogeology/ISIS3/issues/4200)
- Added documentation to lronaccal and lrowaccal to describe why there are negative DNs in I/F calibrated images. [#3860](https://github.com/USGS-Astrogeology/ISIS3/issues/3860)
- Update qview MeasureTool to add an option to calculate distances using RA/DEC and update qview to show DEC/RA rather than LAT/LON in lower-right corner [#3371](https://github.com/USGS-Astrogeology/ISIS3/issues/3371)
- Added a new application, topds4, which generates an output PDS4 XML label and a PDS4-compliant ISIS Cube from an input Cube, a PDS4 label template, and optionally additional input XML, PVL, or JSON data. The Inja templating engine is used to render the output PDS4 label from the label template. [#4246](https://github.com/USGS-Astrogeology/ISIS3/pull/4246)
- Updated spiceinit so that a user can specify a shape model and use the spice web service without any errors. [#1986](https://github.com/USGS-Astrogeology/ISIS3/issues/1986)

### Fixed

- Fixed lrowaccal so required SPICE files are reported instead of continuing without them. [#4038](https://github.com/USGS-Astrogeology/ISIS3/issues/4038)
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- gsl>=2.6
- hdf5
- icu
- inja
- jama
- jpeg==9b
- kakadu==1
Expand Down
1 change: 1 addition & 0 deletions environment_gcc4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies:
- gsl
- hdf5
- icu
- inja
- jama
- jpeg==9b
- kakadu==1
Expand Down
12 changes: 11 additions & 1 deletion isis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ option(JP2KFLAG "Whether or not to build using JPEG2000 support" OFF )
option(pybindings "Turn on to build Python bindings" OFF )

# if cmake install prefix is not set, and conda env is activated, use the
# conda env as the install directory
# conda env as the install directory.
if(DEFINED ENV{CONDA_PREFIX} AND CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
set(CMAKE_INSTALL_PREFIX $ENV{CONDA_PREFIX})
endif()
Expand Down Expand Up @@ -293,6 +293,8 @@ find_package(Kakadu)
find_package(Geos 3.5.0 REQUIRED)
find_package(Armadillo REQUIRED)
find_package(Threads)
find_package(inja REQUIRED)



# In this case, we specify the version numbers being searched for in the non-traditional installs.
Expand Down Expand Up @@ -347,6 +349,9 @@ foreach (_variableName ${_variableNames})
endif()
endforeach()

# add target based linkages to ALLLIBS variable
list(APPEND ALLLIBS pantor::inja)

# Sometimes we add the same lib more than once (especially with LIBDIRS)
list(REMOVE_DUPLICATES ALLLIBDIRS)
list(REMOVE_DUPLICATES ALLLIBS)
Expand Down Expand Up @@ -496,6 +501,7 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/appdata/translations
${CMAKE_BINARY_DIR}/appdata/templates/jigsaw
${CMAKE_BINARY_DIR}/appdata/templates/kernels
${CMAKE_BINARY_DIR}/appdata/templates/labels
${CMAKE_BINARY_DIR}/appdata/templates/topds4
${CMAKE_BINARY_DIR}/appdata/templates/maps
${CMAKE_BINARY_DIR}/appdata/templates/photometry
${CMAKE_BINARY_DIR}/appdata/images/icons
Expand Down Expand Up @@ -614,6 +620,10 @@ add_custom_target(hidtmgen ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/appdata/templates/hidtmgen/* ${CMAKE_BINARY_DIR}/appdata/templates/hidtmgen/)
add_dependencies(isis hidtmgen)

add_custom_target(topds4 ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/appdata/templates/topds4/* ${CMAKE_BINARY_DIR}/appdata/templates/topds4)
add_dependencies(isis topds4)

# Add a custom build target to clean out everything that gets added to the source
# directory during the build process.
# - Only a few things are added in order to make the tests work properly so
Expand Down
53 changes: 53 additions & 0 deletions isis/appdata/templates/topds4/osirisrex.xml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1700.sch" schematypens="http://purl.oclc.org/dsdl/schematron" ?>
<?xml-model href="https://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1700.sch" schematypens="http://purl.oclc.org/dsdl/schematron" ?>
<?xml-model href="https://pds.nasa.gov/pds4/geom/v1/PDS4_GEOM_1700_1401.sch" schematypens="http://purl.oclc.org/dsdl/schematron" ?>
<?xml-model href="https://pds.nasa.gov/pds4/orex/v1/orex_ldd_OREX_1300.sch" schematypens="http://purl.oclc.org/dsdl/schematron" ?>
<Product_Observational
xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:disp="http://pds.nasa.gov/pds4/disp/v1"
xmlns:geom="http://pds.nasa.gov/pds4/geom/v1"
xmlns:orex="http://pds.nasa.gov/pds4/mission/orex/v1"
xsi:schemaLocation=
"http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1700.xsd
http://pds.nasa.gov/pds4/disp/v1 https://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1700.xsd
http://pds.nasa.gov/pds4/geom/v1 https://pds.nasa.gov/pds4/geom/v1/PDS4_GEOM_1700_1401.xsd
http://pds.nasa.gov/pds4/mission/orex/v1 https://pds.nasa.gov/pds4/mission/orex/v1/PDS4_OREX_1300.xsd">
<File_Area_Observational>
<File>
<file_name>filename</file_name>
<creation_date_time>dateandtime</creation_date_time>
<file_size unit="byte">filesize</file_size>
</File>
<Header>
<offset unit="byte">headeroffset</offset>
<object_length unit="byte">headerLength</object_length>
<parsing_standard_id>fileType</parsing_standard_id>
</Header>
<Array_2D_Image>
<local_identifier>Active Area</local_identifier>
<offset unit="byte">imageOffsetBytes</offset>
<axes>numAxes</axes>
<axis_index_order>Last Index Fastest</axis_index_order>
<description>OCAMS image 1024 by 1024 pixel active array.</description>
<Element_Array>
<data_type>bitType</data_type>
<unit>DN</unit>
<scaling_factor>1</scaling_factor>
<value_offset>WHAT IS THIS</value_offset>
</Element_Array>
<Axis_Array>
<axis_name>Line</axis_name>
<elements>{{MainLabel.IsisCube.Core.Dimensions.Lines.Value}}</elements>
<sequence_number>1</sequence_number>
</Axis_Array>
<Axis_Array>
<axis_name>Sample</axis_name>
<elements>{{MainLabel.IsisCube.Core.Dimensions.Samples.Value}}</elements>
<sequence_number>2</sequence_number>
</Axis_Array>
</Array_2D_Image>
</File_Area_Observational>
</Product_Observational>
64 changes: 64 additions & 0 deletions isis/src/base/apps/cubeatt/cubeatt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "cubeatt.h"

#include "ProcessByLine.h"

using namespace std;
using namespace Isis;

namespace Isis {
void cubeattProcess(Buffer &in, Buffer &out);

void cubeatt(UserInterface &ui) {
Cube icube;
CubeAttributeInput inAtt = ui.GetInputAttribute("FROM");
if (inAtt.bands().size() != 0) {
icube.setVirtualBands(inAtt.bands());
}
icube.open(ui.GetFileName("FROM"));
cubeatt(&icube, ui);
}


// Doesn't allow specification of input attributes
void cubeatt(Cube *icube, UserInterface &ui) {
bool propTables = ui.GetBoolean("PROPTABLES");
QString outputFileName = ui.GetFileName("TO");
CubeAttributeOutput outputAttributes= ui.GetOutputAttribute("TO");
cubeatt(icube, outputFileName, outputAttributes, propTables);
}

// Doesn't allow specification of input attributes
void cubeatt(Cube *icube, QString outputCubePath, CubeAttributeOutput outAttributes, bool propTables) {
// We will be processing by line
ProcessByLine p;

// Should we propagate tables
p.PropagateTables(propTables);

// Setup the input and output cubes
p.SetInputCube(icube);
p.SetOutputCube(outputCubePath, outAttributes,
icube->sampleCount(), icube->lineCount(), icube->bandCount());

p.StartProcess(cubeattProcess);
p.EndProcess();
}

// Allows specification of both input and output attributes
void cubeatt(QString inputCubePath, CubeAttributeInput inAtt, QString outputCubePath, CubeAttributeOutput outputAttributes, bool propTables) {
Cube icube;
if (inAtt.bands().size() != 0) {
icube.setVirtualBands(inAtt.bands());
}
icube.open(inputCubePath);
cubeatt(&icube, outputCubePath, outputAttributes, propTables);
}

// Line processing routine
void cubeattProcess(Buffer &in, Buffer &out) {
// Loop and copy pixels in the line.
for(int i = 0; i < in.size(); i++) {
out[i] = in[i];
}
}
}
15 changes: 15 additions & 0 deletions isis/src/base/apps/cubeatt/cubeatt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef cubeatt_h
#define cubeatt_h

#include "Cube.h"
#include "CubeAttribute.h"
#include "UserInterface.h"

namespace Isis{
extern void cubeatt(Cube *icube, QString outputCubePath, CubeAttributeOutput outputAttributes, bool propTables=false);
extern void cubeatt(QString inputCubePath, CubeAttributeInput inputAttributes, QString outputCubePath, CubeAttributeOutput outputAttributes, bool propTables=false);
extern void cubeatt(Cube *icube, UserInterface &ui);
extern void cubeatt(UserInterface &ui);
}

#endif
33 changes: 7 additions & 26 deletions isis/src/base/apps/cubeatt/main.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
#include "Isis.h"
#include "ProcessByLine.h"

#include "cubeatt.h"

#include "Application.h"

using namespace std;
using namespace Isis;

void cubeatt(Buffer &in, Buffer &out);

void IsisMain() {
// We will be processing by line
ProcessByLine p;

// Should we propagate tables
if(!Application::GetUserInterface().GetBoolean("PROPTABLES")) {
p.PropagateTables(false);
}

// Setup the input and output cubes
p.SetInputCube("FROM");
p.SetOutputCube("TO");

p.StartProcess(cubeatt);
p.EndProcess();
}

// Line processing routine
void cubeatt(Buffer &in, Buffer &out) {
// Loop and copy pixels in the line.
for(int i = 0; i < in.size(); i++) {
out[i] = in[i];
}
}
UserInterface &ui = Application::GetUserInterface();
cubeatt(ui);
}
4 changes: 0 additions & 4 deletions isis/src/base/apps/cubeatt/tsts/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions isis/src/base/apps/cubeatt/tsts/change/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions isis/src/base/apps/cubeatt/tsts/noChange/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions isis/src/base/apps/cubeatt/tsts/virtualBands/Makefile

This file was deleted.

25 changes: 25 additions & 0 deletions isis/src/base/apps/topds4/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "Isis.h"

#include "topds4.h"

using namespace std;
using namespace Isis;

void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
Pvl appLog;

try {
topds4(ui, &appLog);
}
catch (...) {
for (auto grpIt = appLog.beginGroup(); grpIt!= appLog.endGroup(); grpIt++) {
Application::Log(*grpIt);
}
throw;
}

for (auto grpIt = appLog.beginGroup(); grpIt!= appLog.endGroup(); grpIt++) {
Application::Log(*grpIt);
}
}
Loading