#ahdr.printVgrid()

#mr = mreader("/home/workspace/ccalmr/hindcasts/", bp=pts, start=2923.0104, end=2923+(900./86400.)*3., dvg=1, db=14)
#vel_dat = mr.get_model_data(dtype="hvel.64")
#salt_dat = mr.get_model_data(dtype="salt.63")

#(cs_dat, csnames) = meccs_file_util.read_cs_file("/home/users/hyde/columbia/col_meccs_cs_4.cs", 1)
#cs_dat = meccs_file_util.read_cs_file("/home/users/hyde/columbia/col_meccs_cs_4b.cs", 1)
#pts = meccs_file_util.read_pt_file("/home/users/hyde/columbia/col_meccs_4.pts", 0)

(cs_dat, csnames) = meccs_file_util.read_cs_file(
    "/home/hyde/public_html/ourestuaries/shapes_data/hyde/yaqalsea/cross_sections.txt",
    1)

meccs_file_util.write_cs_file(
    "/home/hyde/public_html/ourestuaries/shapes_data/hyde/yaqalsea/test_cross_sections.txt",
    cs_dat, csnames)

(cs_dbg, dbg_names) = meccs_file_util.read_cs_file(
    "/home/hyde/public_html/ourestuaries/shapes_data/hyde/yaqalsea/test_cross_sections.txt",
    1)

#sp = shape_procs()
#for i in range(len(areas)):
#  sp.add_shape(areas[i], "volume", 0, "vol_"+str(i))
#data = sp.gen_volume_data("/home/workspace/ccalmr/hindcasts/", 2923.0104, 2923+(900./86400.)*2., 16, "base", 1)

sp = shape_procs()

for i in range(len(cs_dat)):
    sp.add_shape(cs_dat[i], "cross_sec", 50, "cs" + str(i))
Ejemplo n.º 2
0
  (transects, tnames, trivers) = meccs_file_util.read_cs_file(shape_dir+"/transects.txt", 0)
  if len(transects)>0:
    for i in range(len(transects)):
      sp.add_shape(transects[i], "transect", 50, tnames[i])

    if (meccs_file_util.file_exists(shape_dir+"/transects.ob") and int(do_refresh)==0):
#      print "using transect ob file "+shape_dir+"transects.ob\n"      
      sp.ob_file=shape_dir+"/transects.ob"
    else:
#      print "creating new transect ob file\n"
      agr = Gr()
      [year, day, ts] = model_util.corie2ydn(start_time)
      dname = "%s/%d-%03d/run/" % (base_dir+"/", year, day)      
      agr.readHGrid(dname+"hgrid.gr3")
      aob = Ob()
      sppts = sp.get_pts("transect")
      aob.grid_init(agr, array([sppts[0], sppts[1]]).T)
      aob.save_ob(shape_dir+"/transects.ob")
      sp.ob_file = shape_dir+"/transects.ob"

    if (mean(abs(transects[0][:,2]))==0 and mean(abs(transects[0][:,3]))==0) or int(do_refresh)==1:
      sp.gen_channel_norms(base_dir+"/", start_time, start_time+2, "transect", 16, 1, 0)
      meccs_file_util.write_cs_file(shape_dir+"/transects.txt", sp.shapes, tnames, trivers)      
    
    for i in range(len(transects)):  
      data = sp.gen_transect_data(base_dir+"/", start_time, end_time, tnames[i], 16, 1, 1, 0)
    
      data["start_time"] = start_time
      data["end_time"] = end_time
      sp.save_cs_data(data, out_base+"/transect_"+tnames[i]+"_"+str(yr)+"_"+str(day)+"_"+str(ndays)+".dat");
            agr = Gr()
            [year, day, ts] = model_util.corie2ydn(start_time)
            dname = "%s/%d-%03d/run/" % (base_dir + "/" + estuaryid + "/",
                                         year, day)
            agr.readHGrid(dname + "hgrid.gr3")
            aob = Ob()
            sppts = sp.get_pts("point")
            aob.grid_init(agr, array([sppts[0], sppts[1]]).T)
            aob.save_ob(shape_dir + "/points.ob")
            sp.ob_file = shape_dir + "/points.ob"

        if (mean(abs(points[0][:, 2])) == 0
                and mean(abs(points[0][:, 3])) == 0) or int(do_refresh) == 1:
            sp.gen_channel_norms(base_dir + "/" + estuaryid + "/", start_time,
                                 start_time + 2, "point", 16, 1, 0)
            meccs_file_util.write_cs_file(shape_dir + "/points.txt", sp.shapes,
                                          pnames)

        mr_pt = mreader(base_dir + "/" + estuaryid + "/", apoints[:, 0:2],
                        start_time, end_time, 0, 16, 1, 0,
                        shape_dir + "/points.ob", 1)

        for i in range(ndays):
            curr_time = start_time + i

            data = sp.gen_point_data(base_dir + "/" + estuaryid + "/",
                                     curr_time, curr_time + (1 - 0.25 / 24),
                                     16, "base", 1, 0)
            data["start_time"] = curr_time
            data["end_time"] = curr_time + (1 - 0.25 / 24)
            data["dt"] = 900
            dname = "%s/%s/%d-%03d/process/" % (base_dir, estuaryid, yr,
Ejemplo n.º 4
0
(points, pnames, privers) = meccs_file_util.read_cs_file(shape_dir+"/points.txt", 1)
(csecs, cnames, crivers) = meccs_file_util.read_cs_file(shape_dir+"/cross_sections.txt", 1)

oe = ourestuaries_db.oe_db()
oe.connect("cdb01.stccmop.org", "ourestuaries", "test_hyde", "poop77")

#(names, pts, norms, rivers) = oe.get_points_by_eid('yaqalsea')
#(names, runids, unames) = oe.get_shape_info_by_eid('yaqalsea', 'cross_section')
#points = 
#for i in range(len(names)):
  
  
#pdb.set_trace()

#sp = shape_procs.shape_procs()
#for i in range(pts.shape[0]):
#  sp.add_shape(array([hstack((pts[i],[0,0]))])  , "point", 0, names[i])

pdb.set_trace()
  
sp.gen_channel_norms(model_dir, start_time, end_time, "point", 16, 1, 0)

meccs_file_util.write_cs_file(shape_dir+"/temp_pts.txt", sp.shapes, names)

#(pts, norms, rivers, eid) = oe.get_trans_or_cs("ts1", "yaqadj", "hyde", "transect")
#oe.set_transect(transects[0][:,0:2], transects[0][:,2:4], "tstest", rivers, eid, "yaqadj", "hyde")

dbg=1


Ejemplo n.º 5
0
  if len(cross_sections)>0:
    for i in range(len(cross_sections)):
      sp.add_shape(cross_sections[i], "cross_sec", 50, cnames[i])

    if (meccs_file_util.file_exists(shape_dir+"/cross_sections.ob") and int(do_refresh)==0):
      print "using cross section ob file "+shape_dir+"cross_sections.ob\n"      
      sp.ob_file=shape_dir+"/cross_sections.ob"
    else:
      print "calculating new cross section ob file\n"
      agr = Gr()
      [year, day, ts] = model_util.corie2ydn(start_time)
      dname = "%s/%d-%03d/run/" % (base_dir+"/"+estuaryid+"/", year, day)      
      agr.readHGrid(dname+"hgrid.gr3")
      aob = Ob()
      sppts = sp.get_pts("cross_sec")
      
      aob.grid_init(agr, array([sppts[0], sppts[1]]).T)
      aob.save_ob(shape_dir+"/cross_sections.ob")
      sp.ob_file = shape_dir+"/cross_sections.ob"

    if (mean(abs(cross_sections[0][:,2]))==0 and mean(abs(cross_sections[0][:,3]))==0) or int(do_refresh)==1:
      sp.gen_channel_norms(base_dir+"/"+estuaryid+"/", start_time, start_time+2, "cross_sec", 16, 1, 0)
      meccs_file_util.write_cs_file(shape_dir+"/cross_sections.txt", sp.shapes, cnames, crivers)

    data = sp.gen_cross_section_data(base_dir+"/"+estuaryid+"/", start_time, end_time, 16, "base", 1, 1, 0)
    
    data["start_time"] = start_time
    data["end_time"] = end_time
    sp.save_cs_data(data, out_base+"/cross_section_data_"+str(int(start_time))+"_"+str(int(end_time))+".dat");