Re: [netcdf-java] NetCDF CDM Station question


Hi John,

Yes we are working with Rich Signell.

For this project we will be working against a large number of ThreDDS based 
NetCDF sources.  For this particular case we were hoping to implement a 
generalized solution to provide a user with a drop down list of range variables 
for a given FeatureDatasource (currently of FeatureType.GRID or 
FeatureType.STATION).  This list would have all the domain variables removed.

With the source at 
http://motherlode.ucar.edu:8080/thredds/dodsC/station/metar/Surface_METAR_20100114_0000.nc
 the domain variables are prefixed with 'station.' while the range variables 
are prefixed with 'record.'.  Is this a convention that we could use to strip 
out domain variables?


Thanks,

Tom.


On Jan 14, 2010, at 1:52 PM, John Caron wrote:

> Hi Tom:
> 
> Tom Kunicki wrote:
>> Hello,
>> 
>> We're just delving into NetCDF Java (4.1) for a project.  
>> Right now I am having trouble pulling out the range variables using 
>> FeatureDataset. getDataVariables().  In the code sample below the function 
>> works as expected for the GRID data.  For the STATION data we are getting 
>> domain variable names (station.latitude, station.longitude, 
>> station.altitude, etc).   I'm new to NetCDF so please understand that I may 
>> be making some silly assumptions...
>>  
> Some people want the coordinates in the list of data variables, so we havent 
> tried to hard to remove them. You may want to process that list for your own 
> needs. What problem are you trying to solve?
>> Is the issue that the GRID data is CDM compliant while the STAION data is 
>> not?  
> no, thats not the issue
> 
>> If so, does anyone have a source of CDM compliant station observation data I 
>> could pull against?  I did use the CDM validator against the STATION data 
>> but didn't quite understand the output (was hoping for red/green!)
>>  
> I gave some to Rich Signell yesterday. Are you in the group he's working with?
>> Thanks,
>> 
>> Tom
>> 
>> +++ START CODE +++
>> package gov.usgs.cida.netcdf;
>> 
>> import java.io.IOException;
>> import java.util.ArrayList;
>> import java.util.Formatter;
>> import java.util.List;
>> import ucar.nc2.VariableSimpleIF;
>> import ucar.nc2.ft.FeatureDataset;
>> import ucar.nc2.ft.FeatureDatasetFactoryManager;
>> 
>> /**
>> *
>> * @author tkunicki
>> */
>> public class VariableNameTest {
>> 
>>    public static List<String> getDataVariableNames(String location) throws 
>> IOException {
>> 
>>        if(location == null) {
>>            throw new IllegalArgumentException("location can't be null");
>>        }
>>        Formatter errorFormatter = new Formatter();
>>        FeatureDataset dataset = FeatureDatasetFactoryManager.open(
>>                null, location, null, errorFormatter);
>> 
>>        List<String> variableNames = new ArrayList<String>();
>>        for (VariableSimpleIF variable : dataset.getDataVariables()) {
>>            variableNames.add(variable.getName());
>>        }
>>        return variableNames;
>>    }
>> 
>>    public static void main(String[] args) {
>>        try {
>>            List<String> list = null;
>>            // Grid Data
>>            System.out.println("Example Grid");
>>            list = 
>> getDataVariableNames("http://motherlode.ucar.edu:8080/thredds/dodsC/fmrc/NCEP/GFS/Hawaii_160km/NCEP-GFS-Hawaii_160km_fmrc.ncd";);
>>            for(String name : list) {
>>                System.out.println("  " + name);
>>            }
>>            // Point/Station data
>>            System.out.println("Example Station");
>>            list = getDataVariableNames(
>>                    
>> "http://motherlode.ucar.edu:8080/thredds/dodsC/station/metar/Surface_METAR_20100114_0000.nc";);
>>            for(String name : list) {
>>                System.out.println("  " + name);
>>            }
>>        } catch (IOException e) {
>>            // don't care...
>>        }
>>    }
>> }
>> +++ START CODE +++
>> 
>> 
>> Tom Kunicki
>> Center for Integrated Data Analytics
>> U.S. Geological Survey
>> 8505 Research Way
>> Middleton, WI  53562
>> 
>> 
>> 
>> 
>>  
> 



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: