gnome.utilities¶
__init__.py for the utilities package
a few small things here, ‘cause why not?
Submodules¶
- gnome.utilities.appearance
- gnome.utilities.cache
- gnome.utilities.colormaps
- gnome.utilities.compute_fraction
- gnome.utilities.convert
- gnome.utilities.distributions
- gnome.utilities.file_tools
- gnome.utilities.geometry
- gnome.utilities.graphs
- gnome.utilities.hull
- gnome.utilities.images2gif
- gnome.utilities.inf_datetime
- gnome.utilities.map_canvas
- gnome.utilities.orderedcollection
- gnome.utilities.plotting
- 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
- gnome.utilities.weathering
Attributes¶
Functions¶
|
Convert longitude values to a given coordinate system. |
|
|
|
round to a certain number of significant figures |
|
convert a mass unit to either a mass or volume unit |
Package Contents¶
- 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 changed, except for the normalization above.
- gnome.utilities.GetCurrentProcess¶
- 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)