-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModisFGDC.cgi
executable file
·446 lines (418 loc) · 17.5 KB
/
ModisFGDC.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#!/usr/bin/perl -wT
# This cgi script builds a web page to show the metadata for the list of
# secondary id's passed in
# use strict mode
use strict;
use locale;
# use the CGI module
use CGI qw(:standard escapeHTML);
# get the secondary id passed in
my $secondaryid = param('secondary_id');
my $dataset = lc(param('dataset'));
my $tainted_acqDate = param('acq_date');
my $tainted_LLLong = param('LLLong');
my $tainted_URLong = param('URLong');
my $tainted_ULLat = param('ULLat');
my $tainted_LRLat = param('LRLat');
# make sure it is really a secondary id
$_ = $secondaryid;
# make sure it is really a MODIS secondary id
if (!m/^\w{6,8}\.A\d{7,7}\.h\d{2,2}v\d{2,2}\.\d{3,3}\.\d{13,13}\.hdf$/)
{
handleerror("Scene ID $secondaryid is not legal");
}
# untaint the aqcuisition date
unless($tainted_acqDate =~ m#^([\w.-]+)$#)
{
handleerror("Acquisition Date $tainted_acqDate is not valid");
}
my $acqDate = $1;
if ($acqDate !~ m/^\d{2}-\d{2}-\d{4}$/)
{
handleerror("Acquisition Date $acqDate is not legal"); # exits
}
# untaint the LLLong Point
unless($tainted_LLLong =~ m#^([\w.-]+)$#)
{
handleerror("LL Long $tainted_LLLong is not valid");
}
my $LLLong = $1;
if ($LLLong !~ m/^\X{8,12}?$/)
{
handleerror("LLLong Point $LLLong is not legal"); # exits
}
# untaint the URLong Point
unless($tainted_URLong =~ m#^([\w.-]+)$#)
{
handleerror("UR Long $tainted_URLong is not valid");
}
my $URLong = $1;
if ($URLong !~ m/^\X{8,12}?$/)
{
handleerror("URLong Point $URLong is not legal"); # exits
}
# untaint the ULLat Point
unless($tainted_ULLat =~ m#^([\w.-]+)$#)
{
handleerror("UL Lat $tainted_ULLat is not valid");
}
my $ULLat = $1;
if ($ULLat !~ m/^\X{8,12}?$/)
{
handleerror("ULLat Point $ULLat is not legal"); # exits
}
# untaint the LRLat Point
unless($tainted_LRLat =~ m#^([\w.-]+)$#)
{
handleerror("LR Lat $tainted_LRLat is not valid");
}
my $LRLat = $1;
if ($LRLat !~ m/^\X{8,12}?$/)
{
handleerror("LRLat Point $LRLat is not legal"); # exits
}
# extract the components needed from the secondary id to build the path to the
# actual image
my @idFields = split(/\./, $secondaryid);
my $gridcol = substr($idFields[2],0,3);
my $gridrow = substr($idFields[2],3,3);
# Using this information to be used for the different web page display depending
# on what dataset we are displaying.
my $title;
my $abstract;
my $metadata_date;
my $product;
my $dataset_type = substr($dataset,0,3);
my $dataset_number= substr($dataset,3);
if (($dataset_type eq "myd") || ($dataset_type eq "mcd"))
{
$product = "Aqua";
}
else
{
$product = "Terra";
}
my($name,$type) = split("_",$dataset);
# Changing the type to either completely uppercase or just the first value
if ($type)
{
if ($type =~ /^(evi|ndvi|lai|fpar|gpp|netpsn|vcf)/i)
{
$type = uc($type);
}
else
{
$type = ucfirst($type);
}
}
else
{
$type = "";
}
my $dataset_name = uc($name)." $type $product Product";
my %abstract_info = ( "09a1" => "Level 3, 8-day composite of 500m Level 2G Surface Reflectance bands 1 (red), 4 (green) and 3 (blue). This product is computed from the MODIS Level 1B land bands 1-7. ",
"11a1" => "A geographically gridded version of the Level 2 daily LST product. It is generated by projecting MOD11_L2 pixels to Earth locations on a sinusoidal mapping grid. ",
"11b1" => "Provides per-grid temperature and emissivity values. Temperatures are extracted in Kelvin with a day/night LST algorithm applied to a pair of MODIS daytime and nighttime observations. ",
"13a1" => "Level 3 16-day composite of Vegetation Indices at 500m resolution use, as input, MODIS Terra surface reflectances corrected for molecular scattering, ozone absorption, and aerosols. Two vegetation index (VI) algorithms are produced globally for land. One is the standard normalized difference vegetation index (NDVI), which is referred to as the \"continuity index\" to the existing NOAA-AVHRR derived NDVI. The other is an 'enhanced' vegetation index (EVI) with improved sensitivity into high biomass regions and improved vegetation monitoring through a de-coupling of the canopy background signal and a reduction in atmosphere influences.",
"13a2" => "Level 3 16-day composite of Vegetation Indices at 1km resolution that has been pseudo-colored. This product uses, as input, MODIS Terra surface reflectances, corrected for molecular scattering, ozone absorption, and aerosols. Two vegetation index (VI) algorithms are produced globally for land. One is the standard normalized difference vegetation index (NDVI), which is referred to as the \"continuity index\" to the existing NOAA-AVHRR derived NDVI. The other is an 'enhanced' vegetation index with improved sensitivity into high biomass regions and improved vegetation monitoring through a de-coupling of the canopy background signal and a reduction in atmosphere influences.",
"14a1" => "One of MODIS' 3-D data products. In addition to X- and Y-dimensions, Level 3 Daily fire products include 8 separate days of data detailing pixels according to their level of confidence as fires. The Fire Mask contains eight, band (day) sequential, and 1200 x 1200 images of fire data representing consecutive days of data collection.",
"14a2" => "A gridded 1 km composite of the most confident fire pixel detected in each grid cell over the eight-day composite interval. Fire detection is performed using the MODIS 4 and 11 micrometer brightness temperatures. The fire detection strategy is based on absolute detection of the fire, if the fire is strong enough, and on detection relative to the background to account for variability of the surface temperature and reflection by sunlight. ",
"15a2" => "Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation absorbed by vegetation (FPAR), are 1 km global data products updated once each 8-day period throughout each calendar year. LAI defines an important structural property of a plant canopy as the one sided leaf area per unit ground area. FPAR measures the proportion of available radiation in the photosynthetically active wavelengths (400 to 700 nm) that a canopy absorbs. These products are derived from the atmosphere corrected surface reflectance product MYD09, land cover product MYD12 and ancillary information on surface characteristics using a 3D radiative transfer model. ",
"15a3" => "Leaf Area Index (LAI) is a dimensionless variable defined as the total one-sided area of green leaves in a vegetation canopy relative to a unit ground area. LAI ignores canopy details such as leaf angle distribution, canopy height or shape. LAI values typically range from 0 for bare ground to 6 or above for a dense forest. Fraction of Photosynthetically Active Radiation absorbed by vegetation (FPAR) is also a dimensionless variable defined as the fraction of the photosynthetically active radiation absorbed by vegetation. FPAR is directly related to the primary productivity function of photosynthesis, and therefore, used to estimate the assimilation of CO2 in vegetation. Both variables are used to calculate surface photosynthesis, evapotranspiration, and net primary production, which help model the terrestrial energy, carbon, and biogeochemical components of vegetation.",
"17a2" => "The Terra/MODIS Gross Primary Productivity (GPP) product is a cumulative composite of GPP values based on the radiation-use efficiency concept that is potentially used as inputs to data models to calculate terrestrial energy, carbon, water cycle processes, and biogeochemistry of vegetation. MOD17A2 is an 8-day composite at 1-km spatial resolution delivered as a gridded level-4 product in Sinusoidal projection.",
"17a3" => "Net Primary Productivity (NPP) defines the rate at which all plants in an ecosystem produce net useful chemical energy. In other words, NPP is equal to the difference between the rate at which plants in an ecosystem produce useful chemical energy (or GPP), and the rate at which they expend some of that energy for respiration.",
"43b1" => "The MODIS/Terra+Aqua BRDF/Albedo Model-1 16-Day L3 Global 1km SIN Grid is a combination of Terra and Aqua acquisitions containing four-dimensional data sets of Bidirectional Reflectance Distribution Function (BRDF) and Albedo parameters. This 4D combination provides users with spatial orientation as well as the weighting parameters associated with the models best describing the differences in radiation due to scattering (anisotropy) of each pixel. ",
"43b3" => "MODIS/Terra+Aqua Albedo 16-Day L3 Global 1km SIN Grid is a combination of Terra and Aqua acquisitions. The one-kilometer gridded parameters are used to determine directional hemispherical reflectance (\"black-sky albedo\"), bihemispherical reflectance (\"white-sky albedo\"), and nadir BRDF-adjusted reflectance (NBAR) for seven narrow spectral bands and (in the case of albedo) three broad bands.",
"43b4" => "MODIS/Terra+Aqua Nadir BRDF-Adjusted Reflectance 16-Day L3 Global 1km SIN Grid is a combination of Terra and Aqua acquisitions. The one-kilometer gridded parameters are used to determine directional hemispherical reflectance (\"black-sky albedo\"), bihemispherical reflectance (\"white-sky albedo\"), and nadir BRDF-adjusted reflectance (NBAR) for seven narrow spectral bands and (in the case of albedo) three broad bands.",
"44b" => "The Terra MODIS Vegetation Continuous Fields (VCF) product is a sub-pixel-level representation of surface vegetation cover estimates globally. Designed to continuously represent Earth's terrestrial surface as a proportion of basic vegetation traits, it provides a gradation of three surface cover components: percent tree cover, percent non-tree cover, and percent bare. VCF products provide a continuous, quantitative portrayal of land surface cover with improved spatial detail, and hence, are widely used in environmental modeling and monitoring applications."
);
$abstract = $dataset_name . ": ".$abstract_info{$dataset_number};
$metadata_date = "March 30, 2005";
$title = "$dataset_name - Horizontal Tile: $gridcol Vertical Tile: $gridrow ".
"for Scene $secondaryid";
# javascript to set the window size. Note that different browsers need hacks
# to get the sizing right.
my $JSCRIPT=<<END;
// Init function to set the size
function init()
{
isNS4=(document.layers)?true:false;
isIE4=(document.all && !document.getElementById)?true:false;
isIE5=(document.all && document.getElementById)?true:false;
isNS6=(!document.all && document.getElementById)?true:false;
if (document.images)
{
winHeight = document.images[0].height + 170
winWidth = document.images[0].width + 50
// adjust the size if Net 4
if (isNS4)
{
winHeight = winHeight - 150
winWidth = winWidth - 30
}
// make sure we do not exceed screen size
if (winHeight > screen.availHeight)
winHeight = screen.availHeight
if (winWidth > screen.availWidth)
winWidth = screen.availWidth
resizeTo(winWidth, winHeight)
}
}
END
# build the web page
print header();
print start_html(-title=>"USGS Global Visualization Viewer - Scene $secondaryid",
-script=>$JSCRIPT, -onLoad=>'init()');
buildPage();
# routine to generate an error page
sub handleerror
{
my @messages = @_; # for debugging - do not print details in prod
print header();
print start_html("USGS Global Visualization Viewer - FGDC Error");
print p("Error generating FGDC page");
#foreach (@messages)
#{
# print p(@_);
#}
print end_html();
exit;
}
sub buildPage
{
print<<END
<h1>$title</h1>
<p>
<h2>Metadata:</h2>
<ul>
<li><A HREF="#Identification_Information">Identification_Information</A></li>
<li><A HREF="#Metadata_Reference_Information">Metadata_Reference_Information
</A></li>
</ul>
<hr>
<dl>
<dt><a NAME="Identification_Information"></a>
<b>Identification_Information:</b></dt>
<dd>
<dl>
<dt><b>Citation:</b></dt>
<dd>
<dl>
<dt><b>Citation_Information:</b></dt>
<dd>
<dl><br>
<dt><b>Originator:</b> USGS Earth Resources Observation & Science
(EROS)</dt>
<dd>
<dt><b>Publication_Date:</b> $acqDate</dt>
<dt><b>Title:</b> $title</dt>
<dt><b>Edition:</b></dt>
<dt><b>Geospatial_Data_Presentation_Form:</b></dt>
<dt><b>Series_Information:</b></dt>
<dt><b>Series_Name:</b> MODIS
</dt>
<dt><b>Issue_Identification:</b></dt>
<dt><b>Publication_Information:</b></dt>
<dt><b>Publication_Place:</b> US Geological Survey</dt>
<dt><b>Publisher:</b> US Geological Survey</dt>
<dt><b>Online_Linkage:</b> (URL: http://eros.usgs.gov/)</dt>
<dt><b>Other_Citation_Details:</b></dt>
</dd>
</dl>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><b>Description:</b></dt>
<dd>
<dl>
<dt><b>Abstract:</b> $abstract</dt>
<dt><b>Purpose:</b> These data sets were created as contributions to The
National Map and with the intent of stimulating broader use of MODIS data
by the land data user community.
</dt>
</dl>
</dd>
</dl>
<dl>
<dt><b>Time_Period_of_Content: </b></dt>
<dd>
<dl>
<dt><b>Time_Period_Information:</b></dt>
<dd>
<dl>
<dt><b>Single_Date/Time:</b></dt>
<dd>
<dl>
<dt><b>Calendar_Date:</b> $acqDate</dt>
</dl>
</dd>
<dt><b>Currentness_Reference:</b>Raw data time/date stamp;</dt>
</dl>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><b>Status:</b></dt>
<dd>
<dl>
<dt><b>Progress:</b> (Complete)</dt>
<dt><b>Maintenance_and_Update_Frequency:</b> (The frequency with which
changes and additions are made to the data set after the initial data
set is completed.)</dt>
</dl>
</dd>
</dl>
<dl>
<dt><b>Spatial_Domain:</b></dt>
<dd>
<dl>
<dt><b>Bounding_Coordinates:</b></dt>
<dd>
<dl>
<dt><b>West_Bounding_Coordinate:</b> $LLLong</dt>
<dt><b>East_Bounding_Coordinate:</b> $URLong</dt>
<dt><b>North_Bounding_Coordinate:</b> $ULLat</dt>
<dt><b>South_Bounding_Coordinate:</b> $LRLat</dt>
</dl>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><b>Keywords:</b></dt>
<dd>
<dl>
<dt><b>Theme:</b></dt>
<dd>
<dl>
<dt><b>Theme_Keyword_Thesaurus:</b> none</dt>
<dt><b>Theme_Keyword:</b> $product</dt>
<dt><b>Theme_Keyword:</b> MODIS</dt>
<dt><b>Theme_Keyword:</b> Vegetation</dt>
<dt><b>Theme_Keyword:</b> Agriculture</dt>
<dt><b>Theme_Keyword:</b> Land Use</dt>
<dt><b>Theme_Keyword:</b> Land Cover</dt>
</dl>
</dd>
</dl>
<dl>
<dt><b>Place:</b></dt>
<dd>
<dl>
<dt><b>Place_Keyword_Thesaurus:</b> none</dt>
<dt><b>Place_Keyword:</b> Conus</dt>
<dt><b>Place_Keyword:</b> U.S.</dt>
<dt><b>Place_Keyword:</b> North America</dt>
</dl>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><b>Access_Constraints:</b> None</dt>
</dl>
<dl>
<dt><b>Use_Constraints:</b> None. Acknowledgement of the U.S. Geological
Survey and NASA MODIS Land Science Team would be appreciated in products
derived from this data.</dt>
</dl>
<dl>
<dt><b>Point_of_Contact: </b></dt>
<dd>
<dl>
<dt><b>Contact_Information:</b></dt>
<dd>
<dl>
<dt><b>Contact_Organization_Primary:</b></dt>
<dd>
<dl>
<dt><b>Contact_Organization:</b> U.S. Geological Survey</dt>
<dt><b>Contact_Person:</b> LP DAAC Customer Service Representative</dt>
<dt><b>Contact_Address:</b></dt>
<dt><b>Address_Type:</b> mailing and physical address</dt>
<dt><b>Address:</b> USGS Earth Resources Observation & Science (EROS)</dt>
<dt><b>Address:</b> 47914 252nd Street</dt>
<dt><b>City:</b> Sioux Falls</dt>
<dt><b>State_or_Province:</b> South Dakota (SD)</dt>
<dt><b>Postal_Code:</b> 57198-0001</dt>
<dt><b>Country:</b> United States of America (USA)</dt>
</dl>
</dd>
</dl>
<dl>
<dt><b>Contact_Voice_Telephone:</b> 605-594-6116 or 866-573-3222
(tollfree)</dt>
<dt><b>Contact_Facsimile_Telephone:</b> 605-594-6589</dt>
<dt><b>Contact_Electronic_Mail_Address:</b> lpdaac\@usgs.gov</dt>
<dt><b>Hours_of_Service:</b> 0800 - 1600 CT, M - F (-6h CST/-5h
CDT GMT)</dt>
</dl>
</dd>
</dl>
</dl>
<dl>
<dt><b>Data_Set_Credit:</b> U.S. Geological Survey</dt>
<dt><b>Security_Information:</b></dt>
<dd>
<dl>
<dt><b>Security_Classification_System:</b> None</dt>
<dt><b>Security_Classification:</b> Unclassified</dt>
<dt><b>Security_Handling_Description:</b> N/A</dt>
</dl>
</dd>
</dl>
</dl>
<hr>
<dl>
<dt><a NAME="Metadata_Reference_Information"></a>
<b>Metadata_Reference_Information:</b> </dt>
<dd>
<dl>
<dt><b>Metadata_Date:</b> $metadata_date</dt>
<dt><b>Metadata_Contact:</b></dt>
<dd>
<dl>
<dt><b>Contact_Information:</b> </dt>
<dd>
<dl>
<dt><b>Contact_Person_Primary:</b> </dt>
<dt><b>Contact_Organization:</b> U.S. Geological Survey</dt>
<dd>
<dl>
<dt><b>Contact_Person:</b> LP DAAC Customer Service Representative</dt>
<dt><b>Contact_Address:</b> </dt>
<dt><b>Address_Type:</b> mailing and physical address </dt>
<dt><b>Address:</b> USGS Earth Resources Observation & Science (EROS)</dt>
<dt><b>Address:</b> 47914 252nd Street</dt>
<dt><b>City:</b> Sioux Falls</dt>
<dt><b>State_or_Province:</b> South Dakota (SD)</dt>
<dt><b>Postal_Code:</b> 57198-0001</dt>
<dt><b>Country:</b> United States of America (USA) </dt>
</dl>
</dd>
<dt><b>Contact_Voice_Telephone:</b> 605-594-6116 or 866-573-3222
(toll free) </dt>
<dt><b>Contact_Facsimile_Telephone:</b> 605-594-6589 </dt>
<dt><b>Contact_Electronic_Mail_Address:</b> lpdaac\@usgs.gov</dt>
<dt><b>Hours_of_Service:</b> 0800 - 1600 CT, M - F (-6h CST/-5h
CDT GMT)</dt>
</dd>
</dl>
<dt><b>Metadata_Standard_Name:</b> FGDC Content Standards for
Digital Geospatial Metadata </dt>
<dt><b>Metadata_Standard_Version:</b> FGDC-STD-001-1998 </dt>
<dt><b>Metadata_Time_Convention:</b> (local time)</dt>
<dt><b>Metadata_Access_Constraints:</b> None</dt>
<dt><b>Metadata_Use_Constraints:</b> None</dt>
</dd>
</dl>
</dd>
</dl>
</dl>
END
}
print end_html();
exit;