Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dsteph11JHUAPL committed Jul 8, 2024
0 parents commit 179cba5
Show file tree
Hide file tree
Showing 782 changed files with 191,702 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024, The Johns Hopkins University Applied Physics Laboratory

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# JCAT

Java CRISM Analysis Tool

JCAT is a free analysis tool for Compact Reconnaissance Imaging Spectrometer for Mars (CRISM) data products. It is released under the MIT license.

## Installation
Clone this repository from the command line:
```
> git clone [email protected]:JHUAPL/JCAT.git
```
In the cloned folder ('jcat'), run the mkPackage.bash script:
```
> ./mkPackage.bash
```
This script will create two tar files in the 'dist' directory. Expand that tar file either in a finder window or via command line:
```
> tar -xvzf ./dist/JCAT-XXXX.XX.XX.tar.gz
```
Open runJCAT in your corresponding OS via finder window or command line to start using JCAT:
```
> ./JCAT-XXXX.XX.XX/unix/runJCAT
```

## Tutorial / Documentation

There is a tutorial PDF available when running JCAT. Under the _Help_ tab, click on the _Tutorial_ button to open the document.

The _Show Log_ button is useful for debugging.


33 changes: 33 additions & 0 deletions doc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<html>
<head>
<title>The Java CRISM Analysis Tool (JCAT)</title>
</head>
<body>

<p>
The Java CRISM Analysis Tool (JCAT) can be used to view CRISM data
downloaded from the Planetary Data System
(PDS) <a href="https://pds-geosciences.wustl.edu/">Geosciences Node</a>
at <a href="https://wustl.edu/">Washington University</a> in
St. Louis.
<p>
JCAT requires Java version 8 or later to run, along with Java FX.
The <a href="https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">Java
SE Runtime Environment 8</a> (JRE) from Oracle includes both.
<p>
JCAT is distributed as a jar file. Version 1.0 was released on Nov
1, 2019. Double click the jar file, or from the command line, type
<pre>
java -jar JCAT.jar
</pre>
<p>
Follow the <a href="JCAT_Tutorial.pdf">JCAT Tutorial</a> to get
started.

<p>
Contact <a href="mailto:[email protected]">Hari Nair</a> for help,
bug reports, or suggestions.
</p>

</BODY>
</HTML>
137 changes: 137 additions & 0 deletions mkPackage.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/bin/bash

function build_jar() {
cwd=$(pwd)
cd $(dirname $0)

date=$(date +"%Y-%b-%d %H:%M:%S %Z")

if [ -d .git ]; then
rev=$(git rev-parse --verify --short HEAD)
else
rev="UNVERSIONED"
fi

mvn clean install

if [ ! -f target/${package}.jar ]; then
echo "compilation failed"
exit 0
fi

cd $cwd
}

function make_scripts() {
cwd=$(pwd)

binDir=${root}/unix
batchDir=${root}/windows
libDir=${root}/lib

mkdir -p ${binDir}
mkdir -p ${batchDir}
mkdir -p ${libDir}
rsync -a target/${package}.jar ${libDir}
rsync -a target/${package}_lib ${libDir}

for class in $(jar tf target/${package}.jar | grep $appSrcDir | grep -v '\$' | grep class); do
base=$(basename $class ".class")
tool=${binDir}/${base}
path=$(dirname $class | sed 's,/,.,g').${base}
echo "#!/bin/bash" > ${tool}
echo 'root=$(dirname $0)' >> ${tool}
echo 'MEMSIZE=""' >> ${tool}
echo 'if [ "$(uname)" == "Darwin" ]; then' >> ${tool}
echo ' MEMSIZE=$(sysctl hw.memsize | awk '\''{print int($2/1024)}'\'')' >> ${tool}
echo 'elif [ "$(uname)" == "Linux" ]; then' >> ${tool}
echo ' MEMSIZE=$(grep MemTotal /proc/meminfo | awk '\''{print $2}'\'')' >> ${tool}
echo 'fi' >> ${tool}
echo 'java=$(which java)' >> ${tool}
echo 'if [ -z $java ]; then' >> ${tool}
echo ' echo "Java executable not found in your PATH"' >> ${tool}
echo ' exit 1' >> ${tool}
echo 'fi' >> ${tool}
echo 'fullVersion=$(java -version 2>&1 | head -1 |awk -F\" '\''{print $2}'\'')' >> ${tool}
echo 'version=$(echo $fullVersion | awk -F\. '\''{print $1}'\'')' >> ${tool}
echo 'if [ "$version" -lt "17" ];then' >> ${tool}
echo ' echo "minimum Java version required is 17. Version found is $fullVersion."' >> ${tool}
echo ' exit 1' >> ${tool}
echo 'fi' >> ${tool}
echo "java -Xmx\${MEMSIZE}K -cp \${root}/../lib/*:\${root}/../lib/${package}_lib/* $path \$@" >> ${tool}

chmod +x ${tool}

tool=${batchDir}/${base}.bat
echo '@ECHO OFF' > ${tool}
echo 'set root=%~dp0\..' >> ${tool}
echo 'set CLASSPATH=%root%\lib\JCAT.jar;%root%\lib\JCAT_lib\*' >> ${tool}
echo '' >> ${tool}
echo ':: https://stackoverflow.com/questions/11343190/how-to-check-available-memory-ram-via-batch-script' >> ${tool}
echo 'for /f "skip=1" %%p in ('\''wmic os get freephysicalmemory'\'') do ( ' >> ${tool}
echo ' set memsize=%%p' >> ${tool}
echo ' goto :done' >> ${tool}
echo ')' >> ${tool}
echo ':done' >> ${tool}
echo '' >> ${tool}
echo ':: https://stackoverflow.com/questions/17714681/get-java-version-from-batch-file' >> ${tool}
echo 'for /f tokens^=2-5^ delims^=.-_^" %%j in ('\''java -fullversion 2^>^&1'\'') do set "version=%%j"' >> ${tool}
echo '' >> ${tool}
echo 'if %version% LSS 17 (' >> ${tool}
echo 'ECHO minimum Java version required is 17. Version found is %version%.' >> ${tool}
echo ') else (' >> ${tool}
echo 'java -Xmx%memsize%K app.runJCAT' >> ${tool}
echo ')' >> ${tool}
echo ':: Keep the CMD window open in case of errors' >> ${tool}
echo 'PAUSE' >> ${tool}

done
cd $cwd
}

### Don't need to modify anything below this line

package=JCAT
root=${package}-$(date "+%Y.%m.%d")

java=$(which java)
if [ -z $java ]; then
echo "Java executable not found in your PATH"
exit 1
fi

cwd=$(pwd)
cd $(dirname $0)

srcFile="./src/main/java/util/AppVersion.java"
appSrcDir='app'

java=$(which java)
if [ -z $java ]; then
echo "Java executable not found in your PATH"
exit 1
fi
fullVersion=$(java -version 2>&1 | head -1 |awk -F\" '{print $2}')
version=$(echo $fullVersion | awk -F\. '{print $1}')
if [ "$version" -lt "17" ];then
echo "minimum Java version required is 17. Version found is $fullVersion."
exit 1
fi

build_jar
make_scripts

if [ -d .git ]; then
git restore $srcFile
fi

cd $cwd

mkdir -p dist
tar cfz ./dist/${root}.tar.gz ./${root}
rsync -a mkPackage.bash pom.xml src ${root}-src/
tar cfz ./dist/${root}-src.tar.gz ./${root}-src

echo -e "\nCreated ./dist/${root}.tar.gz ./dist/${root}-src.tar.gz"

/bin/rm -fr ${root} ./${root}-src
Loading

0 comments on commit 179cba5

Please sign in to comment.