Codota Logo
NetcdfFile.getGlobalAttributes
Code IndexAdd Codota to your IDE (free)

How to use
getGlobalAttributes
method
in
ucar.nc2.NetcdfFile

Best Java code snippets using ucar.nc2.NetcdfFile.getGlobalAttributes (Showing top 20 results out of 315)

  • Common ways to obtain NetcdfFile
private void myMethod () {
NetcdfFile n =
  • Codota IconString location;NetcdfFile.open(location)
  • Codota IconString location;NetcdfDataset.openFile(location, null)
  • Codota IconFile file;NetcdfFile.open(file.getPath())
  • Smart code suggestions by Codota
}
origin: apache/sis

/**
 * Returns the names of all global attributes found in the file.
 *
 * @return names of all global attributes in the file.
 */
@Override
public Collection<String> getAttributeNames() {
  return VariableWrapper.toNames(file.getGlobalAttributes());
}
origin: apache/tika

for (Attribute attr : ncFile.getGlobalAttributes()) {
  Property property = resolveMetadataKey(attr.getFullName());
  if (attr.getDataType().isString()) {
origin: org.apache.sis.storage/sis-netcdf

/**
 * Returns the names of all global attributes found in the file.
 *
 * @return names of all global attributes in the file.
 */
@Override
public Collection<String> getAttributeNames() {
  return VariableWrapper.toNames(file.getGlobalAttributes());
}
origin: bcdev/beam

public SeadasFileReader(SeadasProductReader productReader) {
  this.productReader = productReader;
  ncFile = productReader.getNcfile();
  globalAttributes = ncFile.getGlobalAttributes();
}
origin: senbox-org/s1tbx

public static NcAttributeMap create(NetcdfFile file) {
  return new NcAttributeMap(file.getGlobalAttributes());
}
origin: bcdev/beam

private static Map<String, String> readGlobalAttributes(NetcdfFile ncFile) {
  List<Attribute> globalNcAttributes = ncFile.getGlobalAttributes();
  Map<String, String> globalAttributes = new TreeMap<String, String>();
  for (Attribute attribute : globalNcAttributes) {
    globalAttributes.put(attribute.getShortName().trim(), attribute.getStringValue().trim());
  }
  return globalAttributes;
}
origin: apache/tika

metadata.set("File-Type-Description", ncFile.getFileTypeDescription());
for (Attribute attr : ncFile.getGlobalAttributes()) {
  Property property = resolveMetadataKey(attr.getFullName());
  if (attr.getDataType().isString()) {
origin: uk.ac.ebi.pride.utilities/netCDF-parser

  /**
   * Returns all the metadata related with the experiments as key-value pairs.
   *
   * @return
   */
  public Metadata getMetadata(){

    HashMap<String, String> globalAttr = new HashMap<String, String>();
    for (Attribute attr: inputFile.getGlobalAttributes())
      globalAttr.put(attr.getFullName(), attr.getStringValue());

    return new Metadata(globalAttr);
  }
}
origin: bcdev/beam

private String getCollectionShortName() throws ProductIOException {
  List<Attribute> gattr = ncFile.getGlobalAttributes();
  for (Attribute attr : gattr) {
    if (attr.getShortName().endsWith("Collection_Short_Name")) {
      return attr.getStringValue();
    }
  }
  throw new ProductIOException("Cannot find collection short name");
}
origin: ch.unibas.cs.gravis/scalismo-native-stub

public List getMetadata() throws Exception {
  if (!isRoot()) {
    return null;
  }
  if (attributeList != null) {
    return attributeList;
  }
  NC2File theFile = (NC2File) getFileFormat();
  NetcdfFile ncFile = theFile.getNetcdfFile();
  List netcdfAttributeList = ncFile.getGlobalAttributes();
  if (netcdfAttributeList == null) {
    return null;
  }
  int n = netcdfAttributeList.size();
  attributeList = new Vector(n);
  ucar.nc2.Attribute netcdfAttr = null;
  for (int i = 0; i < n; i++) {
    netcdfAttr = (ucar.nc2.Attribute) netcdfAttributeList.get(i);
    attributeList.add(NC2File.convertAttribute(netcdfAttr));
  }
  return attributeList;
}
origin: edu.ucar/netcdf

public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException {
 //String fileIn = "/home/yuanho/dev/netcdf-java-2.2/src/ucar/nc2/n0r_20040823_2215";    // uncompressed
 String fileIn = "c:/data/image/gini/n0r_20041013_1852";
 ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.gini.Giniiosp.class);
 ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn);
 List alist = ncf.getGlobalAttributes();
 ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity");
 int[] origin = {0, 0};
 int[] shape = {3000, 4736};
 ArrayByte data = (ArrayByte) v.read(origin, shape);
 ncf.close();
}
origin: bcdev/beam

public static void readNetcdfMetadata(NetcdfFile netcdfFile, MetadataElement root, int maxNumValuesRead) {
  root.addElement(readAttributeList(netcdfFile.getGlobalAttributes(), GLOBAL_ATTRIBUTES));
  root.addElement(readVariableDescriptions(netcdfFile.getVariables(), VARIABLE_ATTRIBUTES, maxNumValuesRead));
}
origin: senbox-org/s1tbx

private void addMetadataToProduct() throws IOException {
  try {
    final MetadataElement origMetadataRoot = AbstractMetadata.addOriginalProductMetadata(product.getMetadataRoot());
    NetCDFUtils.addAttributes(origMetadataRoot, NetcdfConstants.GLOBAL_ATTRIBUTES_NAME,
                 netcdfFile.getGlobalAttributes());
    addAuxXML(product);
    for (final Variable variable : variableMap.getAll()) {
      NetCDFUtils.addAttributes(origMetadataRoot, variable.getShortName(), variable.getAttributes());
    }
    //final Group rootGroup = netcdfFile.getRootGroup();
    //NetCDFUtils.addGroups(product.getMetadataRoot(), rootGroup);
    addAbstractedMetadataHeader(product, product.getMetadataRoot());
  } catch (Exception e) {
    SystemUtils.LOG.severe("Error reading metadata for " + product.getName() + ": " + e.getMessage());
  }
}
origin: bcdev/beam

@Override
public void decode(ProfileReadContext ctx, Product p) throws IOException {
  GeoCoding geoCoding = readConventionBasedMapGeoCoding(ctx, p);
  if (geoCoding == null) {
    geoCoding = readPixelGeoCoding(p);
  }
  // If there is still no geocoding, check special case of netcdf file which was converted
  // from hdf file and has 'StructMetadata.n' element.
  // In this case, the HDF 'elements' were put into a single Netcdf String attribute
  // todo: in fact this has been checked only for MODIS09 HDF-EOS product. Try to further generalize
  if (geoCoding == null && hasHdfMetadataOrigin(ctx.getNetcdfFile().getGlobalAttributes())) {
    hdfDecode(ctx, p);
  }
  if (geoCoding != null) {
    p.setGeoCoding(geoCoding);
  }
}
origin: Unidata/thredds

 @Test
 @Category(NeedsCdmUnitTest.class)
 public void testResolver() throws IOException {

  String remoteDataset = TestOnLocalServer.withProtocolAndPath(
      "thredds:resolve:http", "catalog/gribCollection/GFS_CONUS_80km/latest.xml");

  try (NetcdfFile ncd = NetcdfDataset.openFile(remoteDataset, null)) {
   List<Attribute> globalAttrs = ncd.getGlobalAttributes();
   String testMessage = "";

   for (Attribute attr : globalAttrs) {
    testMessage = testMessage + "\n" + attr;
   }

   logger.debug(testMessage);
  }
 }
}
origin: bcdev/beam

private void readGlobalMetaData(File inFile) throws IOException {
  netCDFAttributes = new NetCDFAttributes();
  netCDFAttributes.add(netcdfFile.getGlobalAttributes());
  netCDFVariables = new NetCDFVariables();
  netCDFVariables.add(netcdfFile.getVariables());
  // check wheter daac or imapp
  if (isImappFormat()) {
    globalAttributes = new ImappAttributes(inFile, netCDFVariables, netCDFAttributes);
  } else {
    globalAttributes = new DaacAttributes(netCDFVariables);
  }
}
origin: bcdev/beam

private void hdfDecode(ProfileReadContext ctx, Product p) throws IOException {
  final CfHdfEosGeoInfoExtractor cfHdfEosGeoInfoExtractor = new CfHdfEosGeoInfoExtractor(
      ctx.getNetcdfFile().getGlobalAttributes());
  cfHdfEosGeoInfoExtractor.extractInfo();
  String projection = cfHdfEosGeoInfoExtractor.getProjection();
  double upperLeftLon = cfHdfEosGeoInfoExtractor.getUlLon();
  double upperLeftLat = cfHdfEosGeoInfoExtractor.getUlLat();
  double lowerRightLon = cfHdfEosGeoInfoExtractor.getLrLon();
  double lowerRightLat = cfHdfEosGeoInfoExtractor.getLrLat();
  HdfEosGeocodingPart.attachGeoCoding(p, upperLeftLon, upperLeftLat, lowerRightLon, lowerRightLat, projection, null);
}
origin: edu.ucar/netcdf

int sizeHeader(boolean largeFile) {
 int size = 4; // magic number
 size += 4; // numrecs
 // dims
 size += 8; // magic, ndims
 for (Dimension dim  : ncfile.getDimensions())
  size += sizeString(dim.getShortName()) + 4; // name, len
 // global attributes
 size += sizeAtts(ncfile.getGlobalAttributes());
 // variables
 size += 8; // magic, nvars
 for (Variable var : ncfile.getVariables()) {
  size += sizeString(var.getShortName());
  // dimensions
  size += 4; // ndims
  size += 4 * var.getDimensions().size(); // dim id
  // variable attributes
  size += sizeAtts(var.getAttributes());
  size += 8; // data type, variable size
  size += (largeFile) ? 8 : 4;
 }
 return size;
}
origin: senbox-org/s1tbx

private void addMetadataToProduct() throws IOException {
  final MetadataElement origMetadataRoot = AbstractMetadata.addOriginalProductMetadata(product.getMetadataRoot());
  NetCDFUtils.addAttributes(origMetadataRoot, NetcdfConstants.GLOBAL_ATTRIBUTES_NAME,
      netcdfFile.getGlobalAttributes());
  addDeliveryNote(product);
  for (final Variable variable : variableMap.getAll()) {
    NetCDFUtils.addAttributes(origMetadataRoot, variable.getShortName(), variable.getAttributes());
  }
  //final Group rootGroup = netcdfFile.getRootGroup();
  //NetCDFUtils.addGroups(product.getMetadataRoot(), rootGroup);
  addAbstractedMetadataHeader(product, product.getMetadataRoot());
}
origin: bcdev/beam

@Override
public void decode(ProfileReadContext ctx, Product p) throws IOException {
  NetcdfFile ncFile = ctx.getNetcdfFile();
  MetadataElement root = p.getMetadataRoot();
  root.addElement(MetadataUtils.readAttributeList(ncFile.getGlobalAttributes(), "MPH"));
  MetadataElement eosElem = new MetadataElement("EOS");
  createMDE(HdfEosUtils.STRUCT_METADATA, ctx, eosElem);
  createMDE(HdfEosUtils.CORE_METADATA, ctx, eosElem);
  createMDE(HdfEosUtils.ARCHIVE_METADATA, ctx, eosElem);
  root.addElement(eosElem);
  List<Variable> ncVariables = ncFile.getVariables();
  filterVariableList(ncVariables);
  root.addElement(MetadataUtils.readVariableDescriptions(ncVariables, "DSD"));
}
ucar.nc2NetcdfFilegetGlobalAttributes

Javadoc

Returns the set of global attributes associated with this file. This is part of "version 3 compatibility" interface. Alternatively, use groups.

Popular methods of NetcdfFile

  • close
    Close all resources (files, sockets, etc) associated with this file. If the underlying file was acqu
  • findVariable
  • open
  • getRootGroup
    Get the root group.
  • getVariables
    Get all of the variables in the file, in all groups. This is part of "version 3 compatibility" inter
  • getLocation
    Get the NetcdfFile location. This is a URL, or a file pathname.
  • openInMemory
    Read a remote CDM file into memory. All reads are then done from memory.
  • getDimensions
    Get the shared Dimensions used in this file. This is part of "version 3 compatibility" interface. If
  • findGlobalAttribute
    Look up global Attribute by (full) name.
  • addVariable
    Add a Variable to the given group.
  • findDimension
    Retrieve a dimension by fullName.
  • addAttribute
    Add an attribute to a group.
  • findDimension,
  • addAttribute,
  • finish,
  • addDimension,
  • findAttValueIgnoreCase,
  • findGlobalAttributeIgnoreCase,
  • sendIospMessage,
  • findGroup,
  • getIosp

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Reference (javax.naming)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now