Skip to content

Commit

Permalink
Adding support for ingestion of the N1 products.
Browse files Browse the repository at this point in the history
  • Loading branch information
pacesm committed Nov 11, 2014
1 parent 8011d9b commit 72d039f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
52 changes: 31 additions & 21 deletions ingeng/product_ingest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,18 @@ META="`get_path METADATA_EOP20`"
RANGET="`get_path RANGE_TYPE`"
IDENTIFIER="`get_field IDENTIFIER`"
SRS="`get_field SRS`"
CONTENT_TYPE="`get_field 'Content-Type'`"

[ -n "$META" ] || META="`expr "$DATA" : '\(.*\)\.[a-zA_Z]*'`.xml"
[ -n "$RANGET" ] || RANGET="`expr "$DATA" : '\(.*\)\.[a-zA_Z]*'`_range_type.json"
[ -n "$VIEW" ] || VIEW="`expr "$DATA" : '\(.*\)\.[a-zA_Z]*'`_view.tif"
[ -n "$VIEW_OVR" ] || VIEW_OVR="`expr "$DATA" : '\(.*\)\.[a-zA_Z]*'`_view.tif.ovr"
[ -n "$CONTENT_TYPE" ] || CONTENT_TYPE="image/tiff"

EOP_VER="2.0"
EOP="http://www.opengis.net/eop/$EOP_VER"
OPT="http://www.opengis.net/opt/$EOP_VER"
SAR="http://www.opengis.net/opt/$EOP_VER"
SAR="http://www.opengis.net/sar/$EOP_VER"

if [ ! -f "$META" ]
then
Expand Down Expand Up @@ -163,6 +165,34 @@ else # RGB preview
_type="RGB"
_bands="-b 1 -b 2 -b 3"
fi

# add collection name as a prefix of the coverage identifier
COLLECTION_NOCOLON="`echo "$COLLECTION" | sed -e 's/:/./g'`"
[ -z "`echo "$IDENTIFIER" | grep "^$COLLECTION_NOCOLON\."`" ] && IDENTIFIER="$COLLECTION_NOCOLON.$IDENTIFIER"

# make sure the EOP metadata XML file contains the right identifier
_set_eop_identifier "$META" "$IDENTIFIER"

# append EOP2.0 metadata and range-type to the manifest
update_field IDENTIFIER "$IDENTIFIER"
[ -n "$DATADIR" ] && set_path DOWNLOAD_DIR "$DATADIR"
set_path DATA "$DATA"
set_path VIEW "$VIEW"
set_path VIEW_OVR "$VIEW_OVR"
[ -n "$COVDESCR" ] && set_path METADATA "$COVDESCR"
set_path METADATA_EOP20 "$META"
update_path RANGE_TYPE "$RANGET"
[ -n "$SRS" ] && set_field SRS "$SRS"
# log the content of the manifest file
cat "$MANIFEST" | info_pipe

# special treatment for the Envisat products
if [ "$CONTENT_TYPE" == 'application/x-esa-envisat' ]
then
"`dirname $0`/product_add.sh" -data="$DATA" ${CATREG:+-catreg=}$CATREG && exit 0 || exit 1
fi

# anything else processed hereafter ...
if [ ! -f "$VIEW" ]
then
info "Generating browse image ..."
Expand Down Expand Up @@ -203,26 +233,6 @@ then
[ -n "$_levels" ] && time "$GDALADDO" $_adoopt "$VIEW" $_levels
fi

# add collection name as a prefix of the coverage identifier
COLLECTION_NOCOLON="`echo "$COLLECTION" | sed -e 's/:/./g'`"
[ -z "`echo "$IDENTIFIER" | grep "^$COLLECTION_NOCOLON\."`" ] && IDENTIFIER="$COLLECTION_NOCOLON.$IDENTIFIER"

# make sure the EOP metadata XML file contains the right identifier
_set_eop_identifier "$META" "$IDENTIFIER"

# append EOP2.0 metadata and range-type to the manifest
update_field IDENTIFIER "$IDENTIFIER"
[ -n "$DATADIR" ] && set_path DOWNLOAD_DIR "$DATADIR"
set_path DATA "$DATA"
set_path VIEW "$VIEW"
set_path VIEW_OVR "$VIEW_OVR"
[ -n "$COVDESCR" ] && set_path METADATA "$COVDESCR"
set_path METADATA_EOP20 "$META"
update_path RANGE_TYPE "$RANGET"
[ -n "$SRS" ] && set_field SRS "$SRS"
# log the content of the manifest file
cat "$MANIFEST" | info_pipe

#-----------------------------------------------------------------------------
# register dataset

Expand Down
2 changes: 1 addition & 1 deletion ingeng/products.d/envisat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ END
IMG_DATA="${DATA}"
IMG_META="${IMG_DATA%.*}.xml"
IMG_RTYPE="${IMG_DATA%.*}_range_type.json"
IMG_VIEW="${IMG_DATA%.*}_RGB_WGS84.tif"
IMG_VIEW="${IMG_DATA%.*}_view.tif"
IMG_VIEW_OVR="${IMG_VIEW}.ovr"

_tmp_eop_xml="${IMG_META}_eop.xml"
Expand Down
2 changes: 1 addition & 1 deletion ingeng/products.d/spot6_ortho.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ then
else
IMG_DATA="$IMG_DIR/`xml_extract.py "$META" '//Data_Access/Data_Files/Data_File/DATA_FILE_PATH/@href' `" || exit 1
fi
IMG_VIEW="${IMG_DATA%.*}_RGB_WGS84.vrt"
IMG_VIEW="${IMG_DATA%.*}_view.vrt"
IMG_VIEW_OVR="${IMG_VIEW}.ovr"
IMG_META="${IMG_DATA%.*}.xml"
IMG_RTYPE="${IMG_DATA%.*}_range_type.json"
Expand Down
2 changes: 1 addition & 1 deletion ingeng/products.d/spotscene_1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
IMG_DIR="`dirname "$META"`"
IMG_DIR="`_expand "$IMG_DIR"`"
IMG_DATA="$IMG_DIR/$_data"
IMG_VIEW="${IMG_DATA%.*}_RGB_WGS84.tif"
IMG_VIEW="${IMG_DATA%.*}_view.tif"
IMG_VIEW_OVR="${IMG_VIEW}.ovr"
IMG_META="${IMG_DATA%.*}.xml"
IMG_RTYPE="${IMG_DATA%.*}_range_type.json"
Expand Down
2 changes: 1 addition & 1 deletion ingeng/products.d/spotview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
IMG_DIR="`dirname "$META"`"
IMG_DIR="`_expand "$IMG_DIR"`"
IMG_DATA="$IMG_DIR/$_data"
IMG_VIEW="${IMG_DATA%.*}_RGB_WGS84.tif"
IMG_VIEW="${IMG_DATA%.*}_view.tif"
IMG_VIEW_OVR="${IMG_VIEW}.ovr"
IMG_META="${IMG_DATA%.*}.xml"
IMG_RTYPE="${IMG_DATA%.*}_range_type.json"
Expand Down

0 comments on commit 72d039f

Please sign in to comment.