Revision 9570
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.netcdf</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<version>2.2.76</version> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<description>NetCDF adapter</description> |
|
9 |
<inceptionYear>2011</inceptionYear> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.desktop</artifactId> |
|
13 |
<version>2.0.242</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<properties> |
|
17 |
<!-- El plugin versions:use-latest-versions falla con scope import --> |
|
18 |
<!-- asi que toca usar el versions:update-properties que si que funciona --> |
|
19 |
<org.gvsig.raster.version>2.2.93</org.gvsig.raster.version> |
|
20 |
</properties> |
|
21 |
|
|
22 |
<repositories> |
|
23 |
<repository> |
|
24 |
<id>gvsig-public-http-repository</id> |
|
25 |
<name>gvSIG maven public HTTP repository</name> |
|
26 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
27 |
<releases> |
|
28 |
<enabled>true</enabled> |
|
29 |
<updatePolicy>daily</updatePolicy> |
|
30 |
<checksumPolicy>warn</checksumPolicy> |
|
31 |
</releases> |
|
32 |
<snapshots> |
|
33 |
<enabled>true</enabled> |
|
34 |
<updatePolicy>daily</updatePolicy> |
|
35 |
<checksumPolicy>warn</checksumPolicy> |
|
36 |
</snapshots> |
|
37 |
</repository> |
|
38 |
</repositories> |
|
39 |
|
|
40 |
<scm> |
|
41 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76</connection> |
|
42 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76</developerConnection> |
|
43 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76</url> |
|
44 |
</scm> |
|
45 |
|
|
46 |
<build> |
|
47 |
<plugins> |
|
48 |
<plugin> |
|
49 |
<groupId>org.apache.maven.plugins</groupId> |
|
50 |
<artifactId>maven-release-plugin</artifactId> |
|
51 |
<configuration> |
|
52 |
<tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.netcdf/tags/</tagBase> |
|
53 |
<goals>deploy</goals> |
|
54 |
</configuration> |
|
55 |
</plugin> |
|
56 |
</plugins> |
|
57 |
</build> |
|
58 |
|
|
59 |
<dependencyManagement> |
|
60 |
<dependencies> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.raster</artifactId> |
|
64 |
<version>${org.gvsig.raster.version}</version> |
|
65 |
<type>pom</type> |
|
66 |
<scope>import</scope> |
|
67 |
</dependency> |
|
68 |
|
|
69 |
<dependency> |
|
70 |
<groupId>essi-unidata</groupId> |
|
71 |
<artifactId>netcdf-java</artifactId> |
|
72 |
<version>4.2</version> |
|
73 |
</dependency> |
|
74 |
|
|
75 |
|
|
76 |
<dependency> |
|
77 |
<groupId>org.gvsig</groupId> |
|
78 |
<artifactId>org.gvsig.raster.netcdf.io</artifactId> |
|
79 |
<version>2.2.76</version> |
|
80 |
</dependency> |
|
81 |
|
|
82 |
</dependencies> |
|
83 |
</dependencyManagement> |
|
84 |
|
|
85 |
<modules> |
|
86 |
<module>org.gvsig.raster.netcdf.io</module> |
|
87 |
<module>org.gvsig.raster.netcdf.app.netcdfclient</module> |
|
88 |
</modules> |
|
89 |
|
|
90 |
</project> |
|
0 | 91 |
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/org.gvsig.raster.netcdf.io/src/main/java/org/gvsig/raster/netcdf/io/NetCDFDataParametersImpl.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.raster.netcdf.io; |
|
29 |
|
|
30 |
import java.io.IOException; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.Date; |
|
33 |
import java.util.HashMap; |
|
34 |
import java.util.Iterator; |
|
35 |
import java.util.List; |
|
36 |
|
|
37 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
|
38 |
import org.gvsig.tools.ToolsLocator; |
|
39 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
40 |
import org.gvsig.tools.dynobject.DynStruct; |
|
41 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
42 |
|
|
43 |
import ucar.nc2.Dimension; |
|
44 |
import ucar.nc2.NetcdfFile; |
|
45 |
import ucar.nc2.Variable; |
|
46 |
import ucar.nc2.dataset.CoordinateAxis1D; |
|
47 |
import ucar.nc2.dataset.CoordinateAxis1DTime; |
|
48 |
import ucar.nc2.dt.GridCoordSystem; |
|
49 |
import ucar.nc2.dt.GridDatatype; |
|
50 |
import ucar.nc2.dt.grid.GridDataset; |
|
51 |
|
|
52 |
/** |
|
53 |
* Parameters for the NetCDF provider |
|
54 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
55 |
*/ |
|
56 |
public class NetCDFDataParametersImpl extends AbstractRasterFileDataParameters implements NetCDFDataParameters { |
|
57 |
private ArrayList<String[]> gridVarList = null; |
|
58 |
private ArrayList<Variable> varList = null; |
|
59 |
private HashMap<String, double[]> rankByVar = new HashMap<String, double[]>(); |
|
60 |
private HashMap<String, Date[]> dateByVar = new HashMap<String, Date[]>(); |
|
61 |
private String xDimVariable = null; |
|
62 |
private String yDimVariable = null; |
|
63 |
|
|
64 |
|
|
65 |
public NetCDFDataParametersImpl() { |
|
66 |
super(); |
|
67 |
initialize(); |
|
68 |
} |
|
69 |
|
|
70 |
protected void initialize() { |
|
71 |
delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
72 |
.getDynObjectManager().createDynObject( |
|
73 |
registerDynClass()); |
|
74 |
} |
|
75 |
|
|
76 |
public static DynStruct registerDynClass() { |
|
77 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
78 |
DynStruct definition = manager.getDefinition("NetCDFDataParametersImpl_Persistent"); |
|
79 |
if( definition == null ) { |
|
80 |
definition = manager.addDefinition( |
|
81 |
NetCDFDataParametersImpl.class, |
|
82 |
"NetCDFDataParametersImpl_Persistent", |
|
83 |
"NetCDFDataParametersImpl Persistent", |
|
84 |
null, |
|
85 |
null |
|
86 |
); |
|
87 |
AbstractRasterFileDataParameters.registerDynClass(definition); |
|
88 |
} |
|
89 |
|
|
90 |
definition.addDynFieldString(FIELD_VARIABLE) |
|
91 |
.setDescription("Grid variable") |
|
92 |
.setMandatory(false); |
|
93 |
|
|
94 |
definition.addDynFieldInt(FIELD_LEVEL) |
|
95 |
.setDescription("Level selected") |
|
96 |
.setMandatory(false); |
|
97 |
|
|
98 |
definition.addDynFieldInt(FIELD_TIME) |
|
99 |
.setDescription("Time selected") |
|
100 |
.setMandatory(false); |
|
101 |
|
|
102 |
definition.addDynFieldString(FIELD_XDIM). |
|
103 |
setMandatory(false); |
|
104 |
|
|
105 |
definition.addDynFieldString(FIELD_YDIM). |
|
106 |
setMandatory(false); |
|
107 |
|
|
108 |
return definition; |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* Gets the list of grids |
|
113 |
* @return A list of pair of values. The first element of one pair is the variable's name |
|
114 |
* and the second its description |
|
115 |
* @throws IOException |
|
116 |
*/ |
|
117 |
public ArrayList<Variable> getVariables() throws IOException { |
|
118 |
if(varList == null) { |
|
119 |
NetcdfFile netCDFFile = NetcdfFile.open(getFile().getAbsolutePath()); |
|
120 |
varList = new ArrayList<Variable>(); |
|
121 |
|
|
122 |
List<Variable> variableList = netCDFFile.getVariables(); |
|
123 |
Iterator<Variable> it = variableList.iterator(); |
|
124 |
while(it.hasNext()) { |
|
125 |
Variable var = it.next(); |
|
126 |
varList.add(var); |
|
127 |
} |
|
128 |
netCDFFile.close(); |
|
129 |
} |
|
130 |
return varList; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* Gets the list of grids |
|
135 |
* @return A list of pair of values. The first element of one pair is the variable's name |
|
136 |
* and the second its description |
|
137 |
* @throws IOException |
|
138 |
*/ |
|
139 |
public ArrayList<String[]> getGridVariables() throws IOException { |
|
140 |
if(gridVarList == null) { |
|
141 |
GridDataset connector = GridDataset.open(getFile().getAbsolutePath()); |
|
142 |
List<GridDatatype> gridList = connector.getGrids(); |
|
143 |
gridVarList = new ArrayList<String[]>(); |
|
144 |
Iterator<GridDatatype> it = gridList.iterator(); |
|
145 |
while(it.hasNext()) { |
|
146 |
GridDatatype dt = it.next(); |
|
147 |
|
|
148 |
//Loads name and description |
|
149 |
String[] pair = new String[2]; |
|
150 |
pair[0] = dt.getName(); |
|
151 |
pair[1] = dt.getDescription(); |
|
152 |
gridVarList.add(pair); |
|
153 |
|
|
154 |
//Loads variable's name |
|
155 |
Dimension dim = dt.getDimensions().get(dt.getXDimensionIndex()); |
|
156 |
xDimVariable = dim.getName(); |
|
157 |
dim = dt.getDimensions().get(dt.getYDimensionIndex()); |
|
158 |
yDimVariable = dim.getName(); |
|
159 |
|
|
160 |
if(dt.getShape() != null) { |
|
161 |
GridCoordSystem gcs = dt.getCoordinateSystem(); |
|
162 |
//Loads levels |
|
163 |
CoordinateAxis1D zAxis = gcs.getVerticalAxis(); |
|
164 |
if(zAxis != null) { |
|
165 |
double[] d = calcSliceValue(zAxis.getCoordEdges()); |
|
166 |
rankByVar.put(pair[0], d); |
|
167 |
} |
|
168 |
|
|
169 |
//Loads time list |
|
170 |
if (gcs.hasTimeAxis1D()) { |
|
171 |
CoordinateAxis1DTime tAxis1D = gcs.getTimeAxis1D(); |
|
172 |
Date[] dates = tAxis1D.getTimeDates(); |
|
173 |
dateByVar.put(pair[0], dates); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
177 |
connector.close(); |
|
178 |
} |
|
179 |
return gridVarList; |
|
180 |
} |
|
181 |
|
|
182 |
/** |
|
183 |
* Calculates the array of levels |
|
184 |
* @param coordsEdges |
|
185 |
* @return |
|
186 |
*/ |
|
187 |
private double[] calcSliceValue(double[] coordsEdges) { |
|
188 |
if(coordsEdges == null) |
|
189 |
return null; |
|
190 |
double[] values = new double[coordsEdges.length - 1]; |
|
191 |
for (int i = 0; i < coordsEdges.length - 1; i++) { |
|
192 |
values[i] = ((coordsEdges[i] + coordsEdges[i + 1]) / 2); |
|
193 |
} |
|
194 |
return values; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Gets the list of dates |
|
199 |
* @param var |
|
200 |
* @return |
|
201 |
*/ |
|
202 |
public Date[] getTimeList(String var) { |
|
203 |
return dateByVar.get(var); |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* Gets the number of levels of one variable |
|
208 |
* @param var |
|
209 |
* @return |
|
210 |
*/ |
|
211 |
public double[] getLevelList(String var) { |
|
212 |
return rankByVar.get(var); |
|
213 |
} |
|
214 |
|
|
215 |
/** |
|
216 |
* Gets the variable's name of the X dimension |
|
217 |
* @return |
|
218 |
*/ |
|
219 |
public String getXDimVariable() { |
|
220 |
return xDimVariable; |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* Gets the variable's name of the Y dimension |
|
225 |
* @return |
|
226 |
*/ |
|
227 |
public String getYDimVariable() { |
|
228 |
return yDimVariable; |
|
229 |
} |
|
230 |
|
|
231 |
public String getDataStoreName() { |
|
232 |
return NetCDFProvider.NAME; |
|
233 |
} |
|
234 |
|
|
235 |
public String getDescription() { |
|
236 |
return NetCDFProvider.DESCRIPTION; |
|
237 |
} |
|
238 |
|
|
239 |
public void selectNextInstant() { |
|
240 |
int i = getFieldTime() + 1; |
|
241 |
if(i < getTimeListLength()) { |
|
242 |
setDynValue(NetCDFDataParameters.FIELD_TIME, i); |
|
243 |
} |
|
244 |
} |
|
245 |
|
|
246 |
public void selectPrevInstant() { |
|
247 |
int i = getFieldTime() - 1; |
|
248 |
if(i >= 0) { |
|
249 |
setDynValue(NetCDFDataParameters.FIELD_TIME, i); |
|
250 |
} |
|
251 |
} |
|
252 |
|
|
253 |
public void goTo(int position) { |
|
254 |
if(position < getTimeListLength() && position >= 0) { |
|
255 |
setDynValue(NetCDFDataParameters.FIELD_TIME, position); |
|
256 |
} |
|
257 |
} |
|
258 |
|
|
259 |
public int getFieldTime() { |
|
260 |
if(hasDynValue(NetCDFDataParameters.FIELD_TIME) && getDynValue(NetCDFDataParameters.FIELD_TIME) != null) { |
|
261 |
return ((Integer)getDynValue(NetCDFDataParameters.FIELD_TIME)).intValue(); |
|
262 |
} |
|
263 |
return 0; |
|
264 |
} |
|
265 |
|
|
266 |
public int getFieldLevel() { |
|
267 |
if(hasDynValue(NetCDFDataParameters.FIELD_LEVEL) && getDynValue(NetCDFDataParameters.FIELD_LEVEL) != null) { |
|
268 |
return ((Integer)getDynValue(NetCDFDataParameters.FIELD_LEVEL)).intValue(); |
|
269 |
} |
|
270 |
return 0; |
|
271 |
} |
|
272 |
|
|
273 |
public String getStringVariable() { |
|
274 |
if(hasDynValue(NetCDFDataParameters.FIELD_VARIABLE)) { |
|
275 |
return (String)getDynValue(NetCDFDataParameters.FIELD_VARIABLE); |
|
276 |
} |
|
277 |
|
|
278 |
//We will use the first variable in the list |
|
279 |
|
|
280 |
try { |
|
281 |
ArrayList<String[]> vars = getGridVariables(); |
|
282 |
if(vars.size() > 0) { |
|
283 |
String[] var = vars.get(0); |
|
284 |
if(var.length > 0) { |
|
285 |
setFieldVariable(var[0]); |
|
286 |
return var[0]; |
|
287 |
} |
|
288 |
} |
|
289 |
} catch (IOException e) { |
|
290 |
e.printStackTrace(); |
|
291 |
} |
|
292 |
return null; |
|
293 |
} |
|
294 |
|
|
295 |
public String getStringLevel() { |
|
296 |
if(!hasDynValue(NetCDFDataParameters.FIELD_LEVEL)) { |
|
297 |
//We will use the first level in the list |
|
298 |
setFieldLevel(0); |
|
299 |
} |
|
300 |
|
|
301 |
int index = ((Integer)getDynValue(NetCDFDataParameters.FIELD_LEVEL)).intValue(); |
|
302 |
double[] levelList = getLevelList(getStringVariable()); |
|
303 |
if(levelList == null) |
|
304 |
return "-1"; |
|
305 |
return levelList[index] + ""; |
|
306 |
} |
|
307 |
|
|
308 |
public String getStringTime() { |
|
309 |
if(!hasDynValue(NetCDFDataParameters.FIELD_TIME)) { |
|
310 |
setFieldTime(0); |
|
311 |
} |
|
312 |
|
|
313 |
int index = ((Integer)getDynValue(NetCDFDataParameters.FIELD_TIME)).intValue(); |
|
314 |
Date[] timeList = getTimeList(getStringVariable()); |
|
315 |
if(timeList == null) |
|
316 |
return "-1"; |
|
317 |
return timeList[index].toString(); |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* Gets the length of the time list |
|
322 |
* @return |
|
323 |
*/ |
|
324 |
private int getTimeListLength() { |
|
325 |
String var = (String)getDynValue(NetCDFDataParameters.FIELD_VARIABLE); |
|
326 |
if(var != null) { |
|
327 |
Date[] dateList = getTimeList(var); |
|
328 |
if(dateList != null) |
|
329 |
return dateList.length; |
|
330 |
} |
|
331 |
return 0; |
|
332 |
} |
|
333 |
|
|
334 |
public void setFieldVariable(String variable) { |
|
335 |
setDynValue(NetCDFDataParameters.FIELD_VARIABLE, variable); |
|
336 |
} |
|
337 |
|
|
338 |
public void setFieldTime(int timePosInList) { |
|
339 |
setDynValue(NetCDFDataParameters.FIELD_TIME, timePosInList); |
|
340 |
} |
|
341 |
|
|
342 |
public void setFieldLevel(int levelPosInList) { |
|
343 |
setDynValue(NetCDFDataParameters.FIELD_LEVEL, levelPosInList); |
|
344 |
} |
|
345 |
} |
|
0 | 346 |
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/org.gvsig.raster.netcdf.io/src/main/java/org/gvsig/raster/netcdf/io/DefaultNetCDFIOLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.netcdf.io; |
|
23 |
|
|
24 |
import org.gvsig.tools.library.AbstractLibrary; |
|
25 |
import org.gvsig.tools.library.LibraryException; |
|
26 |
/** |
|
27 |
* |
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
29 |
*/ |
|
30 |
public class DefaultNetCDFIOLibrary extends AbstractLibrary { |
|
31 |
|
|
32 |
@Override |
|
33 |
protected void doInitialize() throws LibraryException { |
|
34 |
//RasterLibrary.wakeUp(); |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doPostInitialize() throws LibraryException { |
|
39 |
//NetCDFServerExplorerParameters.registerDynClass(); |
|
40 |
NetCDFDataParametersImpl.registerDynClass(); |
|
41 |
NetCDFProvider.register(); |
|
42 |
//NetCDFWriter.register(); |
|
43 |
} |
|
44 |
} |
|
0 | 45 |
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/org.gvsig.raster.netcdf.io/src/main/java/org/gvsig/raster/netcdf/io/NetCDFProvider.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.netcdf.io; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.Point2D; |
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
import java.io.File; |
|
28 |
import java.io.IOException; |
|
29 |
import java.net.URI; |
|
30 |
import java.net.URISyntaxException; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
35 |
|
|
36 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
37 |
import org.gvsig.fmap.dal.DALLocator; |
|
38 |
import org.gvsig.fmap.dal.DataStore; |
|
39 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
40 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
41 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
42 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
43 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
44 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
45 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
46 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
|
47 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
48 |
import org.gvsig.fmap.dal.coverage.exception.ParsingException; |
|
49 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
50 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
51 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterFileStoreParameters; |
|
52 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
53 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
54 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
55 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
56 |
import org.gvsig.metadata.MetadataLocator; |
|
57 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
58 |
import org.gvsig.raster.impl.DefaultRasterManager; |
|
59 |
import org.gvsig.raster.impl.buffer.SpiRasterQuery; |
|
60 |
import org.gvsig.raster.impl.datastruct.DefaultNoData; |
|
61 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
62 |
import org.gvsig.raster.impl.provider.AbstractRasterProvider; |
|
63 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
64 |
import org.gvsig.raster.impl.provider.tile.FileTileServer; |
|
65 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
|
66 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
67 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
68 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
69 |
import org.gvsig.tools.ToolsLocator; |
|
70 |
|
|
71 |
import ucar.ma2.Array; |
|
72 |
import ucar.ma2.DataType; |
|
73 |
import ucar.ma2.InvalidRangeException; |
|
74 |
import ucar.ma2.Range; |
|
75 |
import ucar.nc2.dt.GridDatatype; |
|
76 |
import ucar.nc2.dt.grid.GridDataset; |
|
77 |
import ucar.unidata.geoloc.ProjectionRect; |
|
78 |
/** |
|
79 |
* Data provider for NetCDF files with raster data |
|
80 |
* |
|
81 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
82 |
*/ |
|
83 |
public class NetCDFProvider extends AbstractRasterProvider { |
|
84 |
public static String NAME = "NetCDF Raster"; |
|
85 |
public static String DESCRIPTION = "NetCDF Raster file"; |
|
86 |
public final String METADATA_DEFINITION_NAME = NAME; |
|
87 |
private Extent viewRequest = null; |
|
88 |
private TileServer tileServer = null; |
|
89 |
private boolean open = false; |
|
90 |
|
|
91 |
private GridDataset gridNetCDF = null; |
|
92 |
private List<GridDatatype> gridList = null; |
|
93 |
private GridDatatype selectedGridDataType = null; |
|
94 |
private DataStoreTransparency fileTransparency = null; |
|
95 |
private static final Logger logger = LoggerFactory.getLogger(NetCDFProvider.class); |
|
96 |
protected static String[] formatList = null; |
|
97 |
|
|
98 |
public static void register() { |
|
99 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
100 |
RasterLocator.getManager().getProviderServices().registerFileProvidersTiled(NetCDFProvider.class); |
|
101 |
registerFormats(); |
|
102 |
|
|
103 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
104 |
dataman.registerStoreProvider(NAME, |
|
105 |
NetCDFProvider.class, NetCDFDataParametersImpl.class); |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
/*if (!dataman.getExplorerProviders().contains(NetCDFFilesystemServerExplorer.NAME)) { |
|
110 |
dataman.registerExplorerProvider(NetCDFFilesystemServerExplorer.NAME, NetCDFFilesystemServerExplorer.class, NetCDFServerExplorerParameters.class); |
|
111 |
}*/ |
|
112 |
|
|
113 |
if(DALFileLocator.getFilesystemServerExplorerManager() != null) |
|
114 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
115 |
NAME, DESCRIPTION, |
|
116 |
NetCDFFilesystemServerExplorer.class); |
|
117 |
|
|
118 |
|
|
119 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
120 |
} |
|
121 |
|
|
122 |
private static void registerFormats() { |
|
123 |
formatList = new String[] {"nc", "nc4"}; |
|
124 |
for (int i = 0; i < formatList.length; i++) |
|
125 |
RasterLocator.getManager().getProviderServices().addFormat(formatList[i], NetCDFProvider.class); |
|
126 |
} |
|
127 |
|
|
128 |
public String[] getFormatList() { |
|
129 |
return formatList; |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* Returns true if the extension is supported and false if doesn't |
|
134 |
* @param ext |
|
135 |
* @return |
|
136 |
*/ |
|
137 |
public boolean isExtensionSupported(String ext) { |
|
138 |
if(ext.indexOf(".") != -1) |
|
139 |
ext = ext.substring(ext.lastIndexOf(".") + 1, ext.length()); |
|
140 |
for (int i = 0; i < formatList.length; i++) { |
|
141 |
if(formatList[i].compareTo(ext) == 0) |
|
142 |
return true; |
|
143 |
} |
|
144 |
return false; |
|
145 |
} |
|
146 |
|
|
147 |
public NetCDFProvider() { |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Opens the dataset. |
|
152 |
* @param proj Projection |
|
153 |
* @param fName File name |
|
154 |
* @throws NotSupportedExtensionException |
|
155 |
* @deprecated use {@link #NetCDFProvider(URI)}, this constructor will be removed in gvSIG 2.5 |
|
156 |
*/ |
|
157 |
public NetCDFProvider(String params) throws NotSupportedExtensionException, OpenException { |
|
158 |
super(params); |
|
159 |
logger.info("Deprecated use of NetCDFProvider constructor"); |
|
160 |
if(params instanceof String) { |
|
161 |
NetCDFDataParameters p = new NetCDFDataParametersImpl(); |
|
162 |
URI uriObj; |
|
163 |
try { |
|
164 |
uriObj = new URI((String)params); |
|
165 |
} catch (URISyntaxException e) { |
|
166 |
throw new OpenException("Can't create URI from "+(String)params, e); |
|
167 |
} |
|
168 |
p.setURI(uriObj); |
|
169 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
170 |
.createDynObject( |
|
171 |
MetadataLocator.getMetadataManager().getDefinition( |
|
172 |
DataStore.METADATA_DEFINITION_NAME))); |
|
173 |
init(p, null); |
|
174 |
} |
|
175 |
} |
|
176 |
|
|
177 |
/** |
|
178 |
* Opens the dataset. |
|
179 |
* @param proj Projection |
|
180 |
* @param fName File name |
|
181 |
* @throws NotSupportedExtensionException |
|
182 |
*/ |
|
183 |
public NetCDFProvider(URI uri) throws NotSupportedExtensionException, OpenException { |
|
184 |
super(uri); |
|
185 |
NetCDFDataParameters p = new NetCDFDataParametersImpl(); |
|
186 |
p.setURI(uri); |
|
187 |
super.init( |
|
188 |
p, |
|
189 |
null, |
|
190 |
ToolsLocator.getDynObjectManager().createDynObject( |
|
191 |
MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME))); |
|
192 |
init(p, null); |
|
193 |
} |
|
194 |
|
|
195 |
public NetCDFProvider (NetCDFDataParameters params, |
|
196 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException { |
|
197 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
198 |
.createDynObject( |
|
199 |
MetadataLocator.getMetadataManager().getDefinition( |
|
200 |
DataStore.METADATA_DEFINITION_NAME))); |
|
201 |
init(params, storeServices); |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* Build file references |
|
206 |
* @param proj Projection |
|
207 |
* @param param Load parameters |
|
208 |
* @throws NotSupportedExtensionException |
|
209 |
*/ |
|
210 |
public void init (NetCDFDataParameters params, |
|
211 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException { |
|
212 |
|
|
213 |
if(((RasterFileStoreParameters)params).getFile().exists()) { |
|
214 |
String fileName = ((RasterFileStoreParameters)params).getFile().getAbsolutePath(); |
|
215 |
try { |
|
216 |
gridNetCDF = GridDataset.open(fileName); |
|
217 |
gridList = gridNetCDF.getGrids(); |
|
218 |
if(gridList.size() == 0) |
|
219 |
throw new OpenException("There is not a grid variable", null); |
|
220 |
selectedGridDataType = gridList.get(0); |
|
221 |
//netCDFFile = NetcdfFile.open(((RasterFileStoreParameters)params).getFile().getAbsolutePath()); |
|
222 |
} catch (IOException e) { |
|
223 |
throw new OpenException("Imposible to read the file", e); |
|
224 |
} |
|
225 |
|
|
226 |
/*List<Variable> variableList = netCDFFile.getVariables(); |
|
227 |
Iterator<Variable> it = variableList.iterator(); |
|
228 |
while(it.hasNext()) { |
|
229 |
Variable var = it.next(); |
|
230 |
System.out.println("===>>" + var.getName()); |
|
231 |
}*/ |
|
232 |
|
|
233 |
setParam(storeServices, params); |
|
234 |
reloadMetadataFromGrid(); |
|
235 |
|
|
236 |
noData = new DefaultNoData(Double.NaN, Double.NaN, fileName); |
|
237 |
load(); |
|
238 |
} else |
|
239 |
setParam(storeServices, params); |
|
240 |
|
|
241 |
super.init(); |
|
242 |
selectSubdataset(getId(0, 0, 0)); |
|
243 |
try { |
|
244 |
loadFromRmf(getRmfBlocksManager()); |
|
245 |
} catch (ParsingException e) { |
|
246 |
//No lee desde rmf |
|
247 |
} |
|
248 |
open = true; |
|
249 |
} |
|
250 |
|
|
251 |
/** |
|
252 |
* Reloads metadata using the selected grid |
|
253 |
*/ |
|
254 |
private void reloadMetadataFromGrid() { |
|
255 |
//wktProjection = null; |
|
256 |
//CrsWkt crs = new CrsWkt(wktProjection); |
|
257 |
//IProjection proj = CRSFactory.getCRS("EPSG:23030"); |
|
258 |
|
|
259 |
/*LatLonRect gcs = selectedGridDataType.getCoordinateSystem().getLatLonBoundingBox(); |
|
260 |
getColorInterpretation(); |
|
261 |
double scaleX = gcs.getWidth() / selectedGridDataType.getXDimension().getLength(); |
|
262 |
double scaleY = gcs.getHeight() / selectedGridDataType.getYDimension().getLength(); |
|
263 |
ownTransformation = new AffineTransform( |
|
264 |
scaleX, 0, |
|
265 |
0, -scaleY, |
|
266 |
gcs.getLonMin(), |
|
267 |
gcs.getLatMax());*/ |
|
268 |
|
|
269 |
ProjectionRect pRect = selectedGridDataType.getCoordinateSystem().getBoundingBox(); |
|
270 |
double scaleX = pRect.getWidth() / selectedGridDataType.getXDimension().getLength(); |
|
271 |
double scaleY = pRect.getHeight() / selectedGridDataType.getYDimension().getLength(); |
|
272 |
ownTransformation = new AffineTransform( |
|
273 |
scaleX, 0, |
|
274 |
0, -scaleY, |
|
275 |
pRect.getMinX(), |
|
276 |
pRect.getMaxY()); |
|
277 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
278 |
bandCount = 1; //One variable is always shown |
|
279 |
setDataType(); |
|
280 |
} |
|
281 |
|
|
282 |
/** |
|
283 |
* @param dataType The dataType to set. |
|
284 |
*/ |
|
285 |
private void setDataType() { |
|
286 |
DataType dt = selectedGridDataType.getDataType(); |
|
287 |
int type = Buffer.TYPE_UNDEFINED; |
|
288 |
if(dt.name() == DataType.BYTE.name()) { |
|
289 |
type = Buffer.TYPE_BYTE; |
|
290 |
} |
|
291 |
if(dt.name() == DataType.SHORT.name()) { |
|
292 |
type = Buffer.TYPE_SHORT; |
|
293 |
} |
|
294 |
if(dt.name() == DataType.INT.name()) { |
|
295 |
type = Buffer.TYPE_INT; |
|
296 |
} |
|
297 |
if(dt.name() == DataType.DOUBLE.name()) { |
|
298 |
type = Buffer.TYPE_DOUBLE; |
|
299 |
} |
|
300 |
if(dt.name() == DataType.FLOAT.name()) { |
|
301 |
type = Buffer.TYPE_FLOAT; |
|
302 |
} |
|
303 |
if(dt.name() == DataType.LONG.name()) { |
|
304 |
type = Buffer.TYPE_DOUBLE; |
|
305 |
} |
|
306 |
|
|
307 |
int[] dtype = new int[getBandCount()]; |
|
308 |
for (int i = 0; i < dtype.length; i++) |
|
309 |
dtype[i] = type; |
|
310 |
setDataType(dtype); |
|
311 |
} |
|
312 |
|
|
313 |
public RasterProvider load() { |
|
314 |
return this; |
|
315 |
} |
|
316 |
|
|
317 |
public boolean isOpen() { |
|
318 |
return open; |
|
319 |
} |
|
320 |
|
|
321 |
public void close() { |
|
322 |
try { |
|
323 |
gridNetCDF.close(); |
|
324 |
} catch (IOException e) { |
|
325 |
logger.error("Error closing file", e); |
|
326 |
} |
|
327 |
} |
|
328 |
|
|
329 |
public URI translateURI(URI uri) { |
|
330 |
return uri; |
|
331 |
} |
|
332 |
|
|
333 |
/** |
|
334 |
* Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer una transformaci�n |
|
335 |
* de la vista asignada ya que la petici�n viene en coordenadas del fichero .rmf y la vista (v) |
|
336 |
* ha de estar en coordenadas del fichero. |
|
337 |
*/ |
|
338 |
public void setView(Extent e) { |
|
339 |
viewRequest = new ExtentImpl(e); |
|
340 |
} |
|
341 |
|
|
342 |
public Extent getView() { |
|
343 |
return viewRequest; |
|
344 |
} |
|
345 |
|
|
346 |
public double getWidth() { |
|
347 |
return selectedGridDataType.getXDimension().getLength(); |
|
348 |
} |
|
349 |
|
|
350 |
public double getHeight() { |
|
351 |
return selectedGridDataType.getYDimension().getLength(); |
|
352 |
} |
|
353 |
|
|
354 |
public Object readBlock(int pos, int blockHeight, double scale) |
|
355 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
356 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
357 |
if(pos < 0) |
|
358 |
throw new InvalidSetViewException("Request out of grid"); |
|
359 |
|
|
360 |
if((pos + blockHeight) > getHeight()) |
|
361 |
blockHeight = Math.abs(((int)getHeight()) - pos); |
|
362 |
|
|
363 |
Buffer buf = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], (int)getWidth(), blockHeight, 1, true); |
|
364 |
try { |
|
365 |
int time = p.getFieldTime(); |
|
366 |
int level = getLevelValue(); |
|
367 |
Range rangeY = new Range(pos, pos + blockHeight - 1, 1); |
|
368 |
Range rangeX = new Range(0, (int)(getWidth() - 1), 1); |
|
369 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null /*getTime(1), getLevel(1)*/, rangeY, rangeX); |
|
370 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
371 |
return arrayValuesToBuffer(values, buf, rangeX.length(), rangeY.length(), null); |
|
372 |
} catch (IOException e) { |
|
373 |
throw new RasterDriverException("Error reading a slice", e); |
|
374 |
} catch (InvalidRangeException e) { |
|
375 |
throw new RasterDriverException("Error reading a slice", e); |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
379 |
public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
380 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
381 |
if(x < 0 || y < 0 || x >= getWidth() || y >= getHeight()) |
|
382 |
throw new InvalidSetViewException("Request out of grid"); |
|
383 |
try { |
|
384 |
int strideX = 1; |
|
385 |
int strideY = 1; |
|
386 |
Range rangeY = new Range((int)(getHeight() - y), (int)(getHeight() - y), strideY); |
|
387 |
Range rangeX = new Range(x, x, strideX); |
|
388 |
|
|
389 |
selectSubdataset(); |
|
390 |
int time = p.getFieldTime(); |
|
391 |
int level = getLevelValue(); |
|
392 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null, rangeY, rangeX); |
|
393 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
394 |
Object data = null; |
|
395 |
|
|
396 |
if(getDataType()[0] == Buffer.TYPE_BYTE) { |
|
397 |
data = new java.lang.Integer(values.getByte(0)); |
|
398 |
} |
|
399 |
|
|
400 |
if(getDataType()[0] == Buffer.TYPE_SHORT) { |
|
401 |
data = new java.lang.Integer(values.getShort(0)); |
|
402 |
} |
|
403 |
|
|
404 |
if(getDataType()[0] == Buffer.TYPE_INT) { |
|
405 |
data = new java.lang.Integer(values.getInt(0)); |
|
406 |
} |
|
407 |
|
|
408 |
if(getDataType()[0] == Buffer.TYPE_FLOAT) { |
|
409 |
data = new java.lang.Float(values.getFloat(0)); |
|
410 |
} |
|
411 |
if(getDataType()[0] == Buffer.TYPE_DOUBLE) { |
|
412 |
data = new java.lang.Double(values.getDouble(0)); |
|
413 |
} |
|
414 |
return data; |
|
415 |
} catch (IOException e) { |
|
416 |
throw new RasterDriverException("Error reading a slice", e); |
|
417 |
} catch (InvalidRangeException e) { |
|
418 |
throw new RasterDriverException("Error reading a slice", e); |
|
419 |
} |
|
420 |
} |
|
421 |
|
|
422 |
@Override |
|
423 |
public void loadBuffer(SpiRasterQuery query) |
|
424 |
throws ProcessInterruptedException, RasterDriverException { |
|
425 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
426 |
setView(query.getAdjustedRequestBoundingBox()); |
|
427 |
|
|
428 |
Point2D ul = new Point2D.Double(viewRequest.getULX(), viewRequest.getULY()); |
|
429 |
Point2D lr = new Point2D.Double(viewRequest.getLRX(), viewRequest.getLRY()); |
|
430 |
ul = worldToRaster(ul); |
|
431 |
lr = worldToRaster(lr); |
|
432 |
ul.setLocation(ul.getX() < 0 ? 0 : ul.getX(), ul.getY() < 0 ? 0 : ul.getY()); |
|
433 |
lr.setLocation(lr.getX() < 0 ? 0 : lr.getX(), lr.getY() < 0 ? 0 : lr.getY()); |
|
434 |
ul.setLocation(ul.getX() >= getWidth() ? getWidth() - 1 : ul.getX(), ul.getY() >= getHeight() ? getHeight() - 1 : ul.getY()); |
|
435 |
lr.setLocation(lr.getX() >= getWidth() ? getWidth() - 1 : lr.getX(), lr.getY() >= getHeight() ? getHeight() - 1 : lr.getY()); |
|
436 |
|
|
437 |
adjustPoints(ul, lr); |
|
438 |
|
|
439 |
//int width = Math.abs(((int)lr.getX()) - ((int)ul.getX())); |
|
440 |
//int height = Math.abs(((int)lr.getY()) - ((int)ul.getY())); |
|
441 |
try { |
|
442 |
int strideX = 1; |
|
443 |
int strideY = 1; |
|
444 |
Range rangeY = new Range((int)(getHeight() - lr.getY()), (int)(getHeight() - ul.getY() - 1), strideY <= 0 ? 1 : strideY); |
|
445 |
Range rangeX = new Range((int)ul.getX(), (int)(lr.getX() - 1), strideX <= 0 ? 1 : strideX); |
|
446 |
|
|
447 |
selectSubdataset(); |
|
448 |
int time = p.getFieldTime(); |
|
449 |
int level = getLevelValue(); |
|
450 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null /*getTime(strideX), getLevel(strideX)*/, rangeY, rangeX); |
|
451 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
452 |
Rectangle2D r = query.getBufferForProviders().getDataExtent(); |
|
453 |
Buffer rasterBuf = arrayValuesToBuffer( |
|
454 |
values, |
|
455 |
query.getBufferForProviders(), |
|
456 |
rangeX.length(), |
|
457 |
rangeY.length(), |
|
458 |
query.getBandList()); |
|
459 |
rasterBuf.setDataExtent(r); |
|
460 |
query.setBufferResult(rasterBuf); |
|
461 |
} catch (IOException e) { |
|
462 |
throw new RasterDriverException("Error reading a slice", e); |
|
463 |
} catch (InvalidRangeException e) { |
|
464 |
throw new RasterDriverException("Error reading a slice", e); |
|
465 |
} |
|
466 |
|
|
467 |
} |
|
468 |
|
|
469 |
|
|
470 |
/*public Buffer getWindow(Extent extent, BandList bandList, Buffer rasterBuf, TaskStatus status) |
|
471 |
throws ProcessInterruptedException, RasterDriverException { |
|
472 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
473 |
setView(extent); |
|
474 |
|
|
475 |
Point2D ul = new Point2D.Double(viewRequest.getULX(), viewRequest.getULY()); |
|
476 |
Point2D lr = new Point2D.Double(viewRequest.getLRX(), viewRequest.getLRY()); |
|
477 |
ul = worldToRaster(ul); |
|
478 |
lr = worldToRaster(lr); |
|
479 |
ul.setLocation(ul.getX() < 0 ? 0 : ul.getX(), ul.getY() < 0 ? 0 : ul.getY()); |
|
480 |
lr.setLocation(lr.getX() < 0 ? 0 : lr.getX(), lr.getY() < 0 ? 0 : lr.getY()); |
|
481 |
ul.setLocation(ul.getX() > getWidth() ? getWidth() : ul.getX(), ul.getY() > getHeight() ? getHeight() : ul.getY()); |
|
482 |
lr.setLocation(lr.getX() > getWidth() ? getWidth() : lr.getX(), lr.getY() > getHeight() ? getHeight() : lr.getY()); |
|
483 |
|
|
484 |
adjustPoints(ul, lr); |
|
485 |
|
|
486 |
try { |
|
487 |
int strideX = 1; |
|
488 |
int strideY = 1; |
|
489 |
Range rangeY = new Range((int)(getHeight() - lr.getY()), (int)(getHeight() - ul.getY() - 1), strideY); |
|
490 |
Range rangeX = new Range((int)ul.getX(), (int)(lr.getX() - 1), strideX); |
|
491 |
|
|
492 |
selectSubdataset(); |
|
493 |
int time = p.getFieldTime(); |
|
494 |
int level = getLevelValue(); |
|
495 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null , rangeY, rangeX); |
|
496 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
497 |
rasterBuf = arrayValuesToBuffer(values, rasterBuf, rangeX.length(), rangeY.length(), bandList); |
|
498 |
} catch (IOException e) { |
|
499 |
throw new RasterDriverException("Error reading a slice", e); |
|
500 |
} catch (InvalidRangeException e) { |
|
501 |
throw new RasterDriverException("Error reading a slice", e); |
|
502 |
} |
|
503 |
|
|
504 |
return rasterBuf; |
|
505 |
}*/ |
|
506 |
|
|
507 |
/*public Buffer getWindow(Extent extent, int bufWidth, int bufHeight, |
|
508 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException { |
|
509 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
510 |
setView(extent); |
|
511 |
|
|
512 |
Point2D ul = new Point2D.Double(viewRequest.getULX(), viewRequest.getULY()); |
|
513 |
Point2D lr = new Point2D.Double(viewRequest.getLRX(), viewRequest.getLRY()); |
|
514 |
ul = worldToRaster(ul); |
|
515 |
lr = worldToRaster(lr); |
|
516 |
ul.setLocation(ul.getX() < 0 ? 0 : ul.getX(), ul.getY() < 0 ? 0 : ul.getY()); |
|
517 |
lr.setLocation(lr.getX() < 0 ? 0 : lr.getX(), lr.getY() < 0 ? 0 : lr.getY()); |
|
518 |
ul.setLocation(ul.getX() >= getWidth() ? getWidth() - 1 : ul.getX(), ul.getY() >= getHeight() ? getHeight() - 1 : ul.getY()); |
|
519 |
lr.setLocation(lr.getX() >= getWidth() ? getWidth() - 1 : lr.getX(), lr.getY() >= getHeight() ? getHeight() - 1 : lr.getY()); |
|
520 |
|
|
521 |
adjustPoints(ul, lr); |
|
522 |
|
|
523 |
int width = Math.abs(((int)lr.getX()) - ((int)ul.getX())); |
|
524 |
int height = Math.abs(((int)lr.getY()) - ((int)ul.getY())); |
|
525 |
|
|
526 |
try { |
|
527 |
int strideX = width / rasterBuf.getWidth(); |
|
528 |
int strideY = height / rasterBuf.getHeight(); |
|
529 |
Range rangeY = new Range((int)(getHeight() - lr.getY()), (int)(getHeight() - ul.getY() - 1), strideY <= 0 ? 1 : strideY); |
|
530 |
Range rangeX = new Range((int)ul.getX(), (int)(lr.getX() - 1), strideX <= 0 ? 1 : strideX); |
|
531 |
|
|
532 |
selectSubdataset(); |
|
533 |
int time = p.getFieldTime(); |
|
534 |
int level = getLevelValue(); |
|
535 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null , rangeY, rangeX); |
|
536 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
537 |
rasterBuf = arrayValuesToBuffer(values, rasterBuf, rangeX.length(), rangeY.length(), bandList); |
|
538 |
} catch (IOException e) { |
|
539 |
throw new RasterDriverException("Error reading a slice", e); |
|
540 |
} catch (InvalidRangeException e) { |
|
541 |
throw new RasterDriverException("Error reading a slice", e); |
|
542 |
} |
|
543 |
|
|
544 |
return rasterBuf; |
|
545 |
}*/ |
|
546 |
|
|
547 |
/*public Buffer getWindow(int x, int y, int w, int h, |
|
548 |
BandList bandList, Buffer rasterBuf, TaskStatus status) throws ProcessInterruptedException, RasterDriverException { |
|
549 |
try { |
|
550 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
551 |
int strideX = 1; |
|
552 |
int strideY = 1; |
|
553 |
Range rangeY = new Range((int)(h - y), (int)(h - y - 1), strideY); |
|
554 |
Range rangeX = new Range((int)x, (int)(x + w - 1), strideX); |
|
555 |
|
|
556 |
selectSubdataset(); |
|
557 |
int time = p.getFieldTime(); |
|
558 |
int level = getLevelValue(); |
|
559 |
GridDatatype dt = selectedGridDataType.makeSubset(null, null, null, null, rangeY, rangeX); |
|
560 |
Array values = dt.readDataSlice(time, level, -1, -1); |
|
561 |
rasterBuf = arrayValuesToBuffer(values, rasterBuf, rangeX.length(), rangeY.length(), bandList); |
|
562 |
} catch (IOException e) { |
|
563 |
throw new RasterDriverException("Error reading a slice", e); |
|
564 |
} catch (InvalidRangeException e) { |
|
565 |
throw new RasterDriverException("Error reading a slice", e); |
|
566 |
} |
|
567 |
|
|
568 |
return rasterBuf; |
|
569 |
}*/ |
|
570 |
|
|
571 |
/** |
|
572 |
* Gets the Range of the selected time or null if there is not a selected time |
|
573 |
* @param strideX |
|
574 |
* @return |
|
575 |
* @throws InvalidRangeException |
|
576 |
*/ |
|
577 |
@SuppressWarnings("unused") |
|
578 |
private Range getTime(int strideX) throws InvalidRangeException { |
|
579 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
580 |
int time = p.getFieldTime(); |
|
581 |
return new Range(time, time, strideX); |
|
582 |
} |
|
583 |
|
|
584 |
/*private int getTimeValue() { |
|
585 |
int time = 0; |
|
586 |
if(param.hasDynValue(NetCDFDataParameters.FIELD_TIME)) |
|
587 |
time = ((Integer)param.getDynValue(NetCDFDataParameters.FIELD_TIME)).intValue(); |
|
588 |
return time; |
|
589 |
}*/ |
|
590 |
|
|
591 |
/** |
|
592 |
* Gets the Range of the selected level or null if there is not a selected level |
|
593 |
* @param strideX |
|
594 |
* @return |
|
595 |
* @throws InvalidRangeException |
|
596 |
*/ |
|
597 |
@SuppressWarnings("unused") |
|
598 |
private Range getLevel(int strideX) throws InvalidRangeException { |
|
599 |
int level = getLevelValue(); |
|
600 |
return new Range(level, level, strideX); |
|
601 |
} |
|
602 |
|
|
603 |
private int getLevelValue() { |
|
604 |
int level = 0; |
|
605 |
if(param.hasDynValue(NetCDFDataParameters.FIELD_LEVEL) && param.getDynValue(NetCDFDataParameters.FIELD_LEVEL) != null) |
|
606 |
level = ((Integer)param.getDynValue(NetCDFDataParameters.FIELD_LEVEL)).intValue(); |
|
607 |
return level; |
|
608 |
} |
|
609 |
|
|
610 |
|
|
611 |
/** |
|
612 |
* Selects the GridDataType using the selected variable in the parameters |
|
613 |
*/ |
|
614 |
public void selectSubdataset() { |
|
615 |
if(param.hasDynValue(NetCDFDataParameters.FIELD_VARIABLE)) { |
|
616 |
NetCDFDataParameters p = (NetCDFDataParameters)param; |
|
617 |
String variable = (String)param.getDynValue(NetCDFDataParameters.FIELD_VARIABLE); |
|
618 |
if(variable != null) { |
|
619 |
for (int j = 0; j < gridList.size(); j++) { |
|
620 |
if(gridList.get(j).getName().compareTo(variable) == 0) { |
|
621 |
selectedGridDataType = gridList.get(j); |
|
622 |
reloadMetadataFromGrid(); |
|
623 |
super.selectSubdataset(getId(j, getLevelValue(), p.getFieldTime())); |
|
624 |
} |
|
625 |
} |
|
626 |
} |
|
627 |
} |
|
628 |
} |
|
629 |
|
|
630 |
/** |
|
631 |
* Gets the identifier of a subdataset |
|
632 |
* @param grid |
|
633 |
* @param level |
|
634 |
* @param time |
|
635 |
* @return |
|
636 |
*/ |
|
637 |
private String getId(int grid, int level, int time) { |
|
638 |
return grid + "-" + level + "-" + time; |
|
639 |
} |
|
640 |
|
|
641 |
/** |
|
642 |
* Loads a Buffer object from an netCDF Array. |
|
643 |
* @param values |
|
644 |
* @param rasterBuf |
|
645 |
* @param w |
|
646 |
* @param h |
|
647 |
* @return |
|
648 |
*/ |
|
649 |
private Buffer arrayValuesToBuffer(Array values, Buffer rasterBuf, int w, int h, BandList bandList) { |
|
650 |
Buffer buf = null; |
|
651 |
boolean resampling = false; |
|
652 |
|
|
653 |
if((rasterBuf.getWidth() * rasterBuf.getHeight()) != values.getSize()) { |
|
654 |
buf = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], w, h, rasterBuf.getBandCount(), true); |
|
655 |
resampling = true; |
|
656 |
} else |
|
657 |
buf = rasterBuf; |
|
658 |
|
|
659 |
int[] drawableBands = bandList != null ? bandList.getBufferBandToDraw(new File(getURIOfFirstProvider()).getAbsolutePath(), 0) : new int[1]; |
|
660 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
661 |
return rasterBuf; |
|
662 |
|
|
663 |
if(getDataType()[0] == Buffer.TYPE_BYTE) { |
|
664 |
for (int i = 0; i < values.getSize(); i++) { |
|
665 |
int[] rc = getColAndRow(i, buf); |
|
666 |
for (int iBands = 0; iBands < drawableBands.length; iBands++) |
|
667 |
buf.setElem(rc[0], rc[1], drawableBands[iBands], values.getByte(i)); |
|
668 |
} |
|
669 |
} |
|
670 |
|
|
671 |
if(getDataType()[0] == Buffer.TYPE_SHORT) { |
|
672 |
for (int i = 0; i < values.getSize(); i++) { |
|
673 |
int[] rc = getColAndRow(i, buf); |
|
674 |
for (int iBands = 0; iBands < drawableBands.length; iBands++) |
|
675 |
buf.setElem(rc[0], rc[1], drawableBands[iBands], values.getShort(i)); |
|
676 |
} |
|
677 |
} |
|
678 |
|
|
679 |
if(getDataType()[0] == Buffer.TYPE_INT) { |
|
680 |
for (int i = 0; i < values.getSize(); i++) { |
|
681 |
int[] rc = getColAndRow(i, buf); |
|
682 |
for (int iBands = 0; iBands < drawableBands.length; iBands++) |
|
683 |
buf.setElem(rc[0], rc[1], drawableBands[iBands], values.getInt(i)); |
|
684 |
} |
|
685 |
} |
|
686 |
|
|
687 |
if(getDataType()[0] == Buffer.TYPE_FLOAT) { |
|
688 |
for (int i = 0; i < values.getSize(); i++) { |
|
689 |
int[] rc = getColAndRow(i, buf); |
|
690 |
for (int iBands = 0; iBands < drawableBands.length; iBands++) |
|
691 |
buf.setElem(rc[0], rc[1], drawableBands[iBands], values.getFloat(i)); |
|
692 |
} |
|
693 |
} |
|
694 |
|
|
695 |
if(getDataType()[0] == Buffer.TYPE_DOUBLE) { |
|
696 |
for (int i = 0; i < values.getSize(); i++) { |
|
697 |
int[] rc = getColAndRow(i, buf); |
|
698 |
for (int iBands = 0; iBands < drawableBands.length; iBands++) |
|
699 |
buf.setElem(rc[0], rc[1], drawableBands[iBands], values.getDouble(i)); |
|
700 |
} |
|
701 |
} |
|
702 |
if(resampling) { |
|
703 |
try { |
|
704 |
Buffer result = null; |
|
705 |
result = buf.getAdjustedWindow(rasterBuf.getWidth(), rasterBuf.getHeight(), Buffer.INTERPOLATION_NearestNeighbour); |
|
706 |
if(result != buf) |
|
707 |
buf.dispose(); |
|
708 |
return result; |
|
709 |
} catch (ProcessInterruptedException e) { |
|
710 |
return buf; |
|
711 |
} |
|
712 |
} |
|
713 |
return buf; |
|
714 |
} |
|
715 |
|
|
716 |
/** |
|
717 |
* Calculates the row and column number for the position i in the |
|
718 |
* array of data |
|
719 |
* @param i |
|
720 |
* @param buf |
|
721 |
* @return |
|
722 |
*/ |
|
723 |
private int[] getColAndRow(int i, Buffer buf) { |
|
724 |
int auxRow = (int)(i / buf.getWidth()); |
|
725 |
return new int[]{ |
|
726 |
(int)buf.getHeight() - auxRow - 1, |
|
727 |
i - (auxRow * buf.getWidth()) |
|
728 |
}; |
|
729 |
} |
|
730 |
|
|
731 |
private void adjustPoints(Point2D ul, Point2D lr) { |
|
732 |
double a = (ul.getX() - (int)ul.getX()); |
|
733 |
double b = (ul.getY() - (int)ul.getY()); |
|
734 |
ul.setLocation( (a > 0.95 || a < 0.05) ? Math.round(ul.getX()) : ul.getX(), |
|
735 |
(b > 0.95 || b < 0.05) ? Math.round(ul.getY()) : ul.getY()); |
|
736 |
lr.setLocation( (a > 0.95 || a < 0.05) ? Math.round(lr.getX()) : lr.getX(), |
|
737 |
(b > 0.95 || b < 0.05) ? Math.round(lr.getY()) : lr.getY()); |
|
738 |
} |
|
739 |
|
|
740 |
public int getBlockSize(){ |
|
741 |
return 0; |
|
742 |
} |
|
743 |
|
|
744 |
public ColorInterpretation getColorInterpretation() { |
|
745 |
if(super.getColorInterpretation() == null) { |
|
746 |
setColorInterpretation(new DataStoreColorInterpretation(new String[]{ColorInterpretation.GRAY_BAND})); |
|
747 |
} |
|
748 |
return super.getColorInterpretation(); |
|
749 |
} |
|
750 |
|
|
751 |
public DataStoreTransparency getTransparency() { |
|
752 |
if(fileTransparency == null) |
|
753 |
fileTransparency = new DataStoreTransparency(getColorInterpretation()); |
|
754 |
return fileTransparency; |
|
755 |
} |
|
756 |
|
|
757 |
/** |
|
758 |
* Informa de si el driver ha supersampleado en el �ltimo dibujado. Es el driver el que colocar� |
|
759 |
* el valor de esta variable cada vez que dibuja. |
|
760 |
* @return true si se ha supersampleado y false si no se ha hecho. |
|
761 |
*/ |
|
762 |
public boolean isSupersampling() { |
|
763 |
return false; |
|
764 |
} |
|
765 |
|
|
766 |
public void setAffineTransform(AffineTransform t){ |
|
767 |
super.setAffineTransform(t); |
|
768 |
} |
|
769 |
|
|
770 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
771 |
if(band >= getBandCount()) |
|
772 |
throw new BandAccessException("Wrong band"); |
|
773 |
return 0; |
|
774 |
} |
|
775 |
|
|
776 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
777 |
if (band >= getBandCount()) |
|
778 |
throw new BandAccessException("Wrong band"); |
|
779 |
return 0; |
|
780 |
} |
|
781 |
|
|
782 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
783 |
if (band >= getBandCount()) |
|
784 |
throw new BandAccessException("Wrong band"); |
|
785 |
return 0; |
|
786 |
} |
|
787 |
|
|
788 |
public boolean isOverviewsSupported() { |
|
789 |
return true; |
|
790 |
} |
|
791 |
|
|
792 |
public boolean isReproyectable() { |
|
793 |
return true; |
|
794 |
} |
|
795 |
|
|
796 |
public String getProviderName() { |
|
797 |
return NAME; |
|
798 |
} |
|
799 |
|
|
800 |
public void setStatus(RasterProvider provider) { |
|
801 |
if(provider instanceof NetCDFProvider) { |
|
802 |
//Not implemented yet |
|
803 |
} |
|
804 |
} |
|
805 |
|
|
806 |
public boolean isTimeSupported() { |
|
807 |
return true; |
|
808 |
} |
|
809 |
|
|
810 |
public TileServer getTileServer() { |
|
811 |
if(tileServer == null) { |
|
812 |
DefaultRasterStore store = new DefaultRasterStore(); |
|
813 |
store.setProvider(this); |
|
814 |
tileServer = new FileTileServer(store); |
|
815 |
} |
|
816 |
return tileServer; |
|
817 |
} |
|
818 |
|
|
819 |
public void addFile(File file) throws InvalidSourceException { |
|
820 |
// Do nothing |
|
821 |
} |
|
822 |
|
|
823 |
public void removeFile(File file) { |
|
824 |
// Do nothing |
|
825 |
} |
|
826 |
} |
|
0 | 827 |
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/org.gvsig.raster.netcdf.io/src/main/java/org/gvsig/raster/netcdf/io/NetCDFServerExplorerParameters.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.raster.netcdf.io; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
31 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.dynobject.DynField; |
|
36 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
37 |
|
|
38 |
|
|
39 |
/** |
|
40 |
* Parameters for the NetCDF explorer |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
*/ |
|
43 |
public class NetCDFServerExplorerParameters extends FilesystemServerExplorerParameters |
|
44 |
implements DataServerExplorerParameters { |
|
45 |
public static final String PARAMS_NAME = "NetCDFRasterServerExplorerParameters"; |
|
46 |
protected static DynClass DYNCLASS = null; |
|
47 |
private static final String FIELD_ROOT = "root"; |
|
48 |
private static DelegatedDynObject delegatedDynObject = null; |
|
49 |
|
|
50 |
public NetCDFServerExplorerParameters() { |
|
51 |
super(); |
|
52 |
initialize(); |
|
53 |
} |
|
54 |
|
|
55 |
protected void initialize() { |
|
56 |
delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
57 |
.getDynObjectManager().createDynObject( |
|
58 |
DYNCLASS); |
|
59 |
} |
|
60 |
|
|
61 |
public static DynClass registerDynClass() { |
|
62 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
|
63 |
DynClass dynClass = dynman.get(PARAMS_NAME); |
|
64 |
DynField field; |
|
65 |
if (dynClass == null) { |
|
66 |
dynClass = dynman.add(PARAMS_NAME); |
|
67 |
|
|
68 |
field = dynClass.addDynFieldString(FIELD_ROOT); |
|
69 |
field.setDescription("Root directory path of the explorer"); |
|
70 |
field.setMandatory(false); |
|
71 |
field.setClassOfValue(String.class); |
|
72 |
|
|
73 |
field = dynClass.addDynFieldString("initialpath"); |
|
74 |
field.setDescription("Initial path of the explorer"); |
|
75 |
field.setMandatory(false); |
|
76 |
field.setClassOfValue(String.class); |
|
77 |
DYNCLASS = dynClass; |
|
78 |
} |
|
79 |
return dynClass; |
|
80 |
} |
|
81 |
|
|
82 |
public void setRoot(String path) { |
|
83 |
this.setDynValue(FIELD_ROOT, path); |
|
84 |
} |
|
85 |
|
|
86 |
public String getRoot() { |
|
87 |
return (String) this.getDynValue(FIELD_ROOT); |
|
88 |
} |
|
89 |
|
|
90 |
public void setInitialpath(String path) { |
|
91 |
this.setDynValue("initialpath", path); |
|
92 |
} |
|
93 |
|
|
94 |
public String getInitialpath() { |
|
95 |
return (String) this.getDynValue("initialpath"); |
|
96 |
} |
|
97 |
|
|
98 |
public String getExplorerName() { |
|
99 |
return NetCDFFilesystemServerExplorer.NAME; |
|
100 |
} |
|
101 |
|
|
102 |
public String getDataStoreName() { |
|
103 |
return NetCDFProvider.NAME; |
|
104 |
} |
|
105 |
|
|
106 |
public String getDescription() { |
|
107 |
return NetCDFProvider.DESCRIPTION; |
|
108 |
} |
|
109 |
|
|
110 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
111 |
return delegatedDynObject; |
|
112 |
} |
|
113 |
} |
|
0 | 114 |
org.gvsig.raster.netcdf/tags/org.gvsig.raster.netcdf-2.2.76/org.gvsig.raster.netcdf.io/src/main/java/org/gvsig/raster/netcdf/io/NetCDFFilesystemServerExplorer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
Also available in: Unified diff