Opened 4 years ago

Closed 4 years ago

#631 closed defect (fixed)

Duplicate code for coordinates to grid indexes conversion

Reported by: pcampalani Owned by: pcampalani
Priority: major Milestone: 9.0
Component: petascope Version: development
Keywords: conversion duplicate grid indexes Cc:
Complexity: Medium


Petascope has duplicate code used to convert domain coordinates to grid indexes:

  • convertToPixelIndices() in petascope.wcps.server.core.Crs (WCPS conversion)
  • toPixels() in petascope.wcs2.extensions.AbstractFormatExtension (WCS tool to update GetCoverage metadata, see changeset:333ebf9)

The latter method is also working only with subsets on numeric regular grid axes, which is not the case anymore.

A unique utility method should be created (CrsUtil probably is the best location). Since conversions can be called more than once within a single query, conversions would be better cached not to re-compute conversions.

Change History (2)

comment:1 Changed 4 years ago by pcampalani

  • Status changed from new to accepted

comment:2 Changed 4 years ago by pcampalani

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in changeset:136a807 : conversion method refactored to the static CrsUtil class. Now both WCPS DimensionPointElement/DimensionIntervalElement classes and WCS 2.0 AbstractFormatExtension class use the same conversion method. Conversions (key = {coverage name, axis name, low and high bounds}) are cached.

Note: See TracTickets for help on using tickets.