gnome.utilities
¶
__init__.py for the utilities package
a few small things here, ‘cause why not?
Subpackages¶
gnome.utilities.file_tools
gnome.utilities.geometry
gnome.utilities.graphs
gnome.utilities.weathering
gnome.utilities.weathering.adios2
gnome.utilities.weathering.banerjee_huibers
gnome.utilities.weathering.delvigne_sweeney
gnome.utilities.weathering.ding_farmer
gnome.utilities.weathering.huibers_lehr
gnome.utilities.weathering.lee_huibers
gnome.utilities.weathering.lehr_simecek
gnome.utilities.weathering.monahan
gnome.utilities.weathering.overstreet
gnome.utilities.weathering.pierson_moskowitz
gnome.utilities.weathering.riazi
gnome.utilities.weathering.spill_area
gnome.utilities.weathering.stokes
gnome.utilities.weathering.zhao_toba
Submodules¶
gnome.utilities.appearance
gnome.utilities.cache
gnome.utilities.colormaps
gnome.utilities.compute_fraction
gnome.utilities.convert
gnome.utilities.distributions
gnome.utilities.hull
gnome.utilities.images2gif
gnome.utilities.inf_datetime
gnome.utilities.map_canvas
gnome.utilities.orderedcollection
gnome.utilities.plume
gnome.utilities.profiledeco
gnome.utilities.projections
gnome.utilities.rand
gnome.utilities.remote_data
gnome.utilities.save_updater
gnome.utilities.schema_decorator
gnome.utilities.serializable_demo_objects
gnome.utilities.shapefile_builder
gnome.utilities.surface_concentration
gnome.utilities.time_utils
gnome.utilities.timeseries
gnome.utilities.transforms
Package Contents¶
Functions¶
|
Convert longitude values to a given coordinate system. |
|
round a float to significant figures -- no error checking |
|
|
|
round to a certain number of significant figures |
|
convert a mass unit to either a mass or volume unit |
Attributes¶
- gnome.utilities.div¶
- gnome.utilities.convert_longitude(lon, coord_system='-180--180')¶
Convert longitude values to a given coordinate system.
Options are:
“-180–180”: Negative 180 degrees to 180 degrees
“0–360”: Zero to 360 degrees
- Parameters:
lon – numpy array-like of longitude values of float type
coord_system='-180--180' – options are: {“-180–180”, “0–360”}
NOTE: this function also normalizes so that:
360 converts to 0 -180 converts to 180
It should be safe to call this on any coords – if they are already in the expected format, they will not be changes, except for the normalization above.
- gnome.utilities.GetCurrentProcess¶
- gnome.utilities._round_sf_float(x, sigfigs)¶
round a float to significant figures – no error checking
This uses the “g” format specifier – maybe slow, but robust for the purpose of getting the display what we want.
- gnome.utilities.round_sf_scalar(x, sigfigs)¶
- gnome.utilities.round_sf_array(x, sigfigs)¶
round to a certain number of significant figures
should work on floats and numpy arrays
- NOTE: This should be vectorizable, but np.round takes only a scalar value
for number of decimals – you could vectorize the rest of the computation, and then loop for the round, but would that buy anything? (or use np.vectorize)
- gnome.utilities.convert_mass_to_mass_or_volume(in_unit, out_unit, density, value)¶
convert a mass unit to either a mass or volume unit
- Parameters:
in_unit – units of input, should be a valid mass unit.
out_unit – units you want the result in – can be a volume or mass unit
density – density to use to convert from mass to volume. has to be kg/m^3
value – value (in in_units) you want converted.
ex:
convert_mass_to_mass_or_volume(‘kg’, ‘bbl’, 950, 2000)
convert_mass_to_mass_or_volume(‘lbs’, ‘kg’, 950, 4000)