OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
seadasutils.ProcUtils Namespace Reference

Functions

def getSession (verbose=0, ntries=5)
 
def isRequestAuthFailure (req)
 
def httpdl (server, request, localpath='.', outputfilename=None, ntries=5, uncompress=False, timeout=30., verbose=0, force_download=False, chunk_size=DEFAULT_CHUNK_SIZE)
 
def uncompressFile (compressed_file)
 
def get_file_time (localFile)
 
def cleanList (filename, parse=None)
 
def date_convert (datetime_i, in_datetype=None, out_datetype=None)
 
def addsecs (datetime_i, dsec, datetype=None)
 
def diffsecs (time0, time1, datetype=None)
 
def round_minutes (datetime_i, datetype=None, resolution=5, rounding=0)
 
def remove (file_to_delete)
 
def ctime (the_file)
 
def mtime (the_file)
 
def cat (file_to_print)
 
def compare_checksum (filepath, checksum)
 
def check_sensor (inp_file)
 

Variables

int DEFAULT_CHUNK_SIZE = 131072
 
int BLOCKSIZE = 65536
 
 obpgSession = None
 

Detailed Description

SeaDAS library for commonly used functions within other python scripts

Function Documentation

◆ addsecs()

def seadasutils.ProcUtils.addsecs (   datetime_i,
  dsec,
  datetype = None 
)
Offset datetime_i by dsec seconds.

Definition at line 268 of file ProcUtils.py.

◆ cat()

def seadasutils.ProcUtils.cat (   file_to_print)
Print a file to the standard output.

Definition at line 356 of file ProcUtils.py.

◆ check_sensor()

def seadasutils.ProcUtils.check_sensor (   inp_file)
Determine the satellite sensor from the file metadata
if unable to determine the sensor, return 'X'

Definition at line 376 of file ProcUtils.py.

◆ cleanList()

def seadasutils.ProcUtils.cleanList (   filename,
  parse = None 
)
Parses file list from oceandata.sci.gsfc.nasa.gov through html source
intended for update_luts.py, by may have other uses

Definition at line 207 of file ProcUtils.py.

◆ compare_checksum()

def seadasutils.ProcUtils.compare_checksum (   filepath,
  checksum 
)

Definition at line 363 of file ProcUtils.py.

◆ ctime()

def seadasutils.ProcUtils.ctime (   the_file)
returns days since file creation

Definition at line 332 of file ProcUtils.py.

◆ date_convert()

def seadasutils.ProcUtils.date_convert (   datetime_i,
  in_datetype = None,
  out_datetype = None 
)
Convert between datetime object and/or standard string formats

Inputs:
    datetime_i   datetime object or formatted string
    in_datetype  input format code;
                 must be present if datetime_i is a string
    out_datetype output format code; if absent, return datetime object

    datetype may be one of:
    'j': Julian     YYYYDDDHHMMSS
    'g': Gregorian  YYYYMMDDHHMMSS
    't': TAI        YYYY-MM-DDTHH:MM:SS.uuuuuuZ
    'h': HDF-EOS    YYYY-MM-DD HH:MM:SS.uuuuuu

Definition at line 232 of file ProcUtils.py.

◆ diffsecs()

def seadasutils.ProcUtils.diffsecs (   time0,
  time1,
  datetype = None 
)
Return difference in seconds.

Definition at line 276 of file ProcUtils.py.

◆ get_file_time()

def seadasutils.ProcUtils.get_file_time (   localFile)

Definition at line 195 of file ProcUtils.py.

◆ getSession()

def seadasutils.ProcUtils.getSession (   verbose = 0,
  ntries = 5 
)

Definition at line 44 of file ProcUtils.py.

◆ httpdl()

def seadasutils.ProcUtils.httpdl (   server,
  request,
  localpath = '.',
  outputfilename = None,
  ntries = 5,
  uncompress = False,
  timeout = 30.,
  verbose = 0,
  force_download = False,
  chunk_size = DEFAULT_CHUNK_SIZE 
)

Definition at line 74 of file ProcUtils.py.

◆ isRequestAuthFailure()

def seadasutils.ProcUtils.isRequestAuthFailure (   req)

Definition at line 65 of file ProcUtils.py.

◆ mtime()

def seadasutils.ProcUtils.mtime (   the_file)
returns days since last file modification

Definition at line 344 of file ProcUtils.py.

◆ remove()

def seadasutils.ProcUtils.remove (   file_to_delete)
Delete a file from the system
A simple wrapper for Path.unlink

Definition at line 319 of file ProcUtils.py.

◆ round_minutes()

def seadasutils.ProcUtils.round_minutes (   datetime_i,
  datetype = None,
  resolution = 5,
  rounding = 0 
)
Round to nearest "resolution" minutes, preserving format.

Parameters
----------
datetime_i : string
    String representation of datetime, in "datetype" format
datetype : string
    Format of datetime, as strftime or date_convert() code
resolution : integer, optional
    Number of minutes to round to (default=5)
rounding : integer, optional
    Rounding "direction", where
        <0 = round down
         0 = round to nearest (default)
        >0 = round up

Definition at line 284 of file ProcUtils.py.

◆ uncompressFile()

def seadasutils.ProcUtils.uncompressFile (   compressed_file)
uncompress file
compression methods:
    bzip2
    gzip
    UNIX compress

Definition at line 172 of file ProcUtils.py.

Variable Documentation

◆ BLOCKSIZE

int BLOCKSIZE = 65536

Definition at line 39 of file ProcUtils.py.

◆ DEFAULT_CHUNK_SIZE

int DEFAULT_CHUNK_SIZE = 131072

Definition at line 38 of file ProcUtils.py.

◆ obpgSession

obpgSession = None

Definition at line 42 of file ProcUtils.py.