Пример #1
0
            print "tried and filed to create {0:s} directory".format((dirname))
            sys.exit(1)


if __name__ == "__main__":

    make_dir()
    max_rows = 300
    max_cols = 200
    # get the name of files ending in hdf
    the_files = glob.glob("MOD03*275*hdf")
    # take the first one (only one file fits this description)
    the_file = the_files[0]

    # here's the header information
    print parseMeta(the_file)

    # get the full latitude and longitude arrays
    sdgeom = pyhdf.SD.SD(the_file)
    fullLats = sdgeom.select("Latitude")
    fullLats = fullLats.get()
    fullLons = sdgeom.select("Longitude")
    fullLons = fullLons.get()
    sdgeom.end()

    the_files = glob.glob("MOD*21KM*275*hdf")
    the_file = the_files[0]
    sdrad = pyhdf.SD.SD(the_file)
    longWave = sdrad.select("EV_1KM_Emissive")
    #
    # this array will be 16 x 2040 x 1354
Пример #2
0
    nc_dims = [dim for dim in nc_fid.dimensions]  # list of nc dimensions
    # Dimension shape information.
    if verb:
        print "NetCDF dimension information:"
        for dim in nc_dims:
            print "\tName:", dim 
            print "\t\tsize:", len(nc_fid.dimensions[dim])
            print_ncattr(dim)
    # Variable information.
    nc_vars = [var for var in nc_fid.variables]  # list of nc variables
    if verb:
        print "NetCDF variable information:"
        for var in nc_vars:
            if var not in nc_dims:
                print '\tName:', var
                print "\t\tdimensions:", nc_fid.variables[var].dimensions
                print "\t\tsize:", nc_fid.variables[var].size
                print_ncattr(var)
    return nc_attrs, nc_dims, nc_vars


if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument('ncname', type=str,help='full path to netcdf file')
    args=parser.parse_args()
    nc_file=Dataset(args.ncname,'r')
    ncdump(nc_file, verb=True)    
    print(parseMeta(nc_file))