Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a8739a7
Merge branch 'develop' of github.com:nasa-gibs/worldview into develop
grallewellyn Jan 6, 2025
6dd8ec6
initial commit from other branch accidentally created from main
grallewellyn Jan 6, 2025
38ff54c
added print statements
grallewellyn Jan 21, 2025
f021dbe
lerc layer now showing up
grallewellyn Jan 21, 2025
74b8bd7
added print statements
grallewellyn Jan 29, 2025
bb5232c
can visualize and change palette and min/max
grallewellyn Jan 31, 2025
12aa75c
removed print statements and comments
grallewellyn Jan 31, 2025
c0e4e0b
removed color_scales import
grallewellyn Jan 31, 2025
041cd58
cleaned up LERC color coder
grallewellyn Feb 4, 2025
f2e9db6
adding nodata value properly
grallewellyn Feb 4, 2025
beafb7b
cleaned up code
grallewellyn Feb 5, 2025
caabccc
cleaned up code
grallewellyn Feb 5, 2025
d1ac3c5
eslint suggested fixes and everything still works
grallewellyn Feb 5, 2025
11f3da6
moved functions around
grallewellyn Feb 5, 2025
b3189be
applied suggested changes again
grallewellyn Feb 5, 2025
6e9008e
fixed errors in LERCColorCoder
grallewellyn Feb 5, 2025
2cbc53c
resolved all errors in LERCColorCoder
grallewellyn Feb 5, 2025
46ab687
redid formatting of functinos in LERCCodec
grallewellyn Feb 5, 2025
e145a91
resolved some styling issues for LERCCodec
grallewellyn Feb 5, 2025
e990e19
added error handling to get down to 56 errors
grallewellyn Feb 5, 2025
67fe7cb
moved LERCCodec to lib so that I can use unary operators
grallewellyn Feb 5, 2025
17f8243
Merge branch 'develop' of github.com:nasa-gibs/worldview into develop
grallewellyn Feb 5, 2025
0540d1e
merged develop
grallewellyn Feb 5, 2025
b40bec2
reverting package-lock.json back to develop branch
grallewellyn Feb 5, 2025
e425339
added better VIIRS snapshot but still not what it should be
grallewellyn Feb 6, 2025
b983eb3
changed VIIRS layer name to VIIRS_SNPP_DayNightBand_At_Sensor_Radianc…
grallewellyn Mar 4, 2025
5fbb576
resolved error building and made a couple other necessary changes to …
grallewellyn May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/default/common/config/wv.json/layerOrder.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"VIIRS_NOAA21_CorrectedReflectance_TrueColor",
"VIIRS_NOAA21_CorrectedReflectance_BandsM3-I3-M11",
"VIIRS_NOAA21_CorrectedReflectance_BandsM11-I2-I1",
"VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC",
"MODIS_Terra_CorrectedReflectance_TrueColor",
"MODIS_Aqua_CorrectedReflectance_TrueColor",
"MODIS_Terra_SurfaceReflectance_Bands143",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"layers": {
"VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC": {
"id": "VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC",
"description": "viirs/snpp/VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC",
"tags": "lerc night snpp lights city urban nighttime black marble vnp46a1",
"layergroup": "Earth at Night",
"group": "overlays"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"VIIRS_SNPP_DayNightBand_ENCC",
"VIIRS_Night_Lights",
"VIIRS_Black_Marble",
"VIIRS_CityLights_2012"
"VIIRS_CityLights_2012",
"VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC"
]
},
"NOAA-20/VIIRS": {
Expand Down
10 changes: 9 additions & 1 deletion tasks/build-options/extractConfigFromWMTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ async function processEntry (entry) {
const gcId = path.basename(inputFile)
let gc
try {
const xml = await fs.promises.readFile(inputFile, 'utf8')
let xml = await fs.promises.readFile(inputFile, 'utf8')
// graceal need to manually add LERC because this is reading from build/options-build/gc/gibs-geographic.xml and
// I don't know from what that file is being created
if (entry.projection === 'geographic') {
const endFirstLayer = xml.indexOf('</Layer>') + 8
const lercStr = '<Layer><ows:Title xml:lang=\'en\'>VIIRS Lerc layer for testing</ows:Title><ows:WGS84BoundingBox crs=\'urn:ogc:def:crs:OGC:2:84\'><ows:LowerCorner>-180 -90</ows:LowerCorner><ows:UpperCorner>180 90</ows:UpperCorner></ows:WGS84BoundingBox><ows:Identifier>VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC</ows:Identifier><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.0\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.0/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.3\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.3/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.3/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><Style isDefault=\'true\'><ows:Title xml:lang=\'en\'>default</ows:Title><ows:Identifier>default</ows:Identifier><LegendURL height=\'85.5\' xlink:type=\'simple\' xlink:role=\'http://earthdata.nasa.gov/gibs/legend-type/horizontal\' width=\'378.0\' xlink:title=\'GIBS Color Map Legend: Horizontal\' xlink:href=\'https://gitc.earthdata.nasa.gov/legends/VIIRS_DayNightBand_At_Sensor_Radiance_H.svg\' format=\'image/svg+xml\'/><LegendURL height=\'288.0\' xlink:type=\'simple\' xlink:role=\'http://earthdata.nasa.gov/gibs/legend-type/vertical\' width=\'135.0\' xlink:title=\'GIBS Color Map Legend: Vertical\' xlink:href=\'https://gitc.earthdata.nasa.gov/legends/VIIRS_DayNightBand_At_Sensor_Radiance_V.svg\' format=\'image/svg+xml\'/></Style><Dimension><ows:Identifier>Time</ows:Identifier><ows:UOM>ISO8601</ows:UOM><Default>2022-07-31</Default><Current>false</Current><Value>2013-07-31/2022-07-01/P1D</Value></Dimension><TileMatrixSetLink><TileMatrixSet>500m</TileMatrixSet></TileMatrixSetLink><Format>image/lerc</Format><ResourceURL template=\'https://localhost:8080/wmts/epsg4326/best/wmts.cgi?Time={Time}&amp;layer=VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC&amp;style=default&amp;tilematrixset={TileMatrixSet}&amp;Service=WMTS&amp;Request=GetTile&amp;Version=1.0.0&amp;Format=image%2Flerc&amp;TileMatrix={TileMatrix}&amp;TileCol={TileCol}&amp;TileRow={TileRow}\''
const lercStr2 = ' format=\'image/lerc\' resourceType=\'tile\'/></Layer>'
xml = xml.substring(0, endFirstLayer) + lercStr + lercStr2 + xml.substring(endFirstLayer)
}
gc = JSON.parse(convert.xml2json(xml, { compact: true, spaces: 2 }))
} catch (e) {
if (tolerant) {
Expand Down
9 changes: 8 additions & 1 deletion tasks/build-options/getCapabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ async function processLayer (layer) {
}

async function processGetCapabilities (outputFile) {
const xml = fs.readFileSync(outputFile, { encoding: 'utf-8' })
let xml = fs.readFileSync(outputFile, { encoding: 'utf-8' })
// need to manually add LERC
if (outputFile.includes('gibs-geographic')) {
const endFirstLayer = xml.indexOf('</Layer>') + 8
const lercStr = '<Layer><ows:Title xml:lang=\'en\'>VIIRS Lerc layer for testing</ows:Title><ows:WGS84BoundingBox crs=\'urn:ogc:def:crs:OGC:2:84\'><ows:LowerCorner>-180 -90</ows:LowerCorner><ows:UpperCorner>180 90</ows:UpperCorner></ows:WGS84BoundingBox><ows:Identifier>VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC</ows:Identifier><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.0\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.0/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.3\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.3/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><ows:Metadata xlink:role=\'http://earthdata.nasa.gov/gibs/metadata-type/colormap/\' xlink:type=\'simple\' xlink:title=\'GIBS Color Map: Data - RGB Mapping\' xlink:href=\'https://gitc.earthdata.nasa.gov/colormaps/v1.3/VIIRS_DayNightBand_At_Sensor_Radiance.xml\'/><Style isDefault=\'true\'><ows:Title xml:lang=\'en\'>default</ows:Title><ows:Identifier>default</ows:Identifier><LegendURL height=\'85.5\' xlink:type=\'simple\' xlink:role=\'http://earthdata.nasa.gov/gibs/legend-type/horizontal\' width=\'378.0\' xlink:title=\'GIBS Color Map Legend: Horizontal\' xlink:href=\'https://gitc.earthdata.nasa.gov/legends/VIIRS_DayNightBand_At_Sensor_Radiance_H.svg\' format=\'image/svg+xml\'/><LegendURL height=\'288.0\' xlink:type=\'simple\' xlink:role=\'http://earthdata.nasa.gov/gibs/legend-type/vertical\' width=\'135.0\' xlink:title=\'GIBS Color Map Legend: Vertical\' xlink:href=\'https://gitc.earthdata.nasa.gov/legends/VIIRS_DayNightBand_At_Sensor_Radiance_V.svg\' format=\'image/svg+xml\'/></Style><Dimension><ows:Identifier>Time</ows:Identifier><ows:UOM>ISO8601</ows:UOM><Default>2022-07-31</Default><Current>false</Current><Value>2013-07-31/2022-07-01/P1D</Value></Dimension><TileMatrixSetLink><TileMatrixSet>500m</TileMatrixSet></TileMatrixSetLink><Format>image/lerc</Format><ResourceURL template=\'https://localhost:8080/wmts/epsg4326/best/wmts.cgi?Time={Time}&amp;layer=VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC&amp;style=default&amp;tilematrixset={TileMatrixSet}&amp;Service=WMTS&amp;Request=GetTile&amp;Version=1.0.0&amp;Format=image%2Flerc&amp;TileMatrix={TileMatrix}&amp;TileCol={TileCol}&amp;TileRow={TileRow}\''
const lercStr2 = ' format=\'image/lerc\' resourceType=\'tile\'/></Layer>'
xml = xml.substring(0, endFirstLayer) + lercStr + lercStr2 + xml.substring(endFirstLayer)
}
const gc = JSON.parse(convert.xml2json(xml, { compact: true, spaces: 2 }))

try {
Expand Down
25 changes: 25 additions & 0 deletions tasks/build-options/getVisMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,31 @@ async function getDAAC (metadata) {
}

async function getMetadata (layerId, baseUrl, count) {
// graceal I will need to know how to create the metadata for the endpoint
if (layerId === 'VIIRS_SNPP_DayNightBand_At_Sensor_Radiance_LERC') {
const metadata = {
title: 'VIIRS Lerc layer for testing',
subtitle: 'Suomi NPP / VIIRS',
ongoing: true,
measurement: 'Earth at Night',
retentionPeriod: -1,
daynight: [
'night'
],
conceptIds: [],
orbitDirection: [
'descending'
],
layerPeriod: 'Daily'
}
layerMetadata[layerId] = await getDAAC(metadata)
let metadataKeys = Object.keys(layerMetadata[layerId])
metadataKeys = metadataKeys.filter(x => !useKeys.includes(x))
for (const key of metadataKeys) {
delete layerMetadata[layerId][key]
}
return
}
if (count) console.warn(`retry #${count} for ${layerId}`)
return axios({
method: 'get',
Expand Down
17 changes: 15 additions & 2 deletions tasks/build-options/processColormap.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,20 @@ async function matchLegend (entry, legends) {
async function processEntries (colormap) {
const entries = toList(colormap.Entries.ColorMapEntry)
let transparentMap = 'true'
let noDataValue

// Check to see if there is at least one non-transparent entry.
for (const entry of entries) {
if (entry._attributes.transparent === 'false') {
transparentMap = 'false'
break
} else if (entry._attributes.nodata === 'true') {
noDataValue = entry._attributes.sourceValue
}
}

if (transparentMap === 'true') {
return 'transparent'
return { transparent: noDataValue }
}

if (!colormap.Legend) {
Expand Down Expand Up @@ -319,6 +322,7 @@ async function readFileAsync (file) {
async function processFile (id, xml) {
let document
let colormaps = []
let noDataValue
try {
document = JSON.parse(convert.xml2json(xml, { compact: true, spaces: 2 }))
if (document && document.ColorMaps && document.ColorMaps.ColorMap) {
Expand All @@ -327,7 +331,9 @@ async function processFile (id, xml) {
const maps = []
for (const colormap of colormaps) {
const result = await processEntries(colormap)
if (result === 'transparent') {
if (result && 'transparent' in result) {
// set the no data value (could be null)
noDataValue = result.transparent
// There are no visible colors in the colormap so stop processing
continue
}
Expand All @@ -347,6 +353,13 @@ async function processFile (id, xml) {
maps.push(result)
}

// if there was a nodata value, assign to all maps
if (noDataValue) {
maps.forEach(map => {
map.noDataValue = noDataValue
})
}

const data = {
id,
maps
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading