PseudoNetCDF.geoschemfiles package

Module contents

class PseudoNetCDF.geoschemfiles.bpch(*args, **kwds)[source]

Bases: bpch1, bpch2

bpch_path: path to binary punch file tracerinfo: path to ascii file with tracer definitions diaginfo: path to ascii file with diagnostic group definitions mode : {‘r+’, ‘r’, ‘w+’, ‘c’}, optional

The file is opened in this mode:

+——+———————————————————–+
| ‘r’ | Open existing file for reading only. |
+——+———————————————————–+
| ‘r+’ | Open existing file for reading and writing. |
+——+———————————————————–+
| ‘w+’ | Create or overwrite existing file for reading and writing.|
+——+———————————————————–+
| ‘c’ | Copy-on-write: assignments affect data in memory, but |
| | changes are not saved to disk. The file on disk is |
| | read-only. |
+——+———————————————————–+
timeslice: If the file is larger than 2GB, timeslice provides a way

to subset results. The subset requested depends on the data type of timeslice:

  • int: return the a part of the file if it was broken

    into 2GB chunks (0..N-1)

  • slice: return the times that correspond to that slice

    (i.e., range(ntimes)[timeslice])

  • list/tuple/set: return specified times where each

    time is in the set (0..N-1)

noscale: Do not apply scaling factors vertgrid: vertical coordinate system (options: ‘GEOS-5-REDUCED’,

‘GEOS-5-NATIVE’, ‘MERRA-REDUCED’, ‘MERRA-NATIVE’, ‘GEOS-4-REDUCED’, ‘GEOS-4-NATIVE’, default ‘GEOS-5-REDUCED’)

nogroup: False - use all groups, True - use no groups, list of groups

to ignore

classmethod isMine(*args, **kwds)[source]

True if this file or object can be identified for use by this class. Useful to override for classes that can be initialized from disk.

class PseudoNetCDF.geoschemfiles.bpch1(*args, **kwds)[source]

Bases: bpch_base

NetCDF-like class to interface with GEOS-Chem binary punch files

f = bpch(path_to_binary_file) dim = f.dimensions[dkey] # e.g., dkey = ‘longitude’

# There are two ways to get variables. Directly from # the file using the long name var = f.variables[vkey] # e.g., vkey = ‘IJ-AVG-$_NOx’

# Or through a group using the short name g = f.groups[gkey] # e.g., gkey = ‘IJ-AVG-$’ var = g.variables[vkey] # e.g., vkey = ‘NOx’

# The variable returned is the same either way print(f.dimensions) print(var.unit) print(var.dimensions) print(var.shape)

bpch_path: path to binary punch file tracerinfo: path to ascii file with tracer definitions diaginfo: path to ascii file with diagnostic group definitions mode : {‘r+’, ‘r’, ‘w+’, ‘c’}, optional

The file is opened in this mode:

+——+———————————————————–+
| ‘r’ | Open existing file for reading only. |
+——+———————————————————–+
| ‘r+’ | Open existing file for reading and writing. |
+——+———————————————————–+
| ‘w+’ | Create or overwrite existing file for reading and writing.|
+——+———————————————————–+
| ‘c’ | Copy-on-write: assignments affect data in memory, but |
| | changes are not saved to disk. The file on disk is |
| | read-only. |
+——+———————————————————–+
timeslice: If the file is larger than 2GB, timeslice provides a way

to subset results. The subset requested depends on the data type of timeslice:

  • int: return the a part of the file if it was broken

    into 2GB chunks (0..N-1)

  • slice: return the times that correspond to that slice

    (i.e., range(ntimes)[timeslice])

  • list/tuple/set: return specified times where each

    time is in the set (0..N-1)

noscale: Do not apply scaling factors vertgrid: vertical coordinate system (options: ‘GEOS-5-REDUCED’,

‘GEOS-5-NATIVE’, ‘MERRA-REDUCED’, ‘MERRA-NATIVE’, ‘GEOS-4-REDUCED’, ‘GEOS-4-NATIVE’, default ‘GEOS-5-REDUCED’)

nogroup: False - use all groups, True - use no groups, list of groups

to ignore

classmethod from_ncf(infile)[source]
Parameters:

infile (PseudoNetCDF-like file)

Returns:

outf

Return type:

PseudoNetcdf-like file

classmethod isMine(path, *args, **kwds)[source]

True if this file or object can be identified for use by this class. Useful to override for classes that can be initialized from disk.

class PseudoNetCDF.geoschemfiles.bpch2(*args, **kwds)[source]

Bases: bpch_base

classmethod from_ncf(infile)[source]
Parameters:

infile (PseudoNetCDF-like file)

Returns:

outf

Return type:

PseudoNetcdf-like file

classmethod isMine(path, *args, **kwds)[source]

True if this file or object can be identified for use by this class. Useful to override for classes that can be initialized from disk.

PseudoNetCDF.geoschemfiles.cspec(path, smv2='smv2.log')[source]
class PseudoNetCDF.geoschemfiles.flightlogs(*args, **kwds)[source]

Bases: PseudoNetCDFFile

class PseudoNetCDF.geoschemfiles.gcnc(*args, **kwds)[source]

Bases: gcnc_base, netcdf

class PseudoNetCDF.geoschemfiles.geos(*args, **kwds)[source]

Bases: PseudoNetCDFFile

PseudoNetCDF.geoschemfiles.ncf2bpch(ncffile, outpath, verbose=0)[source]