Skip to content

Commit

Permalink
No longer generate or copy .aux.xml statistics file. (#859)
Browse files Browse the repository at this point in the history
* Skip copying stats file if it isn't there

If a stats file has not been generated (which can happen) don't try to
copy it.

Refs #854

* Remove stats generation

Since it didn't seem to make a difference to GeoServer per Kim we can
remove generating and copying the stats file altogether.
  • Loading branch information
edsu committed Mar 15, 2024
1 parent e495765 commit 79a7be3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 24 deletions.
6 changes: 0 additions & 6 deletions lib/gis_robot_suite/raster_normalizer.rb
Expand Up @@ -23,7 +23,6 @@ def normalize

epsg4326_projection? ? compress_only : reproject_and_compress
convert_8bit_to_rgb if eight_bit?
compute_statistics
tmpdir
end

Expand Down Expand Up @@ -77,11 +76,6 @@ def convert_8bit_to_rgb
File.delete(temp_filename)
end

def compute_statistics
Kernel.system("#{Settings.gdal_path}gdalinfo -mm -stats -norat -noct #{output_filepath}", exception: true)
raise "load-raster: #{bare_druid} gdalinfo did not create stats file" unless File.size?("#{output_filepath}.aux.xml")
end

def tmpdir
@tmpdir ||= File.join(Settings.geohydra.tmpdir, "normalizeraster_#{bare_druid}")
end
Expand Down
5 changes: 0 additions & 5 deletions lib/robots/dor_repo/gis_delivery/load_raster.rb
Expand Up @@ -30,11 +30,6 @@ def perform_work
cmd = "rsync -v '#{tif_filename}' #{destination_path}/#{bare_druid}.tif"
logger.debug "Running: #{cmd}"
system(cmd, exception: true)

# copy statistics files (produced by RasterNormalizer#compute_statistics, as of March 2024)
cmd = "rsync -v '#{tif_filename}.aux.xml' #{destination_path}/#{bare_druid}.tif.aux.xml"
logger.debug "Running: #{cmd}"
system(cmd, exception: true)
end
end

Expand Down
12 changes: 0 additions & 12 deletions spec/gis_robot_suite/raster_normalizer_spec.rb
Expand Up @@ -99,7 +99,6 @@
it 'normalizes the data' do
expect(normalizer.normalize).to eq(tmpdir)
expect(File).to exist(File.join(tmpdir, 'MCE_FI2G_2014.tif'))
expect(File).to exist(File.join(tmpdir, 'MCE_FI2G_2014.tif.aux.xml'))

# Does not reproject
expect(Kernel).not_to have_received(:system).with(
Expand All @@ -116,11 +115,6 @@
"gdal_translate -expand rgb /tmp/normalizeraster_bb021mm7809/raw8bit.tif /tmp/normalizeraster_bb021mm7809/MCE_FI2G_2014.tif -co 'COMPRESS=LZW'",
exception: true
)
# Stats
expect(Kernel).to have_received(:system).with(
'gdalinfo -mm -stats -norat -noct /tmp/normalizeraster_bb021mm7809/MCE_FI2G_2014.tif',
exception: true
)
end
end

Expand Down Expand Up @@ -191,7 +185,6 @@
it 'normalizes the data' do
expect(normalizer.normalize).to eq(tmpdir)
expect(File).to exist(File.join(tmpdir, 'h_shade.tif'))
expect(File).to exist(File.join(tmpdir, 'h_shade.tif.aux.xml'))

# Reprojects
expect(Kernel).to have_received(:system).with(
Expand All @@ -208,11 +201,6 @@
"gdal_translate -expand rgb /tmp/normalizeraster_vh469wk7989/raw8bit.tif /tmp/normalizeraster_vh469wk7989/h_shade.tif -co 'COMPRESS=LZW'",
exception: true
)
# Stats
expect(Kernel).to have_received(:system).with(
'gdalinfo -mm -stats -norat -noct /tmp/normalizeraster_vh469wk7989/h_shade.tif',
exception: true
)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/robots/dor_repo/gis_delivery/load_raster_spec.rb
Expand Up @@ -109,7 +109,6 @@
it 'executes system commands to load raster' do
test_perform(robot, druid)
expect(robot).to have_received(:system).with(cmd_tif_sync, exception: true)
expect(robot).to have_received(:system).with(cmd_aux_sync, exception: true)
end
end
end

0 comments on commit 79a7be3

Please sign in to comment.