Hi I have the following code used to open, read and write data from a .he5 file:
% Open the HDF5 File.
FILE_NAME = 'MLS-Aura_L2GP-O3_v04-23-c02_2016d364.SUB.he5';file_id = H5F.open (FILE_NAME, 'H5F_ACC_RDONLY', 'H5P_DEFAULT');% Open the dataset.
DATAFIELD_NAME = 'HDFEOS/SWATHS/O3 column/Data Fields/L2gpValue';data_id = H5D.open (file_id, DATAFIELD_NAME);TIME_NAME='HDFEOS/SWATHS/O3 column/Geolocation Fields/Time';time_id=H5D.open(file_id, TIME_NAME);% Read the dataset and dimension fields.
data1=H5D.read (data_id,'H5T_NATIVE_DOUBLE', 'H5S_ALL', 'H5S_ALL', ... 'H5P_DEFAULT');time=H5D.read(time_id,'H5T_NATIVE_DOUBLE', 'H5S_ALL', 'H5S_ALL',... 'H5P_DEFAULT'); %Time is second from TAI93.
time1lvl=datestr(datevec(datenum(1993,1,1,0,0,0)+time(2)/86400));
How can I change this script so that I can open multiple files. Only the last part of the file name changes depending on the day of the year (MLS-Aura_L2GP-O3_v04-23-c01_2016d 366.SUB.he5) Therefore the 3 digits after d will range from 001 to 366. The output values can all be written to the same file.
Best Answer