[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #ANB-661794]: Error to open a Netcdf File



hi:

usually you just open the opendap url like this:

NetcdfFile ncfile = 
NetcdfDataset.openFile("http://motherlode.ucar.edu:8080/thredds/dodsC/galeon/testdata/striped.nc";,
 null);

john

> Hello,
> Is there any way to work with the library NetCDF Java Library so you can
> open files that are in remote in a Thredds Server? I am developing a litlle
> application and I need to read netcdf files by calling to OPEnDAP, but i can
> not read the data from the netcdf file with Java code.
> Thanks in advance
> 
> 2011/4/7 Manuel Antonio Regueiro <address@hidden>
> 
> > Hi again
> > I used OPeNDAP as you said me, but now I have another problem.
> > I try to read the data from the netcdf using:
> >
> >
> > List<Variable> variables1 = nc1.getVariables();
> > List<Array> datos1;
> >  Iterator iter1 = variables1.iterator();
> >
> >                 while (iter1.hasNext()) {
> >                     Variable var = (Variable) iter1.next();
> >
> >                     if (var.getName().equalsIgnoreCase("u_current")) {
> >
> >                         List variable = new ArrayList<Array>();
> >                         variable.add(var);
> >                         datos1 = nc1.readArrays(variable);
> >                      }
> >                 }
> >
> >
> > but ...
> >
> > 07-abr-2011 13:36:49 ucar.nc2.dods.DODSNetcdfFile readArrays
> > GRAVE: ERROR readDataDDSfromServer on ?u_current
> > opendap.dap.DAP2Exception: Method failed:HTTP/1.1 403 Forbidden
> >         at opendap.dap.DConnect2.openConnection(DConnect2.java:228)
> >         at opendap.dap.DConnect2.getData(DConnect2.java:708)
> >         at opendap.dap.DConnect2.getData(DConnect2.java:988)
> >         at
> > ucar.nc2.dods.DODSNetcdfFile.readDataDDSfromServer(DODSNetcdfFile.java:1169)
> >         at
> > ucar.nc2.dods.DODSNetcdfFile.readArrays(DODSNetcdfFile.java:1223)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.Suma.Operation(Suma.java:130)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.RefinedNetcdfOperation.Operation(RefinedNetcdfOperation.java:30)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.AbstractNetCDFOperation.run(AbstractNetCDFOperation.java:181)
> >         at
> > org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:569)
> >         at
> > org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:78)
> >         at
> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >         at java.lang.Thread.run(Thread.java:662)
> > java.io.IOException: Method failed:HTTP/1.1 403 Forbidden
> >         at
> > ucar.nc2.dods.DODSNetcdfFile.readArrays(DODSNetcdfFile.java:1228)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.Suma.Operation(Suma.java:130)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.RefinedNetcdfOperation.Operation(RefinedNetcdfOperation.java:30)
> >         at
> > org.n52.wps.server.algorithm.NetCDF.AbstractNetCDFOperation.run(AbstractNetCDFOperation.java:181)
> >         at
> > org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:569)
> >         at
> > org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:78)
> >         at
> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >         at java.lang.Thread.run(Thread.java:662)
> >
> > ÂWhat`s wrong with the java code?
> >
> > Thanks
> >
> >
> > 2011/4/1 Unidata netCDF Java Support <address@hidden
> > >
> >
> >> Hello Manuel,
> >>
> >> The URL you are using is a WMS GetCoverage request. The response to this
> >> request is a full netCDF file, without HTTP byte range support. The
> >> netCDF-java library doesn't support non-"byte range" HTTP access to remote
> >> netCDF files.
> >>
> >> From the dataset page for this dataset
> >>
> >>
> >> http://motherlode.ucar.edu:8080/thredds/catalog/galeon/testdata/catalog.html?dataset=galeon/testdata/striped.nc
> >>
> >> there are two other services supported for this dataset: OPeNDAP and a
> >> straight HTTP service. The netCDF-Java library can open this dataset using
> >> either of those services (OPeNDAP, the first link below, should be 
> >> preferred
> >> for performance reasons):
> >>
> >> http://motherlode.ucar.edu:8080/thredds/dodsC/galeon/testdata/striped.nc
> >>
> >> http://motherlode.ucar.edu:8080/thredds/fileServer/galeon/testdata/striped.nc
> >>
> >> The dataset subsetting that was part of your WCS request (e.g.,
> >> "coverage=ta" and "time=..." and "bbox=...") will have to be handled with
> >> the netCDF-java API (either in index space or using GridDataset).
> >>
> >> Hope that helps,
> >>
> >> Ethan
> >>
> >> > Hi,
> >> > I am trying to acquire a netcdf file with java code and the library
> >> "netcdf
> >> > java library 4.2".
> >> > I wrote:
> >> > NetcdfDataset gid = NetcdfDataset.openDataset("
> >> >
> >> http://motherlode.ucar.edu:8080/thredds/wcs/galeon/testdata/striped.nc?request=GetCoverage&version=1.0.0&service=WCS&format=NetCDF3&coverage=ta&time=2005-05-10T00:00:00Z&bbox=-134,11,-47,57
> >> > ");
> >> > With my browser the URL works well, but when i execute the code i have
> >> an
> >> > error: "Content Lenght is not support"
> >> > ÂMay someone helps me?
> >> >
> >> > Thanks in advance and regards
> >> >
> >> >
> >> > --
> >> > ==============================================
> >> > Manuel Antonio Regueiro Seoane
> >> > Laboratorio de Sistemas
> >> > Instituto de InvestigaciÃns TecnolÃxicas - IIT
> >> > Universidade de Santiago de Compostela - USC
> >>
> >>
> >> Ticket Details
> >> ===================
> >> Ticket ID: ANB-661794
> >> Department: Support netCDF Java
> >> Priority: Normal
> >> Status: Closed
> >>
> >>
> >
> >
> > --
> > ==============================================
> > Manuel Antonio Regueiro Seoane
> > Laboratorio de Sistemas
> > Instituto de InvestigaciÃns TecnolÃxicas - IIT
> > Universidade de Santiago de Compostela - USC
> > Tlf. 8818-16000 -- Correo-e: address@hidden
> >
> >
> >
> >
> 
> 
> --
> ==============================================
> Manuel Antonio Regueiro Seoane
> Laboratorio de Sistemas
> Instituto de InvestigaciÃns TecnolÃxicas - IIT
> Universidade de Santiago de Compostela - USC
> Tlf. 8818-16000 -- Correo-e: address@hidden
> 
> 


Ticket Details
===================
Ticket ID: ANB-661794
Department: Support netCDF Java
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.