MISR Toolkit  1.5.1
Functions
MtkReadData.c File Reference
#include "MisrReadData.h"
#include "MisrFileQuery.h"
#include "MisrError.h"
#include <stdlib.h>
#include <string.h>
#include <hdf.h>
#include <HdfEosDef.h>
#include <netcdf.h>

Go to the source code of this file.

Functions

MTKt_status MtkReadData (const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
 Reads any grid/field from any MISR product file and performs unpacking or unscaling. It also reads any MISR conventional product file. More...
 
MTKt_status MtkReadDataHDF (const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
 
MTKt_status MtkReadDataNC (const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
 
MTKt_status MtkReadDataFid (int32 fid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
 Version of MtkReadData that takes an HDF-EOS file identifier rather than a filename. More...
 
MTKt_status MtkReadDataNcid (int ncid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
 Version of MtkReadData that takes a netCDF file identifier rather than a filename. More...
 

Function Documentation

◆ MtkReadData()

MTKt_status MtkReadData ( const char *  filename,
const char *  gridname,
const char *  fieldname,
MTKt_Region  region,
MTKt_DataBuffer databuf,
MTKt_MapInfo mapinfo 
)

Reads any grid/field from any MISR product file and performs unpacking or unscaling. It also reads any MISR conventional product file.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we read a region centered at lat 35.0, lon -115.0 with a lat extent of 110.0km and lon extent 110.0km. We read from the field AveSceneElev in the grid Standard in the file MISR_AM1_AGP_P037_F01_24.hdf
char *error_mesg[] = MTK_ERR_DESC;
status = MtkSetRegionByLatLonExtent(35.0, -115.0, 110.0, 110.0, "km", &region);
status = MtkReadData("MISR_AM1_AGP_P037_F01_24.hdf", "Standard", "AveSceneElev", region, &databuf, &mapinfo);
if (status != MTK_SUCCESS) {
printf("%s\n",error_mesg[status]);
}
Note
The caller is responsible for using MtkDataBufferFree() to free the memory used by databuf
The MISR Toolkit read functions always return a 2-D data plane buffer. Some fields in the MISR data products are multi-dimensional. In order to read one of these fields, the slice to read needs to be specified. A bracket notation on the fieldname is used for this purpose. For example fieldname = "RetrAppMask[0][5]".
Additional dimensions can be determined by the routine MtkFileGridFieldToDimlist() or by the MISR Data Product Specification (DPS) Document. The actually definition of the indices are not described in the MISR product files and thus not described by the MISR Toolkit. These will have to be looked up in the MISR DPS. All indices are 0-based.
Parameters
[in]filenameFile name
[in]gridnameGrid name
[in]fieldnameField name
[in]regionRegion
[out]databufData buffer
[out]mapinfoMapinfo

Definition at line 62 of file MtkReadData.c.

◆ MtkReadDataFid()

MTKt_status MtkReadDataFid ( int32  fid,
const char *  gridname,
const char *  fieldname,
MTKt_Region  region,
MTKt_DataBuffer databuf,
MTKt_MapInfo mapinfo 
)

Version of MtkReadData that takes an HDF-EOS file identifier rather than a filename.

Returns
MTK_SUCCESS if successful.
Parameters
[in]fidHDF-EOS file identifier
[in]gridnameGrid name
[in]fieldnameField name
[in]regionRegion
[out]databufData buffer
[out]mapinfoMapinfo

Definition at line 157 of file MtkReadData.c.

◆ MtkReadDataHDF()

MTKt_status MtkReadDataHDF ( const char *  filename,
const char *  gridname,
const char *  fieldname,
MTKt_Region  region,
MTKt_DataBuffer databuf,
MTKt_MapInfo mapinfo 
)
Parameters
[in]filenameFile name
[in]gridnameGrid name
[in]fieldnameField name
[in]regionRegion
[out]databufData buffer
[out]mapinfoMapinfo

Definition at line 78 of file MtkReadData.c.

◆ MtkReadDataNC()

MTKt_status MtkReadDataNC ( const char *  filename,
const char *  gridname,
const char *  fieldname,
MTKt_Region  region,
MTKt_DataBuffer databuf,
MTKt_MapInfo mapinfo 
)
Parameters
[in]filenameFile name
[in]gridnameGrid name
[in]fieldnameField name
[in]regionRegion
[out]databufData buffer
[out]mapinfoMapinfo

Definition at line 113 of file MtkReadData.c.

◆ MtkReadDataNcid()

MTKt_status MtkReadDataNcid ( int  ncid,
const char *  gridname,
const char *  fieldname,
MTKt_Region  region,
MTKt_DataBuffer databuf,
MTKt_MapInfo mapinfo 
)

Version of MtkReadData that takes a netCDF file identifier rather than a filename.

Returns
MTK_SUCCESS if successful.
Parameters
[in]ncidHDF-EOS file identifier
[in]gridnameGrid name
[in]fieldnameField name
[in]regionRegion
[out]databufData buffer
[out]mapinfoMapinfo

Definition at line 261 of file MtkReadData.c.


MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53