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

[netCDFJava #BDR-563250]: Issue reading/writing with OPENDAP

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [netCDFJava #BDR-563250]: Issue reading/writing with OPENDAP
  • Date: Mon, 11 May 2015 15:34:40 -0600

Ann,

Thanks for the detailed bug report. In order to read the dataset using opendap 
support within NetcdfDataset, the URL needs to end with '.dods'. So in your 
case, the URL should be:

String 
inputfile="http://convection.meas.ncsu.edu:8080/thredds/dodsC/prism/daily/tmin/PRISM_tmin_stable_4kmD1_20110515.nc.dods";;

(This is the same URL as the "Get Binary" button on the Opendap HTML page.)

Using this new URL, I'm able to download the data. Let me know if that's not 
the case for you.

Ryan

> Hi,
> 
> I have an issue trying to read and write data to netcdf using OPENDAP.
> I am not sure if the issue is at the server or in my code. If I save the
> "PRISM.....nc" in my local system and then use openFile(). The program
> runs fine.
> 
> If I try to read the data using OPENDAP url and openFile(), I get
> the error:
> 
> Exception in thread "main" java.lang.ClassCastException: ucar.nc2.dods.DodsV 
> cannot be cast to ucar.nc2.iosp.netcdf3.N3header$Vinfo
> at ucar.nc2.iosp.netcdf3.N3iosp.writeData(N3iosp.java:695)
> at ucar.nc2.NetcdfFileWriter.write(NetcdfFileWriter.java:931)
> at testzone.Opendapexample.main(Opendapexample.java:66)
> 
> If I try to read the data using OPENDAP url and openDataset, I get the error:
> Exception in thread "main" java.lang.NullPointerException
> at ucar.nc2.iosp.netcdf3.N3iosp.writeData(N3iosp.java:717)
> at ucar.nc2.NetcdfFileWriter.write(NetcdfFileWriter.java:931)
<SNIP>
> 
> Ann


Ticket Details
===================
Ticket ID: BDR-563250
Department: Support netCDF Java
Priority: Normal
Status: Closed