gd_retrieve

Retrieves a file, variable or metadata from the archive to the local machine.

   

Syntax

filename = gd_retrieve(ID,filename)

filename = gd_retrieve(ID,directory)

filename = gd_retrieve(ID,filename,[],'overwrite')

filename = gd_retrieve(ID,directory,[],'overwrite')

v = gd_retrieve(ID)

metadata = gd_retrieve(ID,[],'metadata')

 

Description

The ID needed to retrieve some data can be found in its metadata as standard.ID, and is also returned by gd_archive.

 

filename = gd_retrieve(ID,filename) retrieves a file from the archive based on its unique identifier (ID) and saves it to a local file specified by the filename string. The function returns the retrieved file’s new location as a string, which is equal to the filename argument in this case. If a file exists with the same name a prompt will appear asking whether to overwrite it.

 

filename = gd_retrieve(ID,directory) retrieves a file from the archive based on its unique identifier (ID) and saves it to a local directory specified by the directory string. The original name of the file will be used, which is determined by the standard.localName property in the file’s metadata, see gd_archive and gd_query. The function returns the retrieved file’s new location as a string.

 

filename = gd_retrieve(ID,filename,[],'overwrite') retrieves a file and saves it to the local file system. If a file exists with the same name it will be overwritten without prompting. This is also the case when a directory is given as the second argument.

 

v = gd_retrieve(ID) returns a variable from the archive to the Matlab workspace based on its unique identifier (ID).

 

metadata = gd_retrieve (ID,[],'metadata') will return a metadata structure which corresponds to the file, variable or datagroup identified by ID. This is a shortcut, as the same result can be achieved using gd_query.

 

Examples

 

Retrieve a file and save it with a specific file name.

           

fileID = gd_archive('C:\file.dat');

gd_retrieve(fileID,'C:\filesdir\myfile.dat')

 

ans =

C:\filesdir\myfile.dat

 

Retrieve a file to a directory and use its original name.

 

gd_retrieve(fileID,'C:\filesdir')

 

ans =

C:\filesdir\file.dat

 

Retrieve a variable to the Matlab workspace.

 

v.width = 12;

v.height = 6;

varID = gd_archive(v);

x = gd_retrieve(varID)

 

x =

     width: 12

    height: 6

 

Retrieve some metadata about a file.

 

m = gd_retrieve(fileID,[],'metadata');

 

Notes

You can only retrieve data that you archived or that someone else has given you permission to access.

 

A valid proxy certificate is required to retrieve a file, variable or metadata (see gd_createproxy from the Geodise Compute Toolbox).

 

You must have access to the host machine the files will be retrieved from. Your certificate subject must be added to the gridmap file on the host and to the authorisation database.

 

See also

gd_retrievefiles, gd_archive, gd_archivefiles, gd_datagroup, gd_datagroupadd, gd_query, gd_createproxy



gd_querydeleted

contents

gd_retrievefiles

Copyright © 2007, The Geodise Project, University of Southampton