Opened 10 years ago

Closed 10 years ago

#631 closed defect (fixed)

Duplicate code for coordinates to grid indexes conversion

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

Description

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 by Piero Campalani, 10 years ago

Status: newaccepted

comment:2 by Piero Campalani, 10 years ago

Resolution: fixed
Status: acceptedclosed

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.