class OPeNDAPUtils {

    public static Map<String, String> getDimensionRawNameRangeMapping(List<?> gridVariableList,
            String xRangeString, String yRangeString, String timeRangeString) {
        Map<String, String> results = new HashMap<String, String>();

        for (int i = 0; i < gridVariableList.size(); i++) {
            Object variable = gridVariableList.get(i);

            /*
             * Check to see if this is a dimension. If so, which axis
             */
            if (variable instanceof CoordinateAxis1D) {
                switch (((CoordinateAxis1D) variable).getAxisType()) {
                    case GeoX:
                    case Lon: {
                        /*
                         * This is the x axis which corresponds to the Longitude or
                         * GeoX dimension.
                         * 
                         * Since we need the raw name, we need to get the actual
                         * dimension object.
                         * 
                         * If the dimension list for this variable is greater than 1
                         * then we have an issue and this is NOT a CordinateAxis1D
                         * variable (the test is for sanity's sake)
                         */
                        if (((CoordinateAxis1D) variable).getDimensions().size() == 1) {
                            Dimension dimension = ((CoordinateAxis1D) variable).getDimensions().get(0);
                            results.put(dimension.getShortName(), xRangeString);
                        }
                        break;
                    }
                    case GeoY:
                    case Lat: {
                        /*
                         * This is the y axis which corresponds to the Latitude or
                         * GeoY dimension.
                         * 
                         * Since we need the raw name, we need to get the actual
                         * dimension object.
                         * 
                         * If the dimension list for this variable is greater than 1
                         * then we have an issue and this is NOT a CordinateAxis1D
                         * variable (the test is for sanity's sake)
                         */
                        if (((CoordinateAxis1D) variable).getDimensions().size() == 1) {
                            Dimension dimension = ((CoordinateAxis1D) variable).getDimensions().get(0);
                            results.put(dimension.getShortName(), yRangeString);
                        }
                        break;
                    }
                    case Time: {
                        /*
                         * This is the time axis
                         * 
                         * Since we need the raw name, we need to get the actual
                         * dimension object.
                         * 
                         * If the dimension list for this variable is greater than 1
                         * then we have an issue and this is NOT a CordinateAxis1D
                         * variable (the test is for sanity's sake)
                         */
                        if (((CoordinateAxis1D) variable).getDimensions().size() == 1) {
                            Dimension dimension = ((CoordinateAxis1D) variable).getDimensions().get(0);
                            results.put(dimension.getShortName(), timeRangeString);
                        }
                        break;
                    }
                    default: {
                        // do nothing
                    }
                }
            }
        }

        return results;
    }

}