jgrib-commits Mailing List for Java GRIB reader
Status: Beta
Brought to you by:
kjellr
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(4) |
Dec
|
| 2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(43) |
Aug
(44) |
Sep
(18) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
(2) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
|
3
|
4
|
5
|
6
(2) |
7
|
8
|
9
|
|
10
|
11
(15) |
12
|
13
|
14
|
15
(1) |
16
|
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
|
From: Peter G. <fr...@us...> - 2006-09-15 12:59:22
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30135/src/net/sourceforge/jgrib/gds Modified Files: GribGDSPolarStereo.java Log Message: BUGFIX: Math.cosh() -> Math.cos() in forwardTrans() Index: GribGDSPolarStereo.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSPolarStereo.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GribGDSPolarStereo.java 11 Sep 2006 11:15:02 -0000 1.9 --- GribGDSPolarStereo.java 15 Sep 2006 12:59:16 -0000 1.10 *************** *** 1,3 **** ! /** * =============================================================================== * $Id$ --- 1,3 ---- ! /* * =============================================================================== * $Id$ *************** *** 652,659 **** if(this.latitude_ts < 0) { easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing + rho*Math.cosh(lambda); } else { easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing - rho*Math.cosh(lambda); } --- 652,659 ---- if(this.latitude_ts < 0) { easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing + rho*Math.cos(lambda); } else { easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing - rho*Math.cos(lambda); } |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:25:24
|
Update of /cvsroot/jgrib/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6351 Removed Files: build.bat build.sh Log Message: Deleted file, functionality is fully implemented in build.xml - Published releases will include the jgrib.jar file in the future --- build.sh DELETED --- --- build.bat DELETED --- |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:16:50
|
Update of /cvsroot/jgrib/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2750 Modified Files: ChangeLog Log Message: Summary of changes Index: ChangeLog =================================================================== RCS file: /cvsroot/jgrib/jgrib/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 16 Aug 2006 14:44:00 -0000 1.13 --- ChangeLog 11 Sep 2006 11:16:46 -0000 1.14 *************** *** 8,11 **** --- 8,28 ---- CVS history. + 2006-09-11 Peter Gylling <frv_peg at users.sourceforge.net> + - Updated build.xml to reflect first stable release (1.0) + - Removed deprecated classes + - Added new packages: exceptions and unstable + + 2006-09-06 Peter Gylling <frv_peg at users.sourceforge.net> + - Updated GribRecordGDS and GribGDSPolarStereo to reflect the matematical + background material decided upon. Based upon several weeks of testing + different involved algoritms to transform between geodetic lat/lon and + polar stereographic projection. + + 2006-08-31 Peter Gylling <frv_peg at users.sourceforge.net> + - Added static methods to GribRecordGDS, so users can specify the grid + precisely. A feature required when working with most known GRIB files + due to the fact, that the geographic grid specification looses precision + when defined in the GRIB specification. + 2006-08-16 Peter Gylling <frv_peg at users.sourceforge.net> - Added static methods to GribRecordGDS to allow users to |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:16:09
|
Update of /cvsroot/jgrib/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2564 Modified Files: build.xml Log Message: Updated to reflect upcomming stable release Index: build.xml =================================================================== RCS file: /cvsroot/jgrib/jgrib/build.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** build.xml 2 Aug 2006 10:43:00 -0000 1.13 --- build.xml 11 Sep 2006 11:16:06 -0000 1.14 *************** *** 9,13 **** <property name="Name" value="JGrib"/> <property name="name" value="jgrib"/> ! <property name="version" value="beta7"/> <property name="dist.name" value="${name}_${version}"/> <property name="year" value="2006"/> --- 9,13 ---- <property name="Name" value="JGrib"/> <property name="name" value="jgrib"/> ! <property name="version" value="1.0"/> <property name="dist.name" value="${name}_${version}"/> <property name="year" value="2006"/> |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:15:40
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/util In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2300/src/net/sourceforge/jgrib/util Added Files: SmartStringArray.java Log Message: Added class to util package --- NEW FILE: SmartStringArray.java --- /** * =============================================================================== * $Id: SmartStringArray.java,v 1.1 2006/09/11 11:15:37 frv_peg Exp $ * =============================================================================== * JGRIB library * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: * See AUTHORS file * =============================================================================== */ package net.sourceforge.jgrib.util; /** * Class to handle addition of elements * Kjell Roeang, 18/03/2002 */ public class SmartStringArray { /** * "stack pointer" to keep track of position in the array */ int sp = 0; /** * The array of strings */ private String[] array; /** * How much to add */ private int growthSize; /** * Start value */ private static final int START = 64; /** * Constructor */ public SmartStringArray() { this(START); } /** * Constructor * @param initialSize */ public SmartStringArray( int initialSize ) { this( initialSize, ( initialSize / 4 ) ); } /** * Constructor * @param initialSize * @param growthSize */ public SmartStringArray( int initialSize, int growthSize ) { this.growthSize = growthSize; array = new String[ initialSize ]; } /** * Constructor * @param anArr */ public SmartStringArray(String[] anArr) { array = anArr; growthSize = START/4; sp = array.length; } /** * Reset stack pointer */ public void reset() { sp = 0; } /** * Add one string * @param str */ public void add(String str ) { if( sp >= array.length ) // time to grow! { String[] tmpArray = new String[ array.length + growthSize ]; System.arraycopy( array, 0, tmpArray, 0, array.length ); array = tmpArray; } array[ sp ] = str; sp += 1; } /** * Return normal array * @return strings in an array */ public String[] toArray() { String[] trimmedArray = new String[ sp ]; System.arraycopy( array, 0, trimmedArray, 0, trimmedArray.length ); return trimmedArray; } /** * @return size */ public int size() { return sp; } /** * Split string in an array * @param token * @param string * @return String array */ public static String[] split( String token, String string ) { SmartStringArray ssa = new SmartStringArray(); int previousLoc = 0; int loc = string.indexOf( token, previousLoc ); if (loc == -1) { // No token in string ssa.add(string); return( ssa.toArray() ); } do { //String sub = string.substring( previousLoc, loc ); /* if (sub.trim().length() > 0) { ssa.add(sub); } */ ssa.add( string.substring( previousLoc, loc ) ); previousLoc = ( loc + token.length() ); loc = string.indexOf( token, previousLoc ); } while( ( loc != -1 ) && ( previousLoc < string.length() ) ); //String sub = string.substring( previousLoc); /* if (sub.trim().length() > 0) { ssa.add(sub); } */ ssa.add( string.substring( previousLoc ) ); return( ssa.toArray() ); } /** * Remove array elements with blanks and blanks inside a string * Alter number of elements * @param inArr * @return string array */ public static String[] removeBlanks(String[] inArr) { // Count number of non blanks int nonBl = 0; for (int i=0; i<inArr.length; i++) { String inStr = inArr[i].trim(); if (inStr.length() != 0) { nonBl++; } inArr[i] = inStr; } if (nonBl == inArr.length) { return inArr; } // Copy to new String[] outArr = new String[nonBl]; nonBl = 0; for (int i=0; i<inArr.length; i++) { String inStr = inArr[i].trim(); if (inStr.length() != 0) { outArr[nonBl] = inStr; nonBl++; } } return outArr; } /** * Join some elements with a token in between * @param token * @param strings * @return joined string */ public static String join( String token, String[] strings ) { StringBuffer sb = new StringBuffer(); for( int x = 0; x < strings.length; x++ ) { if (strings[x] != null) { sb.append( strings[x] ); } if( x < ( strings.length - 1 ) ) { sb.append( token ); } } return( sb.toString() ); } /** * Prints the array * @param arr */ private static void printArr(String[] arr) { for (int i=0; i<arr.length; i++) { System.out.print(arr[i]); if (i != (arr.length-1)) { System.out.print(" . "); } } System.out.println(); } /** * @param argv */ public static void main (String[] argv) { String s1 = "aaa.bbb.ccc"; String s2 = "aaa.."; String s3 = "..."; String token = "."; // peg - variable never used //String[] res; printArr(split(token, s1)); printArr(split(token, s2)); printArr(split(token, s3)); } } |
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1877/src/net/sourceforge/jgrib/gds Modified Files: GribGDSFactory.java GribGDSLambert.java GribGDSRotLatLon.java GribGDSPolarStereo.java GribGDSLatLon.java Log Message: Changes reflected by reorganization of code Index: GribGDSRotLatLon.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSRotLatLon.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GribGDSRotLatLon.java 31 Aug 2006 11:33:18 -0000 1.3 --- GribGDSRotLatLon.java 11 Sep 2006 11:15:02 -0000 1.4 *************** *** 32,37 **** import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; import org.apache.log4j.Logger; --- 32,37 ---- import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; import org.apache.log4j.Logger; Index: GribGDSFactory.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GribGDSFactory.java 7 Aug 2006 13:45:58 -0000 1.1 --- GribGDSFactory.java 11 Sep 2006 11:15:02 -0000 1.2 *************** *** 35,40 **** import net.sourceforge.jgrib.BitInputStream; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; import org.apache.log4j.Logger; --- 35,40 ---- import net.sourceforge.jgrib.BitInputStream; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; import org.apache.log4j.Logger; Index: GribGDSLatLon.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSLatLon.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GribGDSLatLon.java 31 Aug 2006 11:33:18 -0000 1.3 --- GribGDSLatLon.java 11 Sep 2006 11:15:02 -0000 1.4 *************** *** 37,42 **** import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; --- 37,42 ---- import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; Index: GribGDSLambert.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSLambert.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GribGDSLambert.java 31 Aug 2006 11:33:18 -0000 1.4 --- GribGDSLambert.java 11 Sep 2006 11:15:02 -0000 1.5 *************** *** 41,45 **** import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.NoValidGribException; /** --- 41,45 ---- import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; /** Index: GribGDSPolarStereo.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSPolarStereo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GribGDSPolarStereo.java 6 Sep 2006 13:31:01 -0000 1.8 --- GribGDSPolarStereo.java 11 Sep 2006 11:15:02 -0000 1.9 *************** *** 41,46 **** import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; import org.apache.log4j.Logger; --- 41,46 ---- import net.sourceforge.jgrib.Bytes2Number; import net.sourceforge.jgrib.GribRecordGDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; import org.apache.log4j.Logger; |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:14:43
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/examples In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1847/src/net/sourceforge/jgrib/examples Modified Files: JgribDemoAFWA.java JgribDemo.java UserSuppliedGribTable.java Log Message: Changes reflected by reorganization of code Index: JgribDemoAFWA.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/examples/JgribDemoAFWA.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JgribDemoAFWA.java 27 Jul 2006 14:08:37 -0000 1.3 --- JgribDemoAFWA.java 11 Sep 2006 11:14:38 -0000 1.4 *************** *** 40,45 **** import net.sourceforge.jgrib.GribRecordIS; import net.sourceforge.jgrib.GribRecordLight; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; /*************************************************************************** --- 40,45 ---- import net.sourceforge.jgrib.GribRecordIS; import net.sourceforge.jgrib.GribRecordLight; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; /*************************************************************************** Index: UserSuppliedGribTable.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/examples/UserSuppliedGribTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserSuppliedGribTable.java 25 Jul 2006 13:45:13 -0000 1.2 --- UserSuppliedGribTable.java 11 Sep 2006 11:14:38 -0000 1.3 *************** *** 36,41 **** import net.sourceforge.jgrib.GribRecordLight; import net.sourceforge.jgrib.GribRecordPDS; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; /**************************************************************************** --- 36,41 ---- import net.sourceforge.jgrib.GribRecordLight; import net.sourceforge.jgrib.GribRecordPDS; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; /**************************************************************************** Index: JgribDemo.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/examples/JgribDemo.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JgribDemo.java 2 Aug 2006 10:42:11 -0000 1.4 --- JgribDemo.java 11 Sep 2006 11:14:38 -0000 1.5 *************** *** 32,37 **** import net.sourceforge.jgrib.GribFile; ! import net.sourceforge.jgrib.NoValidGribException; ! import net.sourceforge.jgrib.NotSupportedException; /*************************************************************************** --- 32,37 ---- import net.sourceforge.jgrib.GribFile; ! import net.sourceforge.jgrib.exceptions.NoValidGribException; ! import net.sourceforge.jgrib.exceptions.NotSupportedException; /*************************************************************************** |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:14:24
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1820/src/net/sourceforge/jgrib Modified Files: GribRecordIS.java GribRecord.java GribFile.java GribPDSParamTable.java GribRecordPDS.java GribRecordBDS.java GribRecordBMS.java Log Message: Changes reflected by reorganization of code Index: GribRecordIS.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecordIS.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GribRecordIS.java 25 Jul 2006 13:46:23 -0000 1.4 --- GribRecordIS.java 11 Sep 2006 11:14:17 -0000 1.5 *************** *** 36,39 **** --- 36,41 ---- import java.io.IOException; + import net.sourceforge.jgrib.exceptions.NotSupportedException; + /** Index: GribPDSParamTable.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribPDSParamTable.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GribPDSParamTable.java 25 Jul 2006 13:46:00 -0000 1.10 --- GribPDSParamTable.java 11 Sep 2006 11:14:17 -0000 1.11 *************** *** 56,59 **** --- 56,62 ---- import java.util.Map; + import net.sourceforge.jgrib.exceptions.NotSupportedException; + import net.sourceforge.jgrib.util.SmartStringArray; + import org.apache.log4j.Level; import org.apache.log4j.Logger; Index: GribRecordBMS.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecordBMS.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GribRecordBMS.java 25 Jul 2006 13:46:23 -0000 1.2 --- GribRecordBMS.java 11 Sep 2006 11:14:17 -0000 1.3 *************** *** 34,37 **** --- 34,39 ---- import java.io.IOException; + import net.sourceforge.jgrib.exceptions.NoValidGribException; + /** Index: GribRecord.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecord.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GribRecord.java 12 Aug 2006 22:01:18 -0000 1.7 --- GribRecord.java 11 Sep 2006 11:14:17 -0000 1.8 *************** *** 37,40 **** --- 37,42 ---- import java.util.Calendar; + import net.sourceforge.jgrib.exceptions.NoValidGribException; + import net.sourceforge.jgrib.exceptions.NotSupportedException; import net.sourceforge.jgrib.gds.GribGDSFactory; Index: GribFile.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribFile.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GribFile.java 12 Aug 2006 22:01:18 -0000 1.10 --- GribFile.java 11 Sep 2006 11:14:17 -0000 1.11 *************** *** 52,55 **** --- 52,57 ---- import org.apache.log4j.Logger; + import net.sourceforge.jgrib.exceptions.NoValidGribException; + import net.sourceforge.jgrib.exceptions.NotSupportedException; import net.sourceforge.jgrib.gds.GribGDSFactory; import net.sourceforge.jgrib.util.GribPDSLevelComparator; Index: GribRecordBDS.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecordBDS.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GribRecordBDS.java 12 Aug 2006 21:47:33 -0000 1.9 --- GribRecordBDS.java 11 Sep 2006 11:14:17 -0000 1.10 *************** *** 34,37 **** --- 34,40 ---- import java.io.IOException; + import net.sourceforge.jgrib.exceptions.NoValidGribException; + import net.sourceforge.jgrib.exceptions.NotSupportedException; + /** Index: GribRecordPDS.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecordPDS.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GribRecordPDS.java 27 Jul 2006 13:11:27 -0000 1.13 --- GribRecordPDS.java 11 Sep 2006 11:14:17 -0000 1.14 *************** *** 44,47 **** --- 44,49 ---- import java.util.GregorianCalendar; + import net.sourceforge.jgrib.exceptions.NotSupportedException; + import org.apache.log4j.Logger; |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:13:29
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1424/src/net/sourceforge/jgrib Removed Files: GribTabPool.java GribTables.java GribTab.java Log Message: Deleted deprecated classes, so we can concentrate on the current API before first stable release --- GribTabPool.java DELETED --- --- GribTab.java DELETED --- --- GribTables.java DELETED --- |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:12:29
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1003/src/net/sourceforge/jgrib Removed Files: SmartStringArray.java Log Message: Moved to package: util --- SmartStringArray.java DELETED --- |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:11:57
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/exceptions In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv611/src/net/sourceforge/jgrib/exceptions Added Files: NotSupportedException.java NoValidGribException.java Log Message: Added package to hold exception related code, makes it easier to get an overview of the working interface --- NEW FILE: NotSupportedException.java --- /** * =============================================================================== * $Id: NotSupportedException.java,v 1.1 2006/09/11 11:11:53 frv_peg Exp $ * =============================================================================== * JGRIB library * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: * See AUTHORS file * =============================================================================== */ /** * NotSupportedException.java 1.0 16 Sep 2002 * * @author Richard D. Gonzalez * @version 1.0 */ package net.sourceforge.jgrib.exceptions; /** * A class that represents an exception thrown when a GRIB feature is not * (yet) supported. * * Currently, only GRIB edition 1 is supported * * @author Richard D. Gonzalez * @version 1.0 */ public class NotSupportedException extends Exception { /** * peg - Added default generated variable * Default variable, that must be implemented, when * extending Exception */ private static final long serialVersionUID = 1L; /** * Construct a new Exception with message <tt>msg</tt>. * * @param msg error message */ public NotSupportedException(String msg) { super(msg); } } --- NEW FILE: NoValidGribException.java --- /** * =============================================================================== * $Id: NoValidGribException.java,v 1.1 2006/09/11 11:11:53 frv_peg Exp $ * =============================================================================== * JGRIB library * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: * See AUTHORS file * =============================================================================== */ /* * NoValidGribException.java 1.0 01/01/2001 * * (C) Benjamin Stark */ package net.sourceforge.jgrib.exceptions; /** * A class that represents an exception during GRIB file operations. * * @author Benjamin Stark * @version 1.0 */ public class NoValidGribException extends Exception { /** * peg - Added default generated variable * Default variable, that must be implemented, when * extending Exception */ private static final long serialVersionUID = 1L; /** * Construct a new Exception with message <tt>msg</tt>. * * @param msg error message */ public NoValidGribException(String msg) { super(msg); } } |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:11:52
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/exceptions In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv601/src/net/sourceforge/jgrib/exceptions Log Message: Directory /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/exceptions added to the repository |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:10:52
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32687/src/net/sourceforge/jgrib Removed Files: NotSupportedException.java NoValidGribException.java Log Message: moved to package exceptions --- NotSupportedException.java DELETED --- --- NoValidGribException.java DELETED --- |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:10:24
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/unstable In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32591/src/net/sourceforge/jgrib/unstable Added Files: GribFileGroup.java GribRecordComparator.java Log Message: Added package unstable to hold code not yet fully implemented --- NEW FILE: GribRecordComparator.java --- /** * =============================================================================== * $Id: GribRecordComparator.java,v 1.1 2006/09/11 11:10:19 frv_peg Exp $ * =============================================================================== * JGRIB library * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: * See AUTHORS file * =============================================================================== */ package net.sourceforge.jgrib.unstable; /** * A comparator class used with HashSet-s when storing/sorting Records as * they are read. * * Compares numerous features from the record information to sort according * to a time, level, level-type, y-axis, x-axis order * * Not implemented yet, and may not be. Might be used when dealing with * multiple files that need to serve as single file. * * @author Capt Richard D. Gonzalez * @version 1.0 */ import java.util.Comparator; //import java.util.Calendar; import net.sourceforge.jgrib.GribRecord; /** * @author rdg * */ public class GribRecordComparator implements Comparator { /** * Method required to implement Comparator. * If obj1 is less than obj2, return -1, if equal, return 0, else return 1 * @param obj1 * @param obj2 * @return Integer value as result of compare operation */ public int compare(Object obj1, Object obj2){ // - peg - uncomment the variables, if long detailed check is re-implemented //float z1; //float z2; //String levelType1; //String levelType2; //int gridSize1; //int gridSize2; //Calendar time1; //Calendar time2; GribRecord gr1; GribRecord gr2; //GribRecordPDS pds1; //GribRecordPDS pds2; //GribPDSLevel level1; //GribPDSLevel level2; //int check; // get the records gr1 = (GribRecord) obj1; gr2 = (GribRecord) obj2; // quick check to see if they're the same record if (gr1 == gr2) return 0; return -1; /* // compare the GDS-s check = gr1.getGDS().compare(gr2.getGDS()); if (check < 0) return -1; if (check > 0) return 1; // if not either, they are equal and we continue // compare the PDS-s check = gr1.getGDS().compare(gr2.getGDS()); if (check < 0) return -1; if (check > 0) return 1; // if not either, they are equal and we continue // get the level level1 = gr1.getPDS().getPDSLevel(); level2 = gr2.getPDS().getPDSLevel(); // compare the levels // check = level1 if (level1.getIndex() < level2.getIndex()) return -1; if (level1.getIndex() > level2.getIndex()) return 1; // compare the z levels z1 = level1.getValue1(); z2 = level2.getValue1(); // if the levels are supposed to decrease with height, reverse comparator if (!(level1.getIsIncreasingUp())) { z1 = -z1; z2 = -z2; } if (z1 < z2) return -1; if (z1 > z2) return 1; // if not either, then equal and we continue // compare the forecast times // pds1 = gr1.getPDS(); // pds2 = gr2.getPDS(); */ } // end of method compare } --- NEW FILE: GribFileGroup.java --- /** * =============================================================================== * $Id: GribFileGroup.java,v 1.1 2006/09/11 11:10:19 frv_peg Exp $ * =============================================================================== * JGRIB library * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: * See AUTHORS file * =============================================================================== */ package net.sourceforge.jgrib.unstable; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import net.sourceforge.jgrib.GribFile; import net.sourceforge.jgrib.GribRecordGDS; import net.sourceforge.jgrib.GribRecordLight; import net.sourceforge.jgrib.exceptions.NoValidGribException; import net.sourceforge.jgrib.exceptions.NotSupportedException; /** * A class to store multiple GribFile-s while allowing access to the GribRecords * of those files as if they were one large file. * This came about because it seems most GRIB files are for a single forecast time, * and this will allow an entire forecast period to be built. * Therefore, the methods are biased towards the separate files being the same * model run at different forecast times. It can be used otherwise, but * files will be sorted according to forecast time. * * TODO - This is not yet functional - the next item on my "todo" list * @author Capt Richard D. Gonzalez * @version 1.0 */ public class GribFileGroup { /** * Store the Grib files */ private HashMap files = new HashMap(); /** * Store the dates */ private Date[] dates = null; // HashSet files = new HashSet(); /** * @param filenames * @throws FileNotFoundException * @throws IOException * @throws NotSupportedException * @throws NoValidGribException */ public GribFileGroup(String[] filenames)throws FileNotFoundException, IOException, NotSupportedException, NoValidGribException{ ArrayList dateList = new ArrayList(); for (int i=0;i<filenames.length;i++){ String filename = filenames[i]; GribFile gribFile = new GribFile(filename); Date date = gribFile.getRecord(1).getPDS().getLocalForecastTime().getTime(); dateList.add(date); files.put(date,gribFile); } dates = (Date[])dateList.toArray(dates); Arrays.sort(dates); } // *** public methods ********************************************************* // basically, reimplementations of the GribFile methods that adjust for // multiple files. /** * Get type names * @return array with names */ public String[] getTypeNames(){ GribFile gribFile = null; String[] allTypeNames = null; HashSet typeNames = new HashSet(); for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); String[] types = gribFile.getTypeNames(); for (int j = 0; j < types.length; j++){ typeNames.add(types[j]); } } allTypeNames = (String[])typeNames.toArray(allTypeNames); return allTypeNames; } /** * Get Light GRIB records * @return Array with Light Grib Records */ public GribRecordLight[] getLightRecords(){ GribFile gribFile = null; GribRecordLight[] grls = null; ArrayList grlList = new ArrayList(); for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); grls = gribFile.getLightRecords(); for (int j = 0; j < grls.length; j++){ grlList.add(grls[j]); } } grls = (GribRecordLight[])grlList.toArray(grls); return grls; } /** * Get get grids * @return array with grids */ public GribRecordGDS[] getGrids(){ GribFile gribFile = null; GribRecordGDS[] gdss = null; ArrayList gdsList = new ArrayList(); for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); gdss = gribFile.getGrids(); for (int j = 0; j < gdss.length; j++){ gdsList.add(gdss[j]); } } gdss = (GribRecordGDS[])gdsList.toArray(gdss); return gdss; } /** * Get the number of records this GRIB file contains. * * @return number of records in this GRIB file */ public int getRecordCount(){ GribFile gribFile = null; int recordCount = 0; for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); recordCount = recordCount + gribFile.getRecordCount(); } return recordCount; } /** * Print out overview of GRIB file content. * * @param out print stream the output is written to * * @throws IOException if a record can not be opened etc. * @throws NoValidGribException if a record is no valid GRIB record * @throws NotSupportedException */ public void listRecords(PrintStream out) throws IOException, NoValidGribException, NotSupportedException { GribFile gribFile = null; // peg - recordCount and record never used //int recordCount; //int record; for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); gribFile.listRecords(out); } } /** * Method added by Richard Gonzalez 23 Sep 02. * * Print out listing of parameters in GRIB file. * * @param out print stream the output is written to */ public void listParameters(PrintStream out){ GribFile gribFile = null; for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); gribFile.listParameters(out); } } /** * Get a string representation of the GRIB file. * * @return NoValidGribException if record is no valid GRIB record */ public String toString(){ GribFile gribFile = null; String theString = null; for (int i = 0; i<dates.length; i++){ Date date = dates[i]; gribFile = (GribFile)files.get(date); theString = theString + gribFile.toString(); } return theString; } } |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:10:15
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/unstable In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32577/src/net/sourceforge/jgrib/unstable Log Message: Directory /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/unstable added to the repository |
|
From: Peter G. <fr...@us...> - 2006-09-11 11:10:07
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32218/src/net/sourceforge/jgrib Removed Files: GribFileGroup.java GribRecordComparator.java Log Message: Moved to unstable package --- GribRecordComparator.java DELETED --- --- GribFileGroup.java DELETED --- |
|
From: Peter G. <fr...@us...> - 2006-09-06 13:31:06
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22825/src/net/sourceforge/jgrib/gds Modified Files: GribGDSPolarStereo.java Log Message: Improved documentation, reimplemented forwardTrans() and reversTrans() according to matematical background material Index: GribGDSPolarStereo.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/gds/GribGDSPolarStereo.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GribGDSPolarStereo.java 31 Aug 2006 11:35:04 -0000 1.7 --- GribGDSPolarStereo.java 6 Sep 2006 13:31:01 -0000 1.8 *************** *** 51,61 **** * * Handles the grids defined in the Polar Stereographic projection. ! * * For a polar stereographic projection as a simplified case of the general * stereographic projection. It's defined, that the origo of the projection is * holding the following coordinates:<br> ! * latitude of origo: 90.0<br> * longitude of origo: 0.0<br> ! * * If bit no. 2 of GDS octet 17 is set to zero, the earth is assumed spherical, which * is accieved by setting the ellipsoid eccentricity equal to zero. --- 51,69 ---- * * Handles the grids defined in the Polar Stereographic projection. ! * <p> ! * <h3>Matematical background</h3> ! * It should be noted that the matematical background material is available ! * online as PDF: <a href="http://www.epsg.org/guides/docs/G7-2.pdf">OPG G7-2</a> ! * <p> ! * Comparison between the GRIB standard and the matematical background states, that ! * the <b>polar stereographic projection</b> should be implemented as <b>case B</b>. ! * There is currently 3 different definitions of polar stereographic projections ! * refered to as <b>case: A,B,C</b> * For a polar stereographic projection as a simplified case of the general * stereographic projection. It's defined, that the origo of the projection is * holding the following coordinates:<br> ! * latitude of origo: -90.0 or 90.0<br> * longitude of origo: 0.0<br> ! * <p> * If bit no. 2 of GDS octet 17 is set to zero, the earth is assumed spherical, which * is accieved by setting the ellipsoid eccentricity equal to zero. *************** *** 69,73 **** * your grid might be placed wrongly, because the GRIB standard looses precission is * adding a calculated value for DX and DY. To cope with that you use the provided ! * methods: setGridXCoords() and setGridYCoords(). * * When working with coordinate projections you should be aware, that there is --- 77,83 ---- * your grid might be placed wrongly, because the GRIB standard looses precission is * adding a calculated value for DX and DY. To cope with that you use the provided ! * methods: setGridXCoords() and setGridYCoords(). Of course this requires, that you ! * have access to the precise values in the polar stereographic projection, which you ! * must gain access to prior to using the JGRIB library. * * When working with coordinate projections you should be aware, that there is *************** *** 88,92 **** private static Logger logger = Logger.getLogger(GribGDSPolarStereo.class.getName()); ! /* start of attributes unique to the Polar Stereo GDS */ /** --- 98,103 ---- private static Logger logger = Logger.getLogger(GribGDSPolarStereo.class.getName()); ! ! /* start of attributes unique to the Polar Stereo GDS */ /** *************** *** 532,546 **** * longitude values under the assumption, that the earth is spherical. * ! * Implementation is based upon the formula: 5.114 page 100, or formulas ! * 4.17 and 4.18 page 63 in the book:<br> ! * Map Projections by Addler and Richardus<br> ! * Published by New Holland, ISBN: 0720450071<br> ! * <br> ! * For a quick look online see:<br> ! * <a href="http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34j.html">online docs</a> ! * and define the eccentricity to zero. ! * ! * TODO verify Easting and northing with respect to Meteorological definition ! * * @param lat - latitude value to convert * @param lon - longitude value to convert --- 543,550 ---- * longitude values under the assumption, that the earth is spherical. * ! * Implementation of polar stereographic projection (case B) as ! * tranformation from geodetic lat/lon to northing,easting. ! * See referenced matematical description in class description. ! * * @param lat - latitude value to convert * @param lon - longitude value to convert *************** *** 548,568 **** */ public double[] forwardTransSpherical(double lat, double lon) { ! // To follow the applied math as simple as possible we map ! // input variables to theese values ! double phi = Math.toRadians(lat); ! double lambda = Math.toRadians(lon); ! double[] xy = new double[2]; ! ! // equation 5.114 or 4.17 and 4.18 ! double rho = 2*this.EARTH_RADIUS*Math.tan(Math.PI/4 - phi/2); ! ! // Calculate northing ! xy[0] = rho*Math.sin(lambda); ! ! // Calculate eathing ! xy[1] = rho*Math.cos(lambda); ! return xy; } --- 552,564 ---- */ public double[] forwardTransSpherical(double lat, double lon) { + + // Set correct use of earth radius + GribRecordGDS.semiMajorAxis = this.EARTH_RADIUS; ! // Set eccentricity to zero, so ellipsoid/oblate spheroid transforms ! // to a spherical form. ! GribRecordGDS.setEccentricity(0.0); ! return this.forwardTrans(lat, lon); } *************** *** 571,583 **** * under the assumption, that the earth is spherical * ! * NOTE:<br> ! * This method is an exact inverse of the forwardTransSpherical() method. Thus it's ! * not validated to work as stand alone routine. ! * <br> ! * For a quick look online see:<br> ! * <a href="http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34j.html">online docs</a> ! * and define the eccentricity to zero. ! * ! * TODO verify Easting and northing with respect to Meteorological definition * * @param N - Northing value to convert --- 567,573 ---- * under the assumption, that the earth is spherical * ! * Implementation of polar stereographic projection (case B) as ! * tranformation from northing,easting to geodetic lat/lon. ! * See referenced matematical description in class description. * * @param N - Northing value to convert *************** *** 587,621 **** public double[] reverseTransSpherical(double N, double E) { ! // To follow the applied math as simple as possible we map ! // input variables to theese values ! double[] xy = new double[2]; ! ! // Calculate rho ! double rho = Math.sqrt(Math.pow((E-GribRecordGDS.falseEasting),2) + Math.pow((GribRecordGDS.falseNorthing - N), 2)); ! ! // Calculate t ! double t = rho / (2*this.EARTH_RADIUS*GribRecordGDS.SCALE_FACTOR); ! ! // Calculate phi ! double phi = Math.PI/2 - 2*Math.tan(t); ! ! // Calculate lambda ! double lambda = Math.atan2((E-GribRecordGDS.falseEasting), (GribRecordGDS.falseNorthing-N)); ! // Move to degrees ! xy[0] = Math.toDegrees(lambda); ! xy[1] = Math.toDegrees(phi); ! return xy; } /** ! * Calculates Easting and Northing values based on geodetic latitude and ! * longitude values. * ! * Implementation is based upon the formulas: 5.102 and 5.105 pages 97-99 in ! * the book:<br> ! * Map Projections by Addler and Richardus<br> ! * Published by New Holland, ISBN: 0720450071<br> * * NOTE:<br> --- 577,597 ---- public double[] reverseTransSpherical(double N, double E) { ! // Set correct use of earth radius ! GribRecordGDS.semiMajorAxis = this.EARTH_RADIUS; ! // Set eccentricity to zero, so ellipsoid/oblate spheroid transforms ! // to a spherical form. ! GribRecordGDS.setEccentricity(0.0); ! return this.reverseTrans(N, E); } /** ! * Calculates Easting, Northing based upon latitude and longitude values ! * under the assumption, that the earth is an oblate spheroid or ellipsoid * ! * Implementation of polar stereographic projection (case B) as ! * tranformation from geodetic lat/lon to northing,easting. ! * See referenced matematical description in class description. * * NOTE:<br> *************** *** 623,630 **** * a specific ellipsoid by using static mehods of GribRecordGDS. * <br> - * For a quick look online see:<br> - * <a href="http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34j.html">online docs</a> * - * TODO verify Easting and northing with respect to Meteorological definition * @param lat - latitude value to convert * @param lon - longitude value to convert --- 599,603 ---- *************** *** 640,668 **** double phi = Math.toRadians(lat); double lambda = Math.toRadians(lon); ! double lambdaZero = 0; double[] returnValues = new double[2]; ! // Helper variables: ! double eSinPhi = GribRecordGDS.eccentricity * Math.sin(phi); ! double tHelper = (1-eSinPhi)/(1+eSinPhi); ! tHelper = Math.pow(tHelper, (GribRecordGDS.eccentricity/2.0)); ! double rhoHelper = Math.pow((1+GribRecordGDS.eccentricity), (1-GribRecordGDS.eccentricity)) * ! Math.pow((1-GribRecordGDS.eccentricity), (1+GribRecordGDS.eccentricity)); // Calculate t ! double t = Math.tan((Math.PI/4)-(phi/2.0)) / tHelper; ! // Calculate rho ! double rho = (2*GribRecordGDS.semiMajorAxis*GribRecordGDS.SCALE_FACTOR*t) / Math.sqrt(rhoHelper); ! ! // Calculate E - Easting ! double E = GribRecordGDS.falseEasting + (rho * Math.sin(lambda - lambdaZero)); ! ! // Calculate N - Northing ! double N = GribRecordGDS.falseNorthing - (rho * Math.cos(lambda - lambdaZero)); ! // Add values to return argument ! returnValues[0] = N; ! returnValues[1] = E; // Return calculated values --- 613,664 ---- double phi = Math.toRadians(lat); double lambda = Math.toRadians(lon); ! double phi_ts = Math.toRadians(this.latitude_ts); double[] returnValues = new double[2]; ! // Calculate tf based upon phi_ts ! double tf = Double.NaN; ! if(this.latitude_ts < 0) { ! tf = Math.tan(Math.PI/4.0 + phi_ts/2.0) / ! Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi_ts))/(1-GribRecordGDS.eccentricity*Math.sin(phi_ts)),(GribRecordGDS.eccentricity/2.0) ); ! } else { ! tf = Math.tan(Math.PI/4.0 - phi_ts/2.0) * ! Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi_ts))/(1-GribRecordGDS.eccentricity*Math.sin(phi_ts)),(GribRecordGDS.eccentricity/2.0) ); ! } + // Calculate scale factor + double mf = Math.cos(phi_ts) / Math.sqrt(1 - Math.pow(GribRecordGDS.eccentricity, 2)*Math.pow(Math.sin(phi_ts),2)); + GribRecordGDS.SCALE_FACTOR = mf * Math.sqrt( Math.pow( (1+GribRecordGDS.eccentricity), (1+GribRecordGDS.eccentricity) ) * + Math.pow( (1-GribRecordGDS.eccentricity), (1-GribRecordGDS.eccentricity) ) ) / (2*tf); + // Calculate t ! double t = Double.NaN; ! if(this.latitude_ts < 0) { ! t = Math.tan(Math.PI/4.0 + phi/2.0) / ! Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi))/(1-GribRecordGDS.eccentricity*Math.sin(phi)),(GribRecordGDS.eccentricity/2.0) ); ! } else { ! t = Math.tan(Math.PI/4.0 - phi/2.0) * ! Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi))/(1-GribRecordGDS.eccentricity*Math.sin(phi)),(GribRecordGDS.eccentricity/2.0) ); ! } ! // Calculate rho ! double rho = (2*GribRecordGDS.semiMajorAxis*GribRecordGDS.SCALE_FACTOR*t) / ! Math.sqrt( Math.pow( (1+GribRecordGDS.eccentricity), (1+GribRecordGDS.eccentricity) ) * ! Math.pow( (1-GribRecordGDS.eccentricity), (1-GribRecordGDS.eccentricity) ) ); ! ! ! // Define Easting and Northing ! double easting = Double.NaN; ! double northing = Double.NaN; ! if(this.latitude_ts < 0) { ! easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing + rho*Math.cosh(lambda); ! } else { ! easting = GribRecordGDS.falseEasting + rho*Math.sin(lambda); ! northing = GribRecordGDS.falseNorthing - rho*Math.cosh(lambda); ! } ! // Add values to return argument ! returnValues[0] = northing; ! returnValues[1] = easting; // Return calculated values *************** *** 671,696 **** /** ! * Calculates latitude and longitude based upon Easting, Northing values. * - * NOTE:<br> - * This method is an exact inverse of the forwardTrans() method. Thus it's - * not validated to work as stand alone routine. - * <br> * NOTE:<br> * Requires knowledge of involved ellipsoid to work correctly. You can force * a specific ellipsoid by using static mehods of GribRecordGDS. * <br> - * For a quick look online see:<br> - * <a href="http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34j.html">online docs</a> - * - * TODO verify Easting and northing with respect to Meteorological definition * ! * @param N - Northing value to convert ! * @param E - Easting value to convert ! * @return lon,lat - longitude,latitude, array * * @see net.sourceforge.jgrib.GribRecordGDS#setReferenceEllipsoid(double, double) * @see net.sourceforge.jgrib.GribRecordGDS#setReferenceEllipsoidAxis(double, double) - * */ public double[] reverseTrans(double N, double E) { --- 667,689 ---- /** ! * Calculates latitude and longitude based upon Easting, Northing values ! * under the assumption, that the earth is an oblate spheroid or ellipsoid ! * ! * Implementation of polar stereographic projection (case B) as ! * tranformation from northing,easting to geodetic lat/lon. ! * See referenced matematical description in class description. * * NOTE:<br> * Requires knowledge of involved ellipsoid to work correctly. You can force * a specific ellipsoid by using static mehods of GribRecordGDS. * <br> * ! * @param N - northing value to convert ! * @param E - easting value to convert ! * ! * @return northing,easting - array * * @see net.sourceforge.jgrib.GribRecordGDS#setReferenceEllipsoid(double, double) * @see net.sourceforge.jgrib.GribRecordGDS#setReferenceEllipsoidAxis(double, double) */ public double[] reverseTrans(double N, double E) { *************** *** 698,708 **** // To follow the applied math as simple as possible we map // input variables to theese values ! double lambdaZero = 0; double[] returnValues = new double[2]; ! // Define helper variables ! double tHelper = Math.pow((1 + GribRecordGDS.eccentricity), (1 - GribRecordGDS.eccentricity)) * ! Math.pow((1 - GribRecordGDS.eccentricity), (1 + GribRecordGDS.eccentricity)); ! tHelper = Math.sqrt(tHelper); // Used to calculate phi --- 691,730 ---- // To follow the applied math as simple as possible we map // input variables to theese values ! double phi_ts = Math.toRadians(this.latitude_ts); double[] returnValues = new double[2]; + + // Calculate tf based upon phi_ts + double tf = Double.NaN; + if(this.latitude_ts < 0) { + tf = Math.tan(Math.PI/4.0 + phi_ts/2.0) / + Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi_ts))/(1-GribRecordGDS.eccentricity*Math.sin(phi_ts)),(GribRecordGDS.eccentricity/2.0) ); + } else { + tf = Math.tan(Math.PI/4.0 - phi_ts/2.0) * + Math.pow( (1 + GribRecordGDS.eccentricity*Math.sin(phi_ts))/(1-GribRecordGDS.eccentricity*Math.sin(phi_ts)),(GribRecordGDS.eccentricity/2.0) ); + } + + // Calculate scale factor + double mf = Math.cos(phi_ts) / Math.sqrt(1 - Math.pow(GribRecordGDS.eccentricity, 2)*Math.pow(Math.sin(phi_ts),2)); + GribRecordGDS.SCALE_FACTOR = mf * Math.sqrt( Math.pow( (1+GribRecordGDS.eccentricity), (1+GribRecordGDS.eccentricity) ) * + Math.pow( (1-GribRecordGDS.eccentricity), (1-GribRecordGDS.eccentricity) ) ) / (2*tf); + + // Calculate rho + double rho = Math.sqrt( ( Math.pow((E-GribRecordGDS.falseEasting),2) + Math.pow((N-GribRecordGDS.falseNorthing), 2) ) ); + + // Calculate t + double t = rho * Math.sqrt( Math.pow( (1+GribRecordGDS.eccentricity), (1+GribRecordGDS.eccentricity) ) * + Math.pow( (1-GribRecordGDS.eccentricity), (1-GribRecordGDS.eccentricity) ) ) / + ( 2 * GribRecordGDS.semiMajorAxis * GribRecordGDS.SCALE_FACTOR); ! // calculate chi and lambda ! double chi = Double.NaN; ! double lambda = Double.NaN; ! if(this.latitude_ts < 0) { ! chi = 2*Math.atan(t) - Math.PI/2.0; ! lambda = Math.atan2(Math.pow((E-GribRecordGDS.falseEasting),2), Math.pow((N-GribRecordGDS.falseNorthing), 2)); ! } else { ! chi = Math.PI/2.0 - 2*Math.atan(t); ! lambda = Math.atan2(Math.pow((E-GribRecordGDS.falseEasting),2), Math.pow((GribRecordGDS.falseNorthing - N), 2)); ! } // Used to calculate phi *************** *** 711,725 **** double e6 = Math.pow(GribRecordGDS.eccentricity, 6); double e8 = Math.pow(GribRecordGDS.eccentricity, 8); ! ! // Calculate rho ! double rho = Math.sqrt(Math.pow((E - GribRecordGDS.falseEasting), 2) + ! Math.pow((N - GribRecordGDS.falseNorthing),2)); ! ! // Calculate t ! double t = (rho*tHelper) / (2 * GribRecordGDS.semiMajorAxis * GribRecordGDS.SCALE_FACTOR); ! ! // Calculate chi ! double chi = (Math.PI/2.0) - 2*Math.atan(t); ! // Calculate phi double phi = chi + ( ( (e2/2) + (5*e4/24) + (e6/12) + (13*e8/360) )*Math.sin(2*chi) ) --- 733,737 ---- double e6 = Math.pow(GribRecordGDS.eccentricity, 6); double e8 = Math.pow(GribRecordGDS.eccentricity, 8); ! // Calculate phi double phi = chi + ( ( (e2/2) + (5*e4/24) + (e6/12) + (13*e8/360) )*Math.sin(2*chi) ) *************** *** 727,737 **** + ( ( (7*e6/120) + (81*e8/1120) )*Math.sin(6*chi) ) + ( (4279*e8/161280)*Math.sin(8*chi) ); ! ! // Calculate lambda ! double lambda = lambdaZero + Math.atan((E - GribRecordGDS.falseEasting)/ ! (GribRecordGDS.falseNorthing - N)); ! // Return values as degrees ! double lon = Math.toDegrees(lambda)-180; double lat = Math.toDegrees(phi); --- 739,745 ---- + ( ( (7*e6/120) + (81*e8/1120) )*Math.sin(6*chi) ) + ( (4279*e8/161280)*Math.sin(8*chi) ); ! // Return values as degrees ! double lon = Math.toDegrees(lambda); double lat = Math.toDegrees(phi); |
|
From: Peter G. <fr...@us...> - 2006-09-06 13:30:01
|
Update of /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22365/src/net/sourceforge/jgrib Modified Files: GribRecordGDS.java Log Message: Added static method setEccentricity(), Improved documentation of class Index: GribRecordGDS.java =================================================================== RCS file: /cvsroot/jgrib/jgrib/src/net/sourceforge/jgrib/GribRecordGDS.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GribRecordGDS.java 31 Aug 2006 11:33:18 -0000 1.13 --- GribRecordGDS.java 6 Sep 2006 13:29:51 -0000 1.14 *************** *** 53,62 **** * Users should be aware, that the static methods of this class is an extention * of the GRIB standard, which allows for more precise calculations of latitude ! * and longitude from ie. the polar stereographic projection. ! * ! * The lat/lon and rotated lat/lon grid will totally ignore theese features. * <p> * Further documentation: ! * <a href="http://www.nco.ncep.noaa.gov/pmb/docs/on388/section2.html">section2.html</a> * * @author Benjamin Stark <p> --- 53,65 ---- * Users should be aware, that the static methods of this class is an extention * of the GRIB standard, which allows for more precise calculations of latitude ! * and longitude from ie. the polar stereographic projection. ! * <p> ! * The matematical background involved in transformations between geodetic latitude/longitude ! * is based on the recommendations provided by <b>OGP Surveying & Positioning Committee</b>. ! * If interested please visit the OGP homepage. * <p> * Further documentation: ! * <a href="http://www.nco.ncep.noaa.gov/pmb/docs/on388/section2.html">section2.html</a><br> ! * <a href="http://www.epsg.org/">OGP Surveying & Positioning Committee</a> * * @author Benjamin Stark <p> *************** *** 324,328 **** // Set invers flattening ! GribRecordGDS.inverseFlattening = 1.0/((semiMajorAxis - semiMinorAxis) / semiMajorAxis); // Calculate eccentricity --- 327,331 ---- // Set invers flattening ! GribRecordGDS.inverseFlattening = semiMajorAxis / (semiMajorAxis - semiMinorAxis); // Calculate eccentricity *************** *** 351,354 **** --- 354,371 ---- } + /** + * Set eccentricity to the value you want to use in + * the transformations. You should be aware, that this + * value is calculated based upon input from the methods + * mentioned below. + * + * @param eccentricity - Ellipsoid eccentricity + * + * @see GribRecordGDS#setReferenceEllipsoid(double, double) + */ + public static void setEccentricity(double eccentricity) { + GribRecordGDS.eccentricity = eccentricity; + } + // *** public methods ************************************************************** |