Created
October 21, 2021 14:29
-
-
Save ringsaturn/a05ae88409ef29fea7a814a42f81eb31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/fhs/go-netcdf/netcdf" | |
) | |
const NC_PATH = "XXX.nc" | |
func main() { | |
ds, err := netcdf.OpenFile(NC_PATH, netcdf.NOWRITE) | |
if err != nil { | |
panic(err) | |
} | |
defer ds.Close() | |
varCount, err := ds.NVars() | |
if err != nil { | |
panic(err) | |
} | |
for i := 0; i < varCount; i++ { | |
ncVar := ds.VarN(i) | |
name, err := ncVar.Name() | |
if err != nil { | |
log.Panicln(i, varCount, ncVar, err) | |
} | |
log.Println(name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment