-
Notifications
You must be signed in to change notification settings - Fork 13
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
thredds script #406
Open
robkooper
wants to merge
2
commits into
master
Choose a base branch
from
thredds
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
thredds script #406
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
The script in this folder will create a catalog.xml output that can be | ||
used by the thredds server. This script is run every day and will update | ||
the thredds server to show the latest data available. | ||
|
||
The script writes the catalog.xml to a folder that is similair to the | ||
example 4.6.8 thredds server. | ||
|
||
This script is used with cronjob and the following little script: | ||
|
||
``` | ||
#!/bin/bash | ||
|
||
cd /home/ubuntu | ||
./thredds.sh > thredds/catalog.xml | ||
/usr/sbin/service tomcat8 restart | ||
``` | ||
|
||
The output of the script can be found at: | ||
https://terraref.ncsa.illinois.edu/thredds/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
dataset() { | ||
FOLDER="$1" | ||
DSPATH="$2" | ||
TITLE="$3" | ||
|
||
echo " <dataset name=\"${TITLE}\" ID=\"${TITLE}\">" | ||
|
||
IFS=$'\n' | ||
LAST_DATE="" | ||
LAST_TIME="" | ||
|
||
FILES=$( find ${FOLDER} -name \*.nc | sort ) | ||
#FILES=$( cat ncfiles.txt | sort ) | ||
for X in ${FILES}; do | ||
# remove leading whitespace, and extract information | ||
X="${X#${FOLDER}}" | ||
X="${X//[[:space:]]/}" | ||
X="${X:1}" | ||
echo "$X" | ||
|
||
DATE=$( echo "$X" | cut -d "/" -f1 ) | ||
if [ "$DATE" != "$LAST_DATE" ]; then | ||
if [ "$LAST_DATE" != "" ]; then | ||
echo ' </dataset>' | ||
echo ' </dataset>' | ||
fi | ||
LAST_TIME="" | ||
LAST_DATE="$DATE" | ||
echo " <dataset name=\"${DATE}\" ID=\"${DATE}\">" | ||
fi | ||
|
||
TIME=$( echo "$X" | cut -d "/" -f2) | ||
if [ "$TIME" != "$LAST_TIME" ]; then | ||
if [ "$LAST_TIME" != "" ]; then | ||
echo ' </dataset>' | ||
fi | ||
LAST_TIME="$TIME" | ||
NAME=$( echo "$TIME" | cut -d "_" -f3 | tr "-" ":" | cut -d ":" -f 1,2 ) | ||
echo " <dataset name=\"${NAME}\" ID=\"${TIME}\">" | ||
fi | ||
|
||
NAME=$( echo "$X" | cut -d "/" -f3 ) | ||
echo " <dataset name=\"${NAME}\" ID=\"${X}\" urlPath=\"${DSPATH}${X}\" serviceName=\"all\">" | ||
echo ' </dataset>' | ||
done | ||
echo ' </dataset>' | ||
echo ' </dataset>' | ||
echo ' </dataset>' | ||
} | ||
|
||
# ---------------------------------------------------------------------- | ||
# HEADER | ||
# ---------------------------------------------------------------------- | ||
cat << EOF | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<catalog name="THREDDS Server Default Catalog : You must change this to fit your server!" | ||
xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0 | ||
http://www.unidata.ucar.edu/schemas/thredds/InvCatalog.1.0.6.xsd"> | ||
|
||
<service name="all" base="" serviceType="compound"> | ||
<service name="odap" serviceType="OpenDAP" base="/thredds/dodsC/" /> | ||
<service name="dap4" serviceType="DAP4" base="/thredds/dap4/" /> | ||
<service name="http" serviceType="HTTPServer" base="/thredds/fileServer/" /> | ||
<!--service name="wcs" serviceType="WCS" base="/thredds/wcs/" /--> | ||
<!--service name="wms" serviceType="WMS" base="/thredds/wms/" /--> | ||
<service name="ncss" serviceType="NetcdfSubset" base="/thredds/ncss/" /> | ||
</service> | ||
|
||
<datasetRoot path="uamac_hs" location="/home/sites/ua-mac/Level_1/vnir_netcdf"/> | ||
|
||
<dataset name="TERRA" ID="TERRA"> | ||
EOF | ||
|
||
# ---------------------------------------------------------------------- | ||
# DATASETS | ||
# ---------------------------------------------------------------------- | ||
dataset "/home/sites/ua-mac/Level_1/vnir_netcdf" "uamac_hs" "UAMac Hyperspectral" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are steps for adding
|
||
|
||
# ---------------------------------------------------------------------- | ||
# FOOTER | ||
# ---------------------------------------------------------------------- | ||
echo ' </dataset>' | ||
echo '</catalog>' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?example useage (could you paste the crontab here?)
Link to live website as example
Is there a Dockerfile for the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to data use policy here, and to the published webpage