readEcostressSig
Syntax
Description
reads spectral data from only those ECOSTRESS spectrum files stored in the specified
directory with the specified keyword in their file names.libData
= readEcostressSig(dirname
,keyword
)
Note
This function requires the Hyperspectral Imaging Library for Image Processing Toolbox™. You can install the Hyperspectral Imaging Library for Image Processing Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
The Hyperspectral Imaging Library for Image Processing Toolbox requires desktop MATLAB®, as MATLAB Online™ or MATLAB Mobile™ do not support the library.
Examples
Read ECOSTRESS Spectrum Files
Specify the names of the spectrum files to read from the ECOSTRESS spectral library as a cell array of character vectors.
ecostressfiles = [{'soil.utisol.hapludult.none.all.87p707.jhu.becknic.spectrum.txt'},... {'water.seawater.none.liquid.tir.seafoam.jhu.becknic.spectrum.txt'},... {'vegetation.tree.eucalyptus.maculata.vswir.jpl087.jpl.asd.spectrum.txt'},... {'manmade.road.tar.solid.all.0099uuutar.jhu.becknic.spectrum.txt'}];
Read and display the data from the specified ECOSTRESS spectrum files. The function returns a structure array with a row for each specified ECOSTRESS spectrum file. Each row stores the spectral data read from the associated file.
libData = readEcostressSig(ecostressfiles)
libData=1×4 struct array with fields:
Name
Type
Class
SubClass
ParticleSize
Genus
Species
SampleNo
Owner
WavelengthRange
Origin
CollectionDate
Description
Measurement
FirstColumn
SecondColumn
WavelengthUnit
DataUnit
FirstXValue
LastXValue
NumberOfXValues
AdditionalInformation
Wavelength
Reflectance
⋮
Extract the details of the spectral data of the second file from the structure array.
libData(2)
ans = struct with fields:
Name: "Sea Foam"
Type: "Water"
Class: "Sea Water"
SubClass: "none"
ParticleSize: "Liquid"
Genus: [0x0 string]
Species: [0x0 string]
SampleNo: "seafoam"
Owner: "Dept. of Earth and Planetary Science, John Hopkins University"
WavelengthRange: "TIR"
Origin: "JHU IR Spectroscopy Lab."
CollectionDate: "N/A"
Description: "Sea foam water. Original filename FOAM Original ASTER Spectral Library name was jhu.becknic.water.sea.none.liquid.seafoam.spectrum.txt"
Measurement: "Directional (10 Degree) Hemispherical Reflectance"
FirstColumn: "X"
SecondColumn: "Y"
WavelengthUnit: "micrometer"
DataUnit: "Reflectance (percent)"
FirstXValue: "14.0112"
LastXValue: "2.0795"
NumberOfXValues: "2110"
AdditionalInformation: "none"
Wavelength: [2110x1 double]
Reflectance: [2110x1 double]
Extract the reflectance and the wavelength values from the spectral data of the second file.
reflectance = libData(2).Reflectance; wavelength = libData(2).Wavelength;
Plot the spectral signature using the wavelength and reflectance values.
figure plot(wavelength,reflectance) title(['Spectra of ' libData(2).Name]) xlabel('Wavelength') ylabel('Reflectance Value')
Read All ECOSTRESS Spectrum Files in Directory
Specify the full path of the directory that contains the ECOSTRESS spectrum files.
dirname = fullfile(matlabroot,'toolbox','images','supportpackages','hyperspectral','hyperdata','ECOSTRESSSpectraFiles');
Read and display the spectral data from all the files in the directory. The function returns a structure array with a row for each ECOSTRESS spectrum file in the specified directory.
libData = readEcostressSig(dirname)
libData=1×15 struct array with fields:
Name
Type
Class
SubClass
ParticleSize
Genus
Species
SampleNo
Owner
WavelengthRange
Origin
CollectionDate
Description
Measurement
FirstColumn
SecondColumn
WavelengthUnit
DataUnit
FirstXValue
LastXValue
NumberOfXValues
AdditionalInformation
Wavelength
Reflectance
⋮
Extract the details of the spectral data of the 15th file.
libData(15)
ans = struct with fields:
Name: "Tap water"
Type: "Water"
Class: "Tap Water"
SubClass: "none"
ParticleSize: "Liquid"
Genus: [0x0 string]
Species: [0x0 string]
SampleNo: "tapwater"
Owner: "Dept. of Earth and Planetary Science, John Hopkins University"
WavelengthRange: "All"
Origin: "JHU IR Spectroscopy Lab. Original filename TAPWATER."
CollectionDate: "N/A"
Description: "Tap water. Original ASTER Spectral Library name was jhu.becknic.water.tap.none.liquid.tapwater.spectrum.txt"
Measurement: "Directional (10 Degree) Hemispherical Reflectance"
FirstColumn: "X"
SecondColumn: "Y"
WavelengthUnit: "micrometer"
DataUnit: "Reflectance (percent)"
FirstXValue: "14.0110"
LastXValue: "0.4000"
NumberOfXValues: "2844"
AdditionalInformation: "none"
Wavelength: [2844x1 double]
Reflectance: [2844x1 double]
Search ECOSTRESS Spectrum Files Using Keyword
Specify full path of the directory that contains the ECOSTRESS spectrum files.
dirname = fullfile(matlabroot,'toolbox','images','supportpackages','hyperspectral','hyperdata','ECOSTRESSSpectraFiles');
Read and display the spectral data of the ECOSTRESS spectrum files with a specific keyword in their file names. The function returns a structure array with a row for each spectrum file in the specified directory with the keyword in their file names.
keyword = 'water';
libData = readEcostressSig(dirname,keyword)
libData=1×3 struct array with fields:
Name
Type
Class
SubClass
ParticleSize
Genus
Species
SampleNo
Owner
WavelengthRange
Origin
CollectionDate
Description
Measurement
FirstColumn
SecondColumn
WavelengthUnit
DataUnit
FirstXValue
LastXValue
NumberOfXValues
AdditionalInformation
Wavelength
Reflectance
⋮
Input Arguments
filenames
— Names of ECOSTRESS files
character vector | string scalar | cell array of character vectors | vector of strings
Names of the ECOSTRESS files, specified as a character vector, string scalar, cell array of character vectors, or vector of strings. To read the data from multiple ECOSTRESS files simultaneously, use a cell array of character vectors or vector of strings. The function reads data from the files in the order in which you specify them. If the ECOSTRESS files are not in the current folder, you must specify the full path of each file.
Data Types: char
| string
dirname
— Name of directory
character vector | string scalar
Name of the directory containing the ECOSTRESS files, specified as a character vector or string scalar. If the directory is not in the current folder, you must specify the full path of the directory.
Data Types: char
| string
keyword
— File search keyword
character vector | string scalar
File search keyword, specified as a character vector or string scalar. The function returns data from only the ECOSTRESS spectrum files with the specified keyword in their file names. You cannot specify multiple keywords simultaneously.
Data Types: char
| string
Output Arguments
libData
— Spectral data from ECOSTRESS files
structure array
Spectral data from ECOSTRESS files, returned as a 1-by-K structure array. K is the number of spectrum files read by the function. Each element of the structure array has 24 fields that contain the header information of the spectrum files.
Field Names | Description |
Name | Name of the measured sample or material |
Type | Type of sample, such as "mineral" ,
"rock" , "tree" , or
"manmade" |
Class | Class of the sample type For example, if the sample type is |
SubClass | Subclass of the sample type This field contains an
empty array or |
ParticleSize | Particle size of the sample type This field contains an
empty array unless the |
Genus | Genus of the sample This field contains an empty array
unless the |
Species | Species of the sample This field contains an empty array unless the |
SampleNo | Sample number This value is an identifier for the associated sample. |
Owner | Owner of the sample |
WavelengthRange | Wavelength range of the measured sample The value must be |
Origin | Location from which the data was obtained |
CollectionDate | Date on which the sample was collected This value is in |
Description | Description of the measured sample This field provides additional information about the characteristics of the sample. |
Measurement | Spectral measurement mode used to measure the sample |
FirstColumn | First column of data values in the spectrum file |
SecondColumn | Second column of data values in the spectrum file |
WavelengthUnit | Measuring unit for the spectral wavelengths of the samples The value for every sample type is
|
DataUnit | Unit of the spectral measurement mode Spectral
measurement mode includes reflectance, transmittance, transittance, and
transmission. The unit is percentage. This field corresponds to the
|
FirstXValue | First value in the first column of data values in the spectrum file |
LastXValue | Last value in the first column of data values in the spectrum file |
NumberofXValues | Total number of data values in the first column of the spectrum file |
AdditionalInformation | Additional information about the sample This field includes information that is not part of the spectral data. |
Wavelength | Wavelength values at which the reflectances were measured |
Reflectance | Reflectance values measured at each wavelengths |
References
[1] Meerdink, Susan K., Simon J. Hook, Dar A. Roberts, and Elsa A. Abbott. “The ECOSTRESS Spectral Library Version 1.0.” Remote Sensing of Environment 230 (September 2019): 111196. https://doi.org/10.1016/j.rse.2019.05.015.
[2] Download the ECOSTRESS Spectral Library: https://speclib.jpl.nasa.gov/download
Version History
Introduced in R2020a
See Also
spectralMatch
| sam
| sid
| hypercube
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)