AgriMetSoft
Modis Product Extractor
Modis Product Extractor is a tool designed to extract data from HDF files of Modis
products. To projection the coordinates in this data extraction, the tool utilizes
the Unidata Java NetCDF library. Below are the codes used to extract data for a
specific point:
ucar.nc2.dt.grid.GridDataset gds =
ucar.nc2.dt.grid.GridDataset.open(fileName);
ucar.nc2.dt.GridDatatype grid =
gds.findGridDatatype(VariableName);
ucar.nc2.dt.GridCoordSystem gcs = grid.getCoordinateSystem();
var xy = gcs.findXYindexFromLatLon(lat,lon, null);
var dd = mainVar.read(new int[2] { xy[1], xy[0] }, new int[2] {
1, 1 });
In the second tab, you can define a region. During this process, the tool's
underlying code generates an enclosed rectangle for your specified region and
checks all the Modis cells within this rectangular area to determine whether they
are within your defined region or not. During extraction, all cells outside your
designated region will be assigned a value of -99, while cells within the region will
retain the values retrieved from the HDF file, which may include numeric values
or NaN, depending on your HDF files.
http://www.youtube.com/AgriMetSoft
AgriMetSoft
When we need to verify which cell from the file falls within the user-defined
polygon, we employ the NetTopologySuite library in conjunction with the
following code:
data[i,j].IsInA =
NetTopologySuite.Algorithm.CGAlgorithms.IsPointInRing(new
GeoAPI.Geometries.Coordinate(it.Lon,it.Lat),
polygon.Shell.Coordinates);
To read a shapefile, we utilize the "Catfood.Shapefile" library, a .NET-based tool
designed for read-only enumeration of ESRI shapefiles. This library supports all 2D
shape types, including Point, MultiPoint, PolyLine, and Polygon, along with their
associated metadata.
http://www.youtube.com/AgriMetSoft