コード例 #1
0
ファイル: NcGroup.cs プロジェクト: maka-io/netcdf4.net
 public Dictionary<string, NcVar> GetVars(Location location=Location.Current) {
     Dictionary<string, NcVar> vars = new Dictionary<string, NcVar>();
     if(LocationIsCurrentGroup(location)) {
         int varCount = GetVarCount();
         Int32[] varIds = new Int32[varCount];
         NcCheck.Check(NetCDF.nc_inq_varids(myId, ref varCount, varIds));
         foreach(Int32 varId in varIds) {
             NcVar tmpVar = new NcVar(this, varId);
             vars.Add(tmpVar.GetName(), tmpVar);
         }
     }
     if(LocationIsParentGroup(location)) {
         foreach(KeyValuePair<string, NcGroup> g in GetGroups(GroupLocation.ParentsGrps)) {
             g.Value.GetVars().ToList().ForEach(x => vars[x.Key] = x.Value);
         }
     }
     if(LocationIsChildGroup(location)) {
         foreach(KeyValuePair<string, NcGroup> g in GetGroups(GroupLocation.AllChildrenGrps)) {
             g.Value.GetVars().ToList().ForEach(x => vars[x.Key] = x.Value);
         }
     }
     return vars;
 }