You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plots can take advantage of variable attributes for setting labels and units: Labels from long_name, and units from units. Might need some little utility to convert units to something pretty. E.g. 'm s-1' could be translated to 'm s$^{-1}$'. Although, I'm really not sure who decided "PSAL" would have units 1e-3. Ok, I read a little further through the vocabularies.py, and scratch that. long_name is not great "Temperature of the water body by CTD". Neither is standard_name "sea_water_pressure". Maybe somewhere we can set up a dictionary based on variable name and "plotting_name" or something.
BP700: My paper uses b${bp}$(700) for red backscatter (probably based on something by Sackmann or Mary-Jane Perry). Could be "Red backscatter, b${bp}$(700)"
PSAL: "Practical salinity"
TEMP: "Temperature"
SA: "Absolute salinity"
DENSITY: "In situ density"
DOXY: "Dissolved oxygen"
When the dictionary doesn't have a key for the variable the user wants to plot, then it can use just the varname.
Then the label_str = label_dict['BP700'] + utilities.nice_units(ds['BP700'].attrs['units'])
and the function (or widget) .nice_units() can translate from 'degrees_Celcius' to '$^\circ$C' and from 'm-1' to 'm$^{-1}$', etc.
I think this is a good idea. Having looked into it, this will require some changes to the functions that we have. We should pass xarray datasets and dataarrays with their corresponding metadata to/from functions like plot_updown_bias so that we can use the unit metadata and long/standard names to construct nice labels. This will also make the toolbox generally more interoperable and easier for the end user (no need to pass both the chlorophyll variable and the lable "chlorophyll a [mmol / litre]" to the plotting function
eleanorfrajka
changed the title
Plot labels
Plot labels - to determine variable names + units from the dataset
Nov 28, 2024
Plots can take advantage of variable attributes for setting labels and units: Labels from long_name, and units from units. Might need some little utility to convert units to something pretty. E.g. 'm s-1' could be translated to 'm s$^{-1}$'. Although, I'm really not sure who decided "PSAL" would have units 1e-3. Ok, I read a little further through the vocabularies.py, and scratch that. long_name is not great "Temperature of the water body by CTD". Neither is standard_name "sea_water_pressure". Maybe somewhere we can set up a dictionary based on variable name and "plotting_name" or something.
BP700: My paper uses b${bp}$(700) for red backscatter (probably based on something by Sackmann or Mary-Jane Perry). Could be "Red backscatter, b${bp}$(700)"
PSAL: "Practical salinity"
TEMP: "Temperature"
SA: "Absolute salinity"
DENSITY: "In situ density"
DOXY: "Dissolved oxygen"
When the dictionary doesn't have a key for the variable the user wants to plot, then it can use just the varname.
Then the
label_str = label_dict['BP700'] + utilities.nice_units(ds['BP700'].attrs['units'])
and the function (or widget)
.nice_units()
can translate from 'degrees_Celcius' to '$^\circ$C' and from 'm-1' to 'm$^{-1}$', etc.The text was updated successfully, but these errors were encountered: