Skip to content

SPICE_INGEST

Martin Wiesmann edited this page Apr 30, 2024 · 6 revisions

Description

This routine takes as input a SPICE filename (or list of files, or a directory) and correctly places them in the SPICE data tree, creating new directories if necessary. The environment variable SPICE_DATA needs to be defined.

Syntax

spice_ingest [, filename] [, path_index= path_index] [, /force] [, /nolevel] [, /search_subdir] [, /help] [, /user_dir] [, top_dir=top_dir] [, dry_run=dry_run] [, destination=destination] [, file_moved=file_moved] [, files_found=files_found]

Arguments

filename

The name and path of a SPICE file. Can be an array of names. Or a directory (scalar), then all spice files in this directory will be moved. If not provided, all files from the current directory will be moved.

Optional inputs

path_index

If $SPICE_DATA or TOP_DIR contains multiple paths, then this keyword allows you to specify to which path you send the file(s). Default is 0.

top_dir

A path to a directory in which the file should be saved. The necessary subdirectories will be created (e.g. level2/2020/03/26).

Keywords

force

By default the routine will not overwrite a file that already exists in the destination directory. Setting 'force' allows the file to be overwritten.

nolevel

If set, then the level part of the default path is omitted (e.g. $SPICE_DATA/2020/06/21/ instead of $SPICE_DATA/level2/2020/06/21/).

search_subdir

If set and 'filename' is a directory, then the program looks for spice files recurrently, i.e. in all subdirectories.

help

If set, then a help message is printed.

user_dir

If set, the file(s) will be moved into $SPICE_DATA/user/ instead of $SPICE_DATA/

dry_run

If set, the file won't be moved, no directories will be created. The optional outputs will be the same as if this keyword was not set.

Optional Output

destination

Set this keyword to a named variable that receives a string array of same length than 'filename' or, in case 'filename' is a directory, of length of the number of files found in that directory. Contains the paths of each file after the move. This path is identical to its origin if the file hasn't been moved.

file_moved

Set this keyword to a named variable that receives an integer array of same length than 'destination'. Indicates which files have been moved (1=moved, 0=not moved).

files_found

Set this keyword to a named variable that receives a string array of same length than 'destination'. Contains all files that have been found, if input was a directory. Else it is identical to 'filename'.

Example

This would move all SPICE FITS files from the current directory into the $SPICE_DATA directory:

spice_ingest

Clone this wiki locally