Automating Google Workspace (GWS) & more with Apps Script
Metadata/Time-Date Tools (Toolkit_MTD)
1. EOS
DATA INFORMATION SYSTEM
EARTH PROBES
NASA'S MISSION TO PLANET EARTH
EARTH OBSERVING SYSTEM
Metadata/Time-Date Tools
(Toolkit_MTD)
Abe Taaheri , Megan Donovan Spencer , Larry Klein
(Space Applications Corp.)
Doug Ilg (RSTX)
September 23, 1998
2. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Overview
EOS
EARTH OBSERVING SYSTEM
• Science Data Production (SDP) TOOLKIT
• Metadata/Time-Date Tools (TOOLKIT_MTD)
• Metadata Tools
• Time/Date Tools
• Example (call sequences)
LK-2
3. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
SDP TOOLKIT
EOS
EARTH OBSERVING SYSTEM
• SDP TOOLKIT is an interface between EOS instrument data
producing software and the ECS production archival system.
• Besides the tools handling metadata and time/date conversion, it
includes many other tools such as :
- File I/O tools (IO)
- Error/Status Reporting (SMF)
- Process Control Tools (PC)
- Shared Memory Management Tools (MEM)
- Spacecraft Ephemeris and Attitude Data Access Tools (EPH)
- Digital Elevation Model Tools (DEM)
- Ancillary Data Tools (AA)
- Celestial Body Position Tools (CBP)
- Geo-Coordinate Transformation Tools (GCT)
LK-3
4. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Science Data Production and
Archival Scenario
EOS
EARTH OBSERVING SYSTEM
(Generated by
Processing)
(Generated by Science
Data Server)
PCF
File
2
Inventory
Metadata
(ASCII File)
Metadata
Configuration
File
Product
4
SDP Toolkit
3
5
Inventory Metadata
Archive Metadata
Product Generation
1
Executable (PGE)
Scientific Data Set
Inputs
Science Data Processing
Scientific Data Set
Structural Metadata
(HDF-EOS Only)
(HDF)
LK-4
5. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
SDP TOOLKIT (cont.)
EOS
EARTH OBSERVING SYSTEM
• EOSDIS extended data providers will not need the entire TOOLKIT to
handle metadata and data structures (HDF-EOS, HDF)
• This necessitated creating a smaller package to allow these
providers the capability of formatting their products in ECS standard
formats, without requiring the entire SDP toolkit package
• The smaller package could also be used by application developers
LK-5
6. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Toolkit_MTD
EOS
EARTH OBSERVING SYSTEM
• Tools relevant to metadata and time/date conversion tools are
extracted from Science Data Processing (SDP) Toolkit
• Process Control File, that contains Process Control information
for I/O, is replaced by a short file mapping logical identifiers to
physical file names
• Errors are reported as in HDF and HDFEOS
• Installation Scripts are modified for quick installation of HDF,
HDFEOS, and Toolkit_MTD
• New functionality added to read Metadata from ASCII file
• Tested on SUN and SGI platforms, will be ported to other unix
platforms; HP, DEC, IBM, and also Windows and Mac
LK-6
7. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Metadata Tools
EOS
EARTH OBSERVING SYSTEM
• PGS_MET_SetFileId()
Sets logical IDs assigned for the user defined files.
• PGS_MET_GetFileId(char *filename)
Retrieves logical ID assigned for a file.
• PGS_MET_Init(PGSt_PC_Logical
PGSt_MET_all_handles
Initializes MCF file containing metadata.
fileId,
mdHandles)
• PGS_MET_Init_NonMCF(PGSt_PC_Logical
fileId,
PGSt_MET_all_handles mdHandles)
Initializes an ASCII file containing metadata.
LK-7
8. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Metadata Tools (cont.)
EOS
EARTH OBSERVING SYSTEM
• PGS_MET_SetAttr(PGSt_MET_handle
mdHandle,
char
*attrNameStr,
void
*attrValue)
Assigns values to metadata attributes (after initializing MCF file).
• PGS_MET_GetSetAttr(PGSt_MET_handle mdHandle,
char*
attrNameStr,
void*
attrValue)
Retrieves values that are set automatically, or by the user.
• PGS_MET_GetPCAttr(PGSt_PC_Logical fileId,
PGSt_integer
version,
char
*hdfAttrName,
char*
Name,
void *
parmValue)
Reads metadata parameters held in HDF attributes or in a
separate ASCII file.
LK-8
9. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Metadata Tools (cont.)
EOS
EARTH OBSERVING SYSTEM
• PGS_MET_GetConfigData(char* attrName,
void* attrValue)
Certain configuration parameters are held in the
configfile as “10220|REMOTEHOST|sandcrab”.
This tool would retrieve the value "sandcrab" from the
configfile given the name of the parameter "REMOTEHOST".
• PGS_MET_Write(PGSt_MET_handle
mdHandle,
char *
hdfAttrName,
PGSt_integer
hdfFileId)
Writes metadata after all the metadata parameters are set in
memory. Tool checks that all the mandatory parameters are set.
• PGS_MET_Remove()
Removes ODL representation of all MCF files and some
internal files used by the MET tools.
LK-9
10. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Time/Date Tools
EOS
EARTH OBSERVING SYSTEM
• PGS_TD_UTCtoTAI( char
asciiUTC[28],
PGSt_double *secTAI93 )
Converts UTC time in CCSDS ASCII Time Code (A or B format)
to Toolkit internal time (real continuous seconds since
12AM UTC 1-1-93).
• PGS_TD_TAItoUTC( PGSt_double secTAI93,
char
asciiUTC[28])
Converts Toolkit internal time (real continuous seconds
since 12AM UTC 1-1-93) to UTC time in CCSDS ASCII
Time Code A format.
LK-10
12. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example
EOS
EARTH OBSERVING SYSTEM
/* include files */
#include <PGS_MET.h>
#include <PGS_tk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hdf.h>
#include <mfhdf.h>
#include <PGS_SMF.h>
#define INVENTORYMETADATA 1
#define ARCHIVEDMETADATA 2
#define ODL_IN_MEMORY 0
LK-12
13. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
int main()
{
/***** Declarations *****/
PGSt_MET_all_handles mdHandles;
PGSt_SMF_status ret = PGS_S_SUCCESS;
PGSt_integer fileId, sdid, value,rtid;
PGSt_integer i, ival;
PGSt_integer version;
PGSt_double dval;
char *sval[5];
char *start_time = "";
char
my_HDF_file[PGSd_MET_FILE_PATH_MAX]="";
LK-13
14. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/**********************************
Associate logical IDs with physical
filenames
***********************************/
ret = PGS_MET_SetFileId();
/* get values from Config file */
ret = PGS_MET_GetConfigData(“Runtime_ID”,&rtid);
ret = PGS_MET_GetConfigData(“VERSION_NUMBER”,&ival);
ret = PGS_MET_GetConfigData(“STARTTIME”,
&start_time);
LK-14
15. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/* get value from metadata block of input file */
ret = PGS_MET_GetPCAttr(10265,1,INVENTORYMETADATA,
"EquatorCrossingLongitude",&dval);
/* get value from ASCII metadata file */
ret = PGS_MET_GetPCAttr(5731,1,”coremetadata”,
”TestingAttribute1",&sval);
for(i=0; i<1; i++) printf(“%s”,sval);
printf(“n”);
LK-15
16. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/* Initialize MCF file */
fileId = 10250;
ret = PGS_MET_Init(fileId,mdHandles);
if (ret !=PGS_S_SUCCESS)
{
printf("initialization failedn");
exit(1);
}
/* assign value to attribute in MCF */
ret = PGS_MET_SetAttr(mdHandles[1],
"LocalVersionID",&ival);
LK-16
17. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
ret = PGS_MET_SetAttr(mdHandles[1],
”EquatorCrossingLongitude",&dval);
ret = PGS_MET_SetAttr(mdHandles[1],
”RANGEBEGININGDATETIME",&start_time);
ret = PGS_MET_SetAttr(mdHandles[1],
"ParameterValue.1",57.5)
/* assign value to attribute in MCF
in Archive block
*/
ret = PGS_MET_SetAttr(mdHandles[2],
"Runtime_ID",&rtid);
LK-17
18. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/* Read back in value of attribute in memory */
ret = PGS_MET_GetSetAttr(mdHandles[2],
"Runtime_ID",&rtid);
/* Write metadata to HDF and ASCII files */
version =1;
fileId = 5039;
ret = PGS_PC_GetReference(fileId,
&version, my_HDF_file);
if (ret == PGS_S_SUCCESS)
{
sdid = SDstart(my_HDF_file,DFACC_CREATE);
}
LK-18
19. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/* write INVENTORYMETADATA to HDF file */
ret = PGS_MET_Write(mdHandles[INVENTORYMETADATA],
"coremetadata",sdid);
/* write ARCHIVEDMETADAT to HDF file */
ret = PGS_MET_Write(mdHandles[ARCHIVEDMETADATA],
"archivemetadata",sdid);
/* write to non-HDF file */
fileId = 5804;
ret = PGS_MET_Write(mdHandles[ODL_IN_MEMORY],
NULL,fileId);
LK-19
20. NASA'S MISSION TO PLANET EARTH
EARTH PROBES
DATA INFORMATION SYSTEM
Example (cont.)
EOS
EARTH OBSERVING SYSTEM
/* write to default non-HDF file */
ret = PGS_MET_Write(mdHandles[ODL_IN_MEMORY],
NULL, NULL);
SDend(sdid);
/* Remove MCF from memory */
ret = PGS_MET_Remove();
}
LK-20