Skip to content

Commit

Permalink
fix: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
blasscoc committed Nov 15, 2024
1 parent 4707417 commit 0b88f2f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/real_data_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tool allows users to extract specific slices from 3D seismic data stored in

## Prerequisites

- C++ compiler with C++17 support
- GCC 11 *or better* or Clang14 *or better*
- MDIO library (for reading seismic data)
- indicators library (for progress bars)
- CMake (for building)
Expand Down
2 changes: 1 addition & 1 deletion examples/real_data_example/src/real_data_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ absl::Status Run(const Descriptors... descriptors) {
return absl::OkStatus();
}

mdio::SliceDescriptor ParseRange(std::string_view range) {
mdio::RangeDescriptor<> ParseRange(std::string_view range) {
// Remove leading/trailing whitespace and braces
if (range.empty()) {
// FIXME - we need a better way to handle this
Expand Down
20 changes: 11 additions & 9 deletions examples/real_data_example/src/seismic_numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "tensorstore/tensorstore.h"

using Index = mdio::Index;

std::string GetNumpyDtypeJson(const tensorstore::DataType& dtype) {
using namespace tensorstore;

Expand Down Expand Up @@ -56,14 +58,14 @@ absl::Status WriteNumpy(const mdio::SharedArray<T, R, OriginKind>& accessor,
return absl::InvalidArgumentError("Expected a 3D array");
}

auto inline_inclusive_min = domain[0].inclusive_min();
auto inline_exclusive_max = domain[0].exclusive_max();
const Index inline_inclusive_min = domain[0].inclusive_min();
const Index inline_exclusive_max = domain[0].exclusive_max();

auto xline_inclusive_min = domain[1].inclusive_min();
auto xline_exclusive_max = domain[1].exclusive_max();
const Index xline_inclusive_min = domain[1].inclusive_min();
const Index xline_exclusive_max = domain[1].exclusive_max();

auto depth_inclusive_min = domain[2].inclusive_min();
auto depth_exclusive_max = domain[2].exclusive_max();
const Index depth_inclusive_min = domain[2].inclusive_min();
const Index depth_exclusive_max = domain[2].exclusive_max();

const int width = inline_exclusive_max - inline_inclusive_min;
const int height = xline_exclusive_max - xline_inclusive_min;
Expand Down Expand Up @@ -98,9 +100,9 @@ absl::Status WriteNumpy(const mdio::SharedArray<T, R, OriginKind>& accessor,
outfile.write(header.str().c_str(), header_size);

// Write the data
for (int il = inline_inclusive_min; il < inline_exclusive_max; ++il) {
for (int xl = xline_inclusive_min; xl < xline_exclusive_max; ++xl) {
for (int zl = depth_inclusive_min; zl < depth_exclusive_max; ++zl) {
for (Index il = inline_inclusive_min; il < inline_exclusive_max; ++il) {
for (Index xl = xline_inclusive_min; xl < xline_exclusive_max; ++xl) {
for (Index zl = depth_inclusive_min; zl < depth_exclusive_max; ++zl) {
T value = accessor(il, xl, zl);
outfile.write(reinterpret_cast<const char*>(&value), sizeof(T));
}
Expand Down

0 comments on commit 0b88f2f

Please sign in to comment.