當前位置: 首頁>>代碼示例>>Golang>>正文


Golang lib.Nc類代碼示例

本文整理匯總了Golang中github.com/SNguyen29/Oceano2oceansitesTest/lib.Nc的典型用法代碼示例。如果您正苦於以下問題:Golang Nc類的具體用法?Golang Nc怎麽用?Golang Nc使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Nc類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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.Extras_s = make(map[string]string)
	ncTest.Extras_f = make(map[string]float64)
	ncTest.Variables_1D = make(map[string]interface{})
	ncTest.Variables_1D["TIME"] = []float64{}
	ncTest.Variables_1D["LATITUDE"] = []float64{}
	ncTest.Variables_1D["LONGITUDE"] = []float64{}
	ncTest.Variables_1D["PROFILE"] = []float64{}

	profile := GetProfileNumber(&ncTest, 0)

	TestFile := []string{"../data/20150718-114047-AT_COLCOR.COLCOR"}

	secondPassTHERMO(&ncTest, &m, cfg, TestFile, optDebug)

	fmt.Println("Time start :", ncTest.Extras_s[fmt.Sprintf("Starttime:%d", int(profile))])
	fmt.Println("Latitude start :", ncTest.Extras_s[fmt.Sprintf("Startlatpos:%d", int(profile))])
	fmt.Println("Longitude start :", ncTest.Extras_s[fmt.Sprintf("Startlongpos:%d", int(profile))])

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:30,代碼來源:GrammTHERMO_test.go

示例2: 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.Extras_s = make(map[string]string)
	ncTest.Extras_f = make(map[string]float64)
	ncTest.Variables_1D = make(map[string]interface{})
	ncTest.Variables_1D["TIME"] = []float64{}
	ncTest.Variables_1D["LATITUDE"] = []float64{}
	ncTest.Variables_1D["LONGITUDE"] = []float64{}
	ncTest.Variables_1D["PROFILE"] = []float64{}

	TestFile := []string{"../data/csp00201.lad"}

	secondPassLADCP(&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"])

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:28,代碼來源:GrammLADCP_test.go

示例3: TestGetProfile

//function for testing GetProfileNumber
func TestGetProfile(t *testing.T) {
	// variable for test

	var ncTest lib.Nc

	ncTest.Extras_s = make(map[string]string)

	Profile := GetProfileNumber(&ncTest, 1)
	fmt.Println("Profile THERMO Number : ", Profile)

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:12,代碼來源:GetProfileNumber_test.go

示例4: ReadSeabird

// read cnv files in two pass, the first to get dimensions
// second to get data
func ReadSeabird(nc *lib.Nc, m *config.Map, filestruct analyze.Structfile, cfg toml.Configtoml, files []string, optCfgfile string, optAll *bool, optDebug *bool, prefixAll string) {

	switch {
	case filestruct.Instrument == cfg.Instrument.Type[0]:

		config.GetConfigCTD(nc, m, cfg, optCfgfile, filestruct.TypeInstrument, optAll)

		// first pass, return dimensions fron cnv files
		nc.Dimensions["TIME"], nc.Dimensions["DEPTH"] = firstPassCTD(nc, m, cfg, files)

		// initialize 2D data
		nc.Variables_2D = make(lib.AllData_2D)
		for i, _ := range m.Map_var {
			nc.Variables_2D.NewData_2D(i, nc.Dimensions["TIME"], nc.Dimensions["DEPTH"])
		}

		// second pass, read files again, extract data and fill slices
		secondPassCTD(nc, m, cfg, files, optDebug)
		// write ASCII file
		WriteAscii(nc, cfg, m.Map_format, m.Hdr, filestruct.Instrument, prefixAll)

		// write netcdf file
		//if err := nc.WriteNetcdf(); err != nil {
		//log.Fatal(err)
		//}
		netcdf.WriteNetcdf(nc, m, cfg, filestruct.Instrument, prefixAll)

	case filestruct.Instrument == cfg.Instrument.Type[1]:

		config.GetConfigBTL(nc, m, cfg, optCfgfile, filestruct.TypeInstrument)
		// first pass, return dimensions fron btl files
		nc.Dimensions["TIME"], nc.Dimensions["DEPTH"] = firstPassBTL(nc, m, cfg, files)

		// initialize 2D data
		nc.Variables_2D = make(lib.AllData_2D)
		for i, _ := range m.Map_var {
			nc.Variables_2D.NewData_2D(i, nc.Dimensions["TIME"], nc.Dimensions["DEPTH"])
		}

		// second pass, read files again, extract data and fill slices
		secondPassBTL(nc, m, cfg, files, optDebug)
		// write ASCII file
		WriteAscii(nc, cfg, m.Map_format, m.Hdr, filestruct.Instrument, prefixAll)

		// write netcdf file
		//if err := nc.WriteNetcdf(); err != nil {
		//log.Fatal(err)
		//}
		netcdf.WriteNetcdf(nc, m, cfg, filestruct.Instrument, prefixAll)
	}
}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:53,代碼來源:Read.go

示例5: TestFirstPass

func TestFirstPass(t *testing.T) {

	var ncTest lib.Nc
	var m config.Map
	var cfg toml.Configtoml
	filetoml := "../configfile/configtoml.toml"
	cfg = toml.InitToml(filetoml)

	m = config.InitMap()

	ncTest.Extras_s = make(map[string]string)
	ncTest.Extras_f = make(map[string]float64)

	TestFile := []string{"../data/csp00201.lad"}

	time, depth := firstPassLADCP(&ncTest, &m, cfg, TestFile)

	fmt.Println("Time : ", time)
	fmt.Println("Depth : ", depth)

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:21,代碼來源:GrammLADCP_test.go

示例6: TestFirstPass

func TestFirstPass(t *testing.T) {

	var ncTest lib.Nc
	var m config.Map
	var cfg toml.Configtoml
	filetoml := "../configfile/configtoml.toml"
	cfg = toml.InitToml(filetoml)

	m = config.InitMap()

	ncTest.Extras_s = make(map[string]string)
	ncTest.Extras_f = make(map[string]float64)

	TestFile := []string{"../data/20150718-114047-AT_COLCOR.COLCOR"}

	time, depth := firstPassTHERMO(&ncTest, &m, cfg, TestFile)

	fmt.Println("Time : ", time)
	fmt.Println("Depth : ", depth)

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:21,代碼來源:GrammTHERMO_test.go

示例7: 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"])

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:34,代碼來源:GrammBTL_test.go

示例8: TestDecodeData

//function for testing Decodedata
func TestDecodeData(t *testing.T) {
	// variable for test

	var ncTest lib.Nc
	var m config.Map

	m = config.InitMap()

	ncTest.Extras_s = make(map[string]string)

	fmt.Println("Debut fichier THERMO :")

	TestFile := "../data/FileTestDecodeData5.TEST"

	var profileTest float64 = 1

	var line int = 0

	fid, err := os.Open(TestFile)
	if err != nil {
		log.Fatal(err)
	}
	defer fid.Close()

	scanner := bufio.NewScanner(fid)
	for scanner.Scan() {
		str := scanner.Text()
		DecodeData(&ncTest, &m, str, profileTest, TestFile, line)
		line++
	}
	if err := scanner.Err(); err != nil {
		log.Fatal(err)
	}
	fmt.Println("Number of line : ", line)

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:37,代碼來源:DecodeData_test.go

示例9: 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)

}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:45,代碼來源:DecodeHeader_test.go

示例10: 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")
	}
}
開發者ID:SNguyen29,項目名稱:Oceano2oceansitesTest,代碼行數:64,代碼來源:ConfigXBT.go


注:本文中的github.com/SNguyen29/Oceano2oceansitesTest/lib.Nc類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。