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.
Hi Luis, Is the end goal to get a NetcdfDataset object with only the desired variables? Or is the end goal to get a netCDF file? If the former, the netCDF-Java library doesn't include a utility for subsetting an entire NetcdfFile or NetcdfDataset. Of course, it can be used to write such a utility. Which is, I'm guessing, what you are asking about. So, for that, your best bet is probably to ask the netCDF-Java user community directly at address@hidden. [This email came in to address@hidden.] If the latter, there are a few options. For regular grids, you could look at the NetCDF Subset Service (NCSS) part of the TDS but it looks like this might be an unstructured grid? Another option would be to look at NCO (netCDF Operators), http://nco.sourceforge.net/. I don't know NCO well but I know it has some very useful operators Hope that helps, Ethan > I want to use the JAVA library to create a NetcdfDataset form a dods > URL. For example: > > http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_GOM2_FORECAST.nc.dods?lon[26559],lat[26559],Times[0:1:72],zeta[0:1:72][26559] > > I just lean that is not possible to use such URL directly with the > java library, but that you have to open the dataset > > NetcdfDataset.openDataset(" > http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_GOM2_FORECAST.nc") > > and then read each variable. > > So has anyone created java code that reads a dods url, extracts the > URL without the query part and extracts the variables ( maybe using > regular expression) and creates the java object ? > > thanks, > > -luis > > > -- > Luis Bermudez Ph.D. > Coastal Research Technical Manager > Southeastern Universities Research Association (SURA) Ticket Details =================== Ticket ID: APN-311841 Department: Support netCDF Java Priority: Normal Status: Closed