-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISO xml without THREDDs #58
Comments
While waiting for an answer from THREDDs experts, just note that it is possible to do that with a combination of Unidata UCAR library + Apache SIS (Java code) as a fallback. I will let experts said if there is a pure THREDDs solution (it would guarantee to provide the exact same metadata), if not I can provide more details. |
Thank you @desruisseaux, could you please expand on that a bit? Ideally, I would like to generate ISO xml metadata from the netCDF files without having to move them to a THREDDs server. |
@theobarnhart-USGS There is a standalone version here. |
There is an option to the ncdump program in the netcdf-c library.
It is seriously out-of-date and would presumably need extension to whatever features of netcdf-4 that you use. |
Thanks @DennisHeimbigner , I've used that and successfully produced a ncml file; however, I have not been able to successfully validate that file against ISO 19115. I could be very wrong, but I think ncml is different from ISO xml metadata. |
@zdefne-usgs Thanks, I saw that; however, it only functions if the data are on a THREDDs server, which I do not have. |
How close is ISO metadata XML elements to ncml? |
Have you tried pointing to a local folder instead of a URL? You can download the JAR file here.
|
I have not tried that yet but I can next week. My understanding is that the ncISO tool needs the THREDDs server to fill in some of the ISO metadata that is not captured in the ncml. NOAA-PMEL/uafnciso#20 |
I seem to recall some discussion of a stand-alone, command line tool for some aspect of ncISO but not sure about the details. Perhaps @noaaroland or @kevin-obrien have some thoughts on this. |
You can transform the ncml to iso using xslt, this is a significant
component of what nciso does...
The xslt that is used is available in the repo here:
https://github.com/Unidata/threddsIso/blob/main/nciso-common/src/main/resources/xsl/nciso/UnidataDD2MI.xsl
Hth,
Dave
…On Fri, Nov 5, 2021 at 1:58 PM Theo Barnhart ***@***.***> wrote:
Thanks @DennisHeimbigner <https://github.com/DennisHeimbigner> , I've
used that and successfully produced a ncml file; however, I have not been
able to successfully validate that file against ISO 19115. I could be very
wrong, but I think ncml is different from ISO xml metadata.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#58 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZBJXLEBQA44QY6YXIRU7TUKRAQHANCNFSM5HOGEL5Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hello @theobarnhart-USGS You can use the following. It uses the UCAR library for opening netCDF and ncml files and querying their attributes. Then those information are assembled in Java objects and marshalled by Apache SIS. You can create a Maven project with the following dependencies: <project>
<!-- Standard Maven verbiage omitted on this line for brevity -->
<dependencies>
<dependency>
<groupId>org.apache.sis.storage</groupId>
<artifactId>sis-netcdf</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>cdm-core</artifactId>
<version>5.4.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>UCAR</id>
<name>UCAR repository</name>
<url>https://artifacts.unidata.ucar.edu/repository/unidata-releases</url>
</repository>
</repositories>
</project> And following Java code (replace import java.io.File;
import java.util.Map;
import javax.xml.transform.stream.StreamResult;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStores;
import org.apache.sis.xml.XML;
import org.opengis.metadata.Metadata;
public class Test {
public static void main(String[] args) throws Exception {
try (DataStore ds = DataStores.open(new File("GEBCO_2020.nc"))) {
Metadata md = ds.getMetadata();
// Quick look
System.out.println(md);
// ISO 19115-3 by default
String xml = XML.marshal(md);
System.out.println(xml);
// ISO 19139:2007 (not nicely formatted)
XML.marshal(md, new StreamResult(System.out), Map.of(XML.METADATA_VERSION, "2007"));
}
}
} It works for GeoTIFF as well (with some more modules added in Maven dependencies). It is possible to query and modify the metadata in Java code if desired. Read-only example (writing is possible but require an extra-step): Identification info = md.getIdentificationInfo().iterator().next();
Citation citation = info.getCitation();
InternationalString title = citation.getTitle();
System.out.println(title); |
Is there a way to generate an ISO metadata xml file from a ncml and/or a netCDF file without access to a THREDDs server? For example, I have several hundred CF-compliant netCDF files on a HPC that I would like to publish, but the repository requires an ISO metadata file for each file.
Thank you!
The text was updated successfully, but these errors were encountered: