本文整理汇总了Golang中github.com/SNguyen29/Oceano2oceansitesTest/lib.Nc.Attributes方法的典型用法代码示例。如果您正苦于以下问题:Golang Nc.Attributes方法的具体用法?Golang Nc.Attributes怎么用?Golang Nc.Attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/SNguyen29/Oceano2oceansitesTest/lib.Nc
的用法示例。
在下文中一共展示了Nc.Attributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestSecondPass
func TestSecondPass(t *testing.T) {
var ncTest lib.Nc
var m config.Map
var cfg toml.Configtoml
var optDebug *bool
filetoml := "../configfile/configtoml.toml"
cfg = toml.InitToml(filetoml)
m = config.InitMap()
ncTest.Dimensions = make(map[string]int)
ncTest.Attributes = make(map[string]string)
ncTest.Extras_f = make(map[string]float64)
ncTest.Extras_s = make(map[string]string)
ncTest.Variables_1D = make(map[string]interface{})
// initialize map entry from nil interface to empty slice of float64
ncTest.Variables_1D["PROFILE"] = []float64{}
ncTest.Variables_1D["TIME"] = []float64{}
ncTest.Variables_1D["LATITUDE"] = []float64{}
ncTest.Variables_1D["LONGITUDE"] = []float64{}
ncTest.Variables_1D["BATH"] = []float64{}
ncTest.Variables_1D["TYPECAST"] = []float64{}
TestFile := []string{"../data/csp00101.btl"}
secondPassBTL(&ncTest, &m, cfg, TestFile, optDebug)
fmt.Println("Time :", ncTest.Variables_1D["TIME"])
fmt.Println("Latitude :", ncTest.Variables_1D["LATITUDE"])
fmt.Println("Longitude :", ncTest.Variables_1D["LONGITUDE"])
}
示例2: TestDecodeHeader
func TestDecodeHeader(t *testing.T) {
// variable for test
var cfg toml.Configtoml
var fileconfig string
var ncTest lib.Nc
var optDebug *bool
fileconfigTest := "../configfile/configtoml.toml"
cfg = toml.InitToml(fileconfigTest)
fmt.Println("fileconfig ", fileconfig)
ncTest.Dimensions = make(map[string]int)
ncTest.Attributes = make(map[string]string)
ncTest.Extras_f = make(map[string]float64)
ncTest.Extras_s = make(map[string]string)
ncTest.Variables_1D = make(map[string]interface{})
// initialize map entry from nil interface to empty slice of float64
ncTest.Variables_1D["TIME"] = []float64{}
ncTest.Variables_1D["LATITUDE"] = []float64{}
ncTest.Variables_1D["LONGITUDE"] = []float64{}
var profileTest float64 = 00001
//var StringTest string = "Date = 2015/07/24"
//var StringTest string = "Start_Time = 06:11:23"
//var StringTest string = "Latitude = -10.9877"
var StringTest string = "Longitude : 24 12.78809W"
temp := regexp.MustCompile(cfg.Mk21.Longitude)
fmt.Println(cfg.Mk21.Longitude)
fmt.Println(StringTest)
if temp.MatchString(StringTest) {
fmt.Println("same")
} else {
fmt.Println("not same")
}
DecodeHeader(&ncTest, cfg, StringTest, profileTest, optDebug)
}
示例3: GetConfigXBT
func GetConfigXBT(nc *lib.Nc, m *Map, cfg toml.Configtoml, configFile string, Type string, optAll *bool) {
// var split, header, format string
var split []string
// define map from netcdf structure
nc.Dimensions = make(map[string]int)
nc.Attributes = make(map[string]string)
nc.Extras_f = make(map[string]float64)
nc.Extras_s = make(map[string]string)
nc.Variables_1D = make(map[string]interface{})
// initialize map entry from nil interface to empty slice of float64
nc.Variables_1D["PROFILE"] = []float64{}
nc.Variables_1D["TIME"] = []float64{}
nc.Variables_1D["LATITUDE"] = []float64{}
nc.Variables_1D["LONGITUDE"] = []float64{}
nc.Variables_1D["TYPECAST"] = []float64{}
nc.Roscop = roscop.NewRoscop(cfg.Roscopfile)
// add some global attributes for profile, change in future
nc.Attributes["data_type"] = Type
split = cfg.Xbt.Split
// stationPrefixLength = cfg.Ctd.StationPrefixLength
// TODOS: complete
nc.Attributes["cycle_mesure"] = cfg.Cruise.CycleMesure
nc.Attributes["plateforme"] = cfg.Cruise.Plateforme
nc.Attributes["institute"] = cfg.Cruise.Institute
nc.Attributes["pi"] = cfg.Cruise.Pi
nc.Attributes["timezone"] = cfg.Cruise.Timezone
nc.Attributes["begin_date"] = cfg.Cruise.BeginDate
nc.Attributes["end_date"] = cfg.Cruise.EndDate
nc.Attributes["creator"] = cfg.Cruise.Creator
nc.Attributes["type_instrument"] = cfg.Xbt.TypeInstrument
nc.Attributes["instrument_number"] = cfg.Xbt.InstrumentNumber
// add specific column(s) to the first header line in ascii file
// First column should be PRFL
m.Hdr = append(m.Hdr, "PRFL")
// fill map_var from split (read in .ini configuration file)
// store the position (column) of each physical parameter
var fields []string
fields = split
fmt.Fprintln(lib.Debug, "getConfig: ", fields)
// construct header slice from split
for i := 0; i < len(fields); i += 2 {
if v, err := strconv.Atoi(fields[i+1]); err == nil {
m.Map_var[fields[i]] = v - 1
m.Hdr = append(m.Hdr, fields[i])
}
}
fmt.Fprintln(lib.Debug, "getConfig: ", m.Hdr)
// fill map_format from code_roscop
for _, key := range m.Hdr {
m.Map_format[key] = nc.Roscop.GetAttributesM(key, "format")
}
}