/* * Class: hdf_hdf5lib_H5 * Method: H5get_libversion * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5get_1libversion (JNIEnv *env, jclass clss, jintArray libversion) { unsigned *theArray = NULL; herr_t status = -1; jboolean isCopy; if (libversion == NULL) { h5nullArgument(env, "H5get_version: libversion is NULL"); } /* end if */ else { theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy); if (theArray == NULL) { h5JNIFatalError( env, "H5get_libversion: input not pinned"); } /* end if */ else { status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2])); if (status < 0) { ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT); h5libraryError(env); } /* end if */ ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0); } /* end else */ } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5get_1libversion */
//-------------------------------------------------------------------------- // Function: H5Library::getLibVersion (static) ///\brief Returns the HDF library release number. ///\param majnum - OUT: Major version of the library ///\param minnum - OUT: Minor version of the library ///\param relnum - OUT: Release number of the library ///\exception H5::LibraryIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum) { herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum); if (ret_value < 0) { throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed"); } }
void H5File::getFileHDF5Version(unsigned int * out) const { herr_t err = H5get_libversion(out, out + 1, out + 2); if (err < 0) { throw H5Exception(__LINE__, __FILE__, _("Cannot retrieve file version: %s"), filename.c_str()); } }
/* * Print test info. */ void TestInfo(const char *ProgName) { unsigned major, minor, release; H5get_libversion(&major, &minor, &release); print_func("\nFor help use: %s -help\n",ProgName); print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); }
/** * @brief return the HDF5 version in use at runtime. * * @result description of the current HDF5 version. */ const char *hdf5_version(void) { static char version[256] = {0}; #ifdef HAVE_HDF5 unsigned int majnum, minnum, relnum; H5get_libversion(&majnum, &minnum, &relnum); sprintf(version, "%i.%i.%i", majnum, minnum, relnum); #else sprintf(version, "Unknown version"); #endif return version; }
/* * Determine api version. */ static void HDF5_SetVersion(IOR_param_t * test) { unsigned major, minor, release; if (H5get_libversion(&major, &minor, &release) < 0) { WARN("cannot get HDF5 library version"); } else { sprintf(test->apiVersion, "%s-%u.%u.%u", test->api, major, minor, release); } #ifndef H5_HAVE_PARALLEL strcat(test->apiVersion, " (Serial)"); #else /* H5_HAVE_PARALLEL */ strcat(test->apiVersion, " (Parallel)"); #endif /* not H5_HAVE_PARALLEL */ }
/*--------------------------------------------------------------------------- * Name: h5get_libversion_c * Purpose: Calls H5get_libversion function * to retrieve library version info. * Inputs: * None * Outputs: * majnum - the major version of the library * minnum - the minor version of the library * relnum - the release version of the library * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) { int ret_value = -1; unsigned c_majnum, c_minnum, c_relnum; if (H5get_libversion(&c_majnum, &c_minnum, &c_relnum) < 0) return ret_value; *majnum = (int_f)c_majnum; *minnum = (int_f)c_minnum; *relnum = (int_f)c_relnum; ret_value = 0; return ret_value; }
/*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib4 * * Purpose: A dynlib4 filter method that adds on and subtract from * the original value with another value. It will be built * as a shared library. plugin.c test will load and use * this filter library. Designed to call a HDF function. * * Return: Success: Data chunk size * * Failure: 0 * *------------------------------------------------------------------------- */ static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { int *int_ptr = (int *)*buf; /* Pointer to the data values */ size_t buf_left = *buf_size; /* Amount of data buffer left to process */ int add_on = 0; unsigned ver_info[3]; /* Check for the library version */ if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) { PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion"); return(0); } /* Check for the correct number of parameters */ if(cd_nelmts == 0) return(0); /* Check that permanent parameters are set correctly */ if(cd_values[0] > 9) return(0); if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) { PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match"); return(0); } add_on = (int)cd_values[0]; if(flags & H5Z_FLAG_REVERSE) { /*read*/ /* Substract the "add on" value to all the data values */ while(buf_left > 0) { *int_ptr++ -= add_on; buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /*write*/ /* Add the "add on" value to all the data values */ while(buf_left > 0) { *int_ptr++ += add_on; buf_left -= sizeof(int); } /* end while */ } /* end else */ return nbytes; } /* end H5Z_filter_dynlib4() */
/* * Determine api version. */ static char * HDF5_GetVersion() { static char version[1024] = {0}; if(version[0]) return version; unsigned major, minor, release; if (H5get_libversion(&major, &minor, &release) < 0) { WARN("cannot get HDF5 library version"); } else { sprintf(version, "%u.%u.%u", major, minor, release); } #ifndef H5_HAVE_PARALLEL strcat(version, " (Serial)"); #else /* H5_HAVE_PARALLEL */ strcat(version, " (Parallel)"); #endif /* not H5_HAVE_PARALLEL */ return version; }
std::string H5File::toString(const unsigned int indentLevel) const { herr_t err; hsize_t size = 0; std::ostringstream os; unsigned int major = 0, minor = 0, release = 0; std::string indentString = H5Object::getIndentString(indentLevel + 1); err = H5Fget_filesize(file, &size); if (err < 0) { throw H5Exception(__LINE__, __FILE__, _("Cannot retrieve file size: %s"), filename.c_str()); } err = H5get_libversion(&major, &minor, &release); os << H5Object::getIndentString(indentLevel) << "HDF5 File" << std::endl << indentString << "Filename" << ": " << filename << std::endl << indentString << "Version" << ": " << major << "." << minor << "." << release << std::endl << indentString << "Size" << ": " << size << std::endl << indentString << "Root" << ": /" << std::endl; return os.str(); }
/*------------------------------------------------------------------------- * Function: test_dataset_write_with_filters * * Purpose: Tests creating datasets and writing data with dynamically loaded filters * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t test_dataset_write_with_filters(hid_t fid) { hid_t dcpl_id = -1; /* Dataset creation property list ID */ unsigned int compress_level; /* Deflate compression level */ unsigned int filter1_data; /* Data used by filter 1 */ unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */ /*---------------------------------------------------------- * STEP 1: Test deflation by itself. *---------------------------------------------------------- */ HDputs("Testing dataset writes with deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) TEST_ERROR; compress_level = 6; if (H5Pset_deflate(dcpl_id, compress_level) < 0) TEST_ERROR; /* Ensure the filter works */ if (ensure_filter_works(fid, DSET_DEFLATE_NAME, dcpl_id) < 0) TEST_ERROR; /* Clean up objects used for this test */ if (H5Pclose(dcpl_id) < 0) TEST_ERROR; #else /* H5_HAVE_FILTER_DEFLATE */ SKIPPED(); HDputs(" Deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ /*---------------------------------------------------------- * STEP 2: Test filter plugin 1 by itself. *---------------------------------------------------------- */ HDputs(" dataset writes with filter plugin 1"); if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) TEST_ERROR; /* Set up the filter, passing in the amount the filter will add and subtract * from each data element. Note that this value has an arbitrary max of 9. */ filter1_data = 9; if (H5Pset_filter(dcpl_id, FILTER1_ID, H5Z_FLAG_MANDATORY, (size_t)1, &filter1_data) < 0) TEST_ERROR; /* Ensure the filter works */ if (ensure_filter_works(fid, DSET_FILTER1_NAME, dcpl_id) < 0) TEST_ERROR; /* Clean up objects used for this test */ if (H5Pclose(dcpl_id) < 0) TEST_ERROR; /* Unregister the dynamic filter for testing purpose. The next time when this test is run for * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries * for this filter. */ if (H5Zunregister(FILTER1_ID) < 0) TEST_ERROR; /*---------------------------------------------------------- * STEP 3: Test filter plugin 2 by itself. *---------------------------------------------------------- */ HDputs(" dataset writes with filter plugin 2"); if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) TEST_ERROR; if (H5Pset_filter(dcpl_id, FILTER2_ID, H5Z_FLAG_MANDATORY, 0, NULL) < 0) TEST_ERROR; /* Ensure the filter works */ if (ensure_filter_works(fid, DSET_FILTER2_NAME, dcpl_id) < 0) TEST_ERROR; /* Clean up objects used for this test */ if (H5Pclose(dcpl_id) < 0) TEST_ERROR; /* Unregister the dynamic filter for testing purpose. The next time when this test is run for * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries * for this filter. */ if (H5Zunregister(FILTER2_ID) < 0) TEST_ERROR; /*---------------------------------------------------------- * STEP 4: Test filter plugin 3 by itself. * (This filter plugin makes HDF5 API calls) *---------------------------------------------------------- */ HDputs(" dataset writes with filter plugin 3"); if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0) TEST_ERROR; /* Set the add/subtract value for the filter */ libver_values[0] = 9; /* Get the library bounds and add to the filter data */ if (H5get_libversion(&libver_values[1], &libver_values[2], &libver_values[3]) < 0) TEST_ERROR; if (H5Pset_filter(dcpl_id, FILTER3_ID, H5Z_FLAG_MANDATORY, (size_t)4, libver_values) < 0) TEST_ERROR; /* Ensure the filter works */ if (ensure_filter_works(fid, DSET_FILTER3_NAME, dcpl_id) < 0) TEST_ERROR; /* Clean up objects used for this test */ if (H5Pclose(dcpl_id) < 0) TEST_ERROR; /* Unregister the dynamic filter for testing purpose. The next time when this test is run for * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries * for this filter. */ if (H5Zunregister(FILTER3_ID) < 0) TEST_ERROR; return SUCCEED; error: /* Clean up objects used for this test */ H5E_BEGIN_TRY { H5Pclose(dcpl_id); } H5E_END_TRY return FAIL; } /* end test_dataset_write_with_filters() */
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //restoreGeometry( opts.mainwindowgeometry); //restoreState( opts.windowstate ); setupStatusBar(); satlist = new SatelliteList(); seglist = new AVHRRSatellite(this, satlist); formephem = new FormEphem(this, satlist, seglist); ui->stackedWidget->addWidget(formephem); // index 0 formtoolbox = NULL; formgeostationary = new FormGeostationary(this, satlist, seglist); ui->stackedWidget->addWidget(formgeostationary); // index 1 cylequidist = new CylEquiDist( opts.backgroundimage2D ); mapcyl = new MapFieldCyl(this, cylequidist, satlist, seglist); globe = new Globe(this, satlist, seglist); formimage = new FormImage(this, satlist, seglist); imagescrollarea = new ImageScrollArea(); imagescrollarea->setBackgroundRole(QPalette::Dark); imagescrollarea->setWidget(formimage); formgeostationary->SetFormImage(formimage); connect(formimage, SIGNAL(moveImage(QPoint, QPoint)), this, SLOT(moveImage(QPoint, QPoint))); for( int i = 0; i < 8; i++) { connect(&seglist->seglmeteosat->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmeteosat->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmeteosat->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 24; i++) { connect(&seglist->seglmeteosat->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 8; i++) { connect(&seglist->seglmeteosatrss->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmeteosatrss->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmeteosatrss->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 24; i++) { connect(&seglist->seglmeteosatrss->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 8; i++) { connect(&seglist->seglmet8->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmet8->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglmet8->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 24; i++) { connect(&seglist->seglmet8->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 10; i++) { connect(&seglist->seglmet7->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 7; i++) { connect(&seglist->seglgoes13dc3->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 7; i++) { connect(&seglist->seglgoes15dc3->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 7; i++) { connect(&seglist->seglgoes13dc4->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } for( int i = 0; i < 7; i++) { connect(&seglist->seglgoes15dc4->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } connect(seglist->seglfy2e, SIGNAL(imagefinished()), formimage, SLOT(slotUpdateMeteosat())); connect(seglist->seglfy2g, SIGNAL(imagefinished()), formimage, SLOT(slotUpdateMeteosat())); for( int i = 0; i < 10; i++) { connect(&seglist->seglh8->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglh8->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); connect(&seglist->seglh8->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat())); } imageptrs->gvp = new GeneralVerticalPerspective(this, seglist); imageptrs->lcc = new LambertConformalConic(this, seglist); imageptrs->sg = new StereoGraphic(this, seglist); QMainWindow::setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); QMainWindow::setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); QMainWindow::setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); QMainWindow::setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); forminfrascales = new FormInfraScales(); formtoolbox = new FormToolbox(this, formimage, formgeostationary, forminfrascales, seglist); formimage->SetFormToolbox(formtoolbox); formgeostationary->SetFormToolBox(formtoolbox); connect(seglist->seglmeteosat, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglmeteosatrss, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglmet8, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglmet7, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglgoes13dc3, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglgoes15dc3, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglgoes13dc4, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglgoes15dc4, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglfy2e, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglfy2g, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglh8, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglviirsm, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglviirsdnb, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglolciefr, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglolcierr, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglmetop, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglnoaa, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglhrp, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglgac, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int))); connect(seglist->seglviirsdnb, SIGNAL(displayDNBGraph()), formtoolbox, SLOT(slotDisplayDNBGraph())); formglobecyl = new FormMapCyl( this, mapcyl, globe, formtoolbox, satlist, seglist); connect(seglist, SIGNAL(signalNothingSelected()), formglobecyl, SLOT(slotNothingSelected())); createDockWidget(); forminfrascales->setFormImage(formimage); addDockWidget(Qt::BottomDockWidgetArea, forminfrascales); forminfrascales->hide(); formimage->SetDockWidgetInfraScales(forminfrascales); ui->stackedWidget->addWidget(formglobecyl); // index 2 ui->stackedWidget->addWidget(imagescrollarea); // index 3 ui->stackedWidget->setCurrentIndex(0); connect(seglist->seglmetop, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglnoaa, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglhrp, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglgac, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglviirsm, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglviirsdnb, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabelDNB(bool))); connect(seglist->seglolciefr, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglolcierr, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglmetop, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglnoaa, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglhrp, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglgac, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglviirsm, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglviirsdnb, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglolciefr, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect(seglist->seglolcierr, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool))); connect( formglobecyl, SIGNAL(signalSegmentChanged(QString)), this, SLOT(updateStatusBarIndicator(QString)) ); connect( ui->stackedWidget, SIGNAL(currentChanged(int)),formglobecyl, SLOT(updatesatmap(int)) ); connect( formephem,SIGNAL(signalDirectoriesRead()), formgeostationary, SLOT(PopulateTree()) ); connect( seglist,SIGNAL(signalAddedSegmentlist()), formephem, SLOT(showSegmentsAdded())); connect( formephem,SIGNAL(signalDirectoriesRead()), formglobecyl, SLOT(setScrollBarMaximum())); connect( formglobecyl, SIGNAL(emitMakeImage()), formimage, SLOT(slotMakeImage())); connect( formtoolbox, SIGNAL(emitShowVIIRSImage()), formimage, SLOT(slotShowVIIRSMImage())); connect( formtoolbox, SIGNAL(emitShowOLCIefrImage()), formimage, SLOT(slotShowOLCIefrImage())); connect( formtoolbox, SIGNAL(emitShowOLCIerrImage()), formimage, SLOT(slotShowOLCIerrImage())); connect( globe , SIGNAL(mapClicked()), formephem, SLOT(showSelectedSegmentList())); connect( mapcyl , SIGNAL(mapClicked()), formephem, SLOT(showSelectedSegmentList())); connect( formephem, SIGNAL(signalDatagram(QByteArray)), seglist, SLOT(AddSegmentsToListFromUdp(QByteArray))); connect( formimage, SIGNAL(render3dgeo(SegmentListGeostationary::eGeoSatellite)), globe, SLOT(Render3DGeo(SegmentListGeostationary::eGeoSatellite))); connect( formimage, SIGNAL(allsegmentsreceivedbuttons(bool)), formtoolbox, SLOT(setToolboxButtons(bool))); connect( globe, SIGNAL(renderingglobefinished(bool)), formtoolbox, SLOT(setToolboxButtons(bool))); connect( formgeostationary, SIGNAL(geostationarysegmentschosen(SegmentListGeostationary::eGeoSatellite, QStringList)), formtoolbox, SLOT(geostationarysegmentsChosen(SegmentListGeostationary::eGeoSatellite, QStringList))); connect( formtoolbox, SIGNAL(getmeteosatchannel(QString, QVector<QString>, QVector<bool>)), formgeostationary, SLOT(CreateGeoImage(QString, QVector<QString>, QVector<bool>))); connect( formtoolbox, SIGNAL(screenupdateprojection()), formimage, SLOT(slotUpdateProjection())); connect( formtoolbox, SIGNAL(switchstackedwidget(int)), this, SLOT(slotSwitchStackedWindow(int))); connect( formgeostationary, SIGNAL(enabletoolboxbuttons(bool)), formtoolbox, SLOT(setToolboxButtons(bool))); formtoolbox->setChannelIndex(); setWindowTitle(tr("EUMETCast Viewer")); timer = new QTimer( this ); timer->start( 1000); connect(timer, SIGNAL(timeout()), formephem, SLOT(timerDone())); connect(timer, SIGNAL(timeout()), this, SLOT(timerDone())); herr_t h5_status; unsigned int majnum; unsigned int minnum; unsigned int relnum; h5_status = H5get_libversion(&majnum, &minnum, &relnum); qDebug() << QString("HDF5 library %1.%2.%3").arg(majnum).arg(minnum).arg(relnum); loadLayout(); }
/* ****************************************************************************************************************************** */ int main(int argc, char *argv[]) { hid_t fileID, dataSetID; herr_t hErrVal; int i; hsize_t dims[1024], maxDims[1024]; H5T_class_t class; char classStr[32]; hid_t dataTypeID; size_t dataSize; H5T_order_t order; int rank; /* Note this is an int, not an hssize_t */ int intVal; hid_t dataSpaceID; hid_t rootGroupID; hsize_t numInRootGrp, firstDataSetIdx, foundFirstDataSet; char attrName[1024], firstDataSetName[1024]; ssize_t objectNameSize, attrNameSize; H5G_stat_t objectStatInfo; int numAttrs; int curAttrIdx; hid_t attrID; hsize_t numDataPoints; unsigned majnum, minnum, relnum; /* Load the library -- not required most platforms. */ hErrVal = H5open(); mjrHDF5_chkError(hErrVal); /* Get the library version */ hErrVal = H5get_libversion(&majnum, &minnum, &relnum); mjrHDF5_chkError(hErrVal); printf("Lib Version: v%lu.%lur%lu\n", (unsigned long)majnum, (unsigned long)minnum, (unsigned long)relnum); /* Open an existing file. */ fileID = H5Fopen(TST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); mjrHDF5_chkError(fileID); /* Get the ID for the "root" group -- every HDF5 has one */ rootGroupID = H5Gopen(fileID, "/", H5P_DEFAULT); mjrHDF5_chkError(rootGroupID); /* Get the number of objects in the root group. */ hErrVal = H5Gget_num_objs(rootGroupID, &numInRootGrp); mjrHDF5_chkError(hErrVal); printf("The root group contains %lu object%c\n", (unsigned long)numInRootGrp, (numInRootGrp==1?' ':'s')); if(numInRootGrp < 1) { printf("As the file contains NO objects, I have nothing left to do...\n"); exit(1); } /* end if */ /* Find the first dataset in the root group. */ for(foundFirstDataSet=0,firstDataSetIdx=0; (!foundFirstDataSet)&&(firstDataSetIdx<numInRootGrp); firstDataSetIdx++) { /* Get object name from the index. */ objectNameSize = H5Gget_objname_by_idx(rootGroupID, firstDataSetIdx, firstDataSetName, 1024); mjrHDF5_chkError(objectNameSize); if(objectNameSize == 0) { /* Need to check for zero return too */ printf("ERROR: Object with index %lu doesn't exist in root group!\n", (unsigned long)firstDataSetIdx); exit(1); } /* end if */ /* Now use the object name to get info about the object... */ hErrVal = H5Gget_objinfo(rootGroupID, firstDataSetName, 0, &objectStatInfo); mjrHDF5_chkError(hErrVal); /* If the object is a dataset, then print out some info. */ if(objectStatInfo.type == H5G_DATASET) { printf("Object %luth (%s) is a dataset!\n", (unsigned long)firstDataSetIdx, firstDataSetName); printf("The name of the %luth object of the root group is: %s\n", (unsigned long)firstDataSetIdx, firstDataSetName); foundFirstDataSet = 1; printf("Info for the %s dataset:\n", firstDataSetName); printf(" Modify time: %lu\n", (unsigned long)objectStatInfo.mtime); printf(" Type: %lu\n", (unsigned long)objectStatInfo.type); printf(" Link count: %lu\n", (unsigned long)objectStatInfo.nlink); } /* end if */ } /* end for */ /* Note: At this point index of the dataset will be: firstDataSetIdx-- */ if(!foundFirstDataSet) { printf("ERROR: Could not find a dataset in the root group\n"); exit(1); } /* end if */ /* Open the dataset we found -- we know it exists. */ dataSetID = H5Dopen(rootGroupID, firstDataSetName, H5P_DEFAULT); mjrHDF5_chkError(dataSetID); /* ****************************************************************************************************************************** */ /* Get some info regarding the TYPE of the dataset. */ dataTypeID = H5Dget_type(dataSetID); mjrHDF5_chkError(dataTypeID); /* Get the class of the data */ class = H5Tget_class(dataTypeID); mjrHDF5_Tclass2str(class, classStr); printf(" Object class: %s\n", classStr); /* Get the size of the type */ dataSize = H5Tget_size(dataTypeID); if(dataSize == 0) { printf("ERROR: Failure in H5Tget_size().\n"); exit(1); } /* end if */ printf(" Size of data type: %lu\n", (unsigned long)dataSize); /* Get the byte order */ order = H5Tget_order(dataTypeID); printf(" Byte Order: "); switch(order) { case H5T_ORDER_ERROR : printf("ERROR\n"); break; case H5T_ORDER_LE : printf("Little Endian\n"); break; case H5T_ORDER_BE : printf("Big Endian\n"); break; case H5T_ORDER_VAX : printf("VAX mixed endian\n"); break; case H5T_ORDER_MIXED : printf("Mixed endian\n"); break; case H5T_ORDER_NONE : printf("particular order\n"); break; } /* end switch */ /* We are done with the datatype. */ hErrVal = H5Tclose(dataTypeID); mjrHDF5_chkError(hErrVal); /* ****************************************************************************************************************************** */ /* Figure out the size of the dataset. */ dataSpaceID = H5Dget_space(dataSetID); mjrHDF5_chkError(dataSpaceID); /* Get the number of dims. */ rank = H5Sget_simple_extent_ndims(dataSpaceID); mjrHDF5_chkError(rank); if(rank > 1024) { /* This can't really happen (limit is 32) */ printf("ERROR: rank too large.\n"); exit(1); } /* end if */ /* Get the size of each dim. */ intVal = H5Sget_simple_extent_dims(dataSpaceID, dims, maxDims); mjrHDF5_chkError(intVal); printf(" Dataspace Rank %lu\n", (unsigned long)rank); printf(" Dim Lengths: "); for(i=0; i<rank; i++) if(dims[i] == H5S_UNLIMITED) { printf("%s ", "UNLIMITED"); } else { printf("%ld ", (long)(dims[i])); } /* end if/else */ printf("\n"); printf(" Max Dim Lengths: "); for(i=0; i<rank; i++) if(maxDims[i] == H5S_UNLIMITED) { printf("%s ", "UNLIMITED"); } else { printf("%ld ", (long)(maxDims[i])); } /* end if/else */ printf("\n"); numDataPoints = H5Sget_simple_extent_npoints(dataSpaceID); if(numDataPoints == 0) { printf("ERROR: Call to H5Sget_simple_extent_npoints failed.\n"); exit(1); } /* end if */ printf("Number of data points: %lu\n", (unsigned long)numDataPoints); /* We are done with the dataSpaceID */ hErrVal = H5Sclose(dataSpaceID); mjrHDF5_chkError(hErrVal); /* Get the number of attributes for the dataSet. */ numAttrs = H5Aget_num_attrs(dataSetID); mjrHDF5_chkError(numAttrs); printf(" Number of attrs: %lu\n", (unsigned long)numAttrs); /* If we have any attributes, we get info for them */ if(numAttrs > 0) { printf(" Attribute info:\n"); for(curAttrIdx=0; curAttrIdx<numAttrs; curAttrIdx++) { attrID = H5Aopen_idx(dataSetID, curAttrIdx); mjrHDF5_chkError(attrID); attrNameSize = H5Aget_name(attrID, 1024, attrName); mjrHDF5_chkError(attrNameSize); printf(" Number %3lu: ", (unsigned long)curAttrIdx); dataTypeID = H5Aget_type(attrID); mjrHDF5_chkError(dataTypeID); /* Get the class for the type. */ class = H5Tget_class(dataTypeID); mjrHDF5_Tclass2str(class, classStr); printf(" Class: %-16s", classStr); /* Get the size of the type */ dataSize = H5Tget_size(dataTypeID); if(dataSize == 0) { printf("ERROR: Failure in H5Tget_size().\n"); exit(1); } /* end if */ printf(" Size: %3lu ", (unsigned long)dataSize); hErrVal = H5Tclose(dataTypeID); mjrHDF5_chkError(hErrVal); printf(" Name: %s \n", attrName); hErrVal = H5Aclose(attrID); mjrHDF5_chkError(hErrVal); } /* end for */ } /* end if */