Movatterモバイル変換


[0]ホーム

URL:


Custom Axis Labels

EGRET was designed for water-quality and streamflowexploration. The units for streamflow are stored within theEGRET object (eList) in m^3/s. The units for thewater-quality measurements are stored in mg/l. With these units in mind,all the plots and tables offer the user simple alternatives for display.This article will describe how to use the different options, and how tocreate your own custom labels.

Streamflow

Streamflow values are stored as m^3/s. For plots and tables thatdisplay discharge data, there is a user-argument to the functions calledqUnit. This input can be a numeric between 1 and 4, or itcan be one of the following text: “cfs”, “cms”, “thousandCfs”, or“thousandCms”. The numeric that lines up with the text can be seen withtheprintqUnitCheatSheet function:

printqUnitCheatSheet()
## The following codes apply to the qUnit list:## 1 =  cfs  ( Cubic Feet per Second )## 2 =  cms  ( Cubic Meters per Second )## 3 =  thousandCfs  ( Thousand Cubic Feet per Second )## 4 =  thousandCms  ( Thousand Cubic Meters per Second )

Here is an example of using the default (qUnit = 2 whichcorresonds to “cms”), compared to usingqUnit = 1(corresponding to “cfs”):

eList<- Choptank_eListplotConcQ(eList)plotConcQ(eList,qUnit =1)
Plots of discharge with different units.Plots of discharge with different units.

Plots of discharge with different units.

Custom Units

There could be a scenario whereEGRET analysis is notdone using a streamflow value. For example, let’s say we want to useprecipitation as a substitution for discharge. A very important pointhere is that if you use data that are not designed for theEGRET software, it will probably not make sense to use theflux calculations. But, there are places whereEGRET graphsand tables will be interesting using this alternative data.

Here is an example of how to make a customqUnit object.It is not as simple as adding a single line of text. This is because thesoftware needs to know how to create nice labels for a variety ofdifferent kind of plots, and if there is a conversion factor, it wouldneed to know that conversion factor. This example shows how to make acustomqUnit for precipitation with millimeters as theunit:

qConst_precip<-new("qUnit",qShortName ="   mm  ",qUnitFactor =1,qUnitName ="Millimeter",qUnitExpress =expression(paste("Precipitation in ",mm)),qUnitTiny =expression(paste("Precipitation ","(", mm,")")),shortCode =1,unitUSGS ="Precipitation, in mm",prefix ="Precipitation")

Each “slot” in thisqUnit object is required, and theqShortName, qUnitName, unitUSGS, and prefix must be characters. TheqUnitFactor must be a numeric (this would be the conversion factor thatthe data gets multiplied by). qUnitExpress and qUnitTiny are“expressions” which allows the text to be formatted. To use this customunit:

plotConcQ(eList,qUnit = qConst_precip)
Plot with custom axis, using precipitation instead of discharge.

Plot with custom axis, using precipitation instead of discharge.

Data input

Discharge data in units other than m^3/s can be used as input inEGRET, but that data will be converted to m^3/s with the qUnit argumentwhen the eList is created. So if you have data that is coming in that isin cubic feet per second, you could use thereadDailyUserfunction, and specifyqUnit = 1. This will take your cfsdata, and store it properly as cms.

Concentration

Concentration values are stored as mg/l. This is the only option thatcomes by default inEGRET. However, you can change the unitdisplay using theeList$INFO$param.units (there are notconversion options however). You can also create a customconcUnit as shown below:

eList$INFO$param.units<-"ng"deposition<-new("concUnit",longPrefix ="Deposition",shortPrefix ="Dep")plotConcQ(eList,qUnit = qConst_precip,concLab = deposition)

Flux

There are a variety of units of flux that can be used. For plots andtables that display flux data, there is a user-argument to the functionscalledfluxUnit. This input can be a numeric between 1 and13, or it can be one of the following text:

names(fluxConst)
##  [1] "poundsDay"        "tonsDay"          "kgDay"            "thousandKgDay"   ##  [5] "tonsYear"         "thousandTonsYear" "millionTonsYear"  "thousandKgYear"  ##  [9] "millionKgYear"    "billionKgYear"    "thousandTonsDay"  "millionKgDay"    ## [13] "kgYear"

The numeric that lines up with the text can be seen with theprintFluxUnitCheatSheet function:

printFluxUnitCheatSheet()
## The following codes apply to the fluxUnit list:## 1 =  poundsDay  ( pounds/day )## 2 =  tonsDay  ( tons/day )## 3 =  kgDay  ( kg/day )## 4 =  thousandKgDay  ( thousands of kg/day )## 5 =  tonsYear  ( tons/year )## 6 =  thousandTonsYear  ( thousands of tons/year )## 7 =  millionTonsYear  ( millions of tons/year )## 8 =  thousandKgYear  ( thousands of kg/year )## 9 =  millionKgYear  ( millions of kg/year )## 10 =  billionKgYear  ( billions of kg/year )## 11 =  thousandTonsDay  ( thousands of tons/day )## 12 =  millionKgDay  ( millions of kg/day )## 13 =  kgYear  ( kg/year )

Here is a comparison of the default values and a specified fluxunit.

plotFluxHist(eList)plotFluxHist(eList,fluxUnit =2)
Plots of flux with different units.Plots of flux with different units.

Plots of flux with different units.

Here is an example of how to make a customfluxUnitobject. It is not as simple as adding a single line of text. This isbecause the software needs to know how to create nice labels for avariety of different kind of plots, and if there is a conversion factor,it would need to know that conversion factor. This example shows how tomake a customfluxUnit of grams per day:

gDay<-new("fluxUnit",shortName ="    g/day   ",unitFactor =1000,unitName ="g/day",unitExpress =expression("Flux in g/day"),unitExpressTiny =expression("Flux (g/day)"),unitEstimate =expression("flux in g/year"),unitEstimateTiny =expression("Est. flux in g/day"),unitUSGS ="Flux, in grams per day",shortCode =14)plotFluxHist(eList,fluxUnit = gDay)

Month

There is also a way to customize the way the months are displayed.This might be useful for non-English speaking users for instance.Although we don’t have the capacity to have a conversion for all of thetext, this could come in handy:

spanish_month<-new("monthLabel",monthAbbrev =c("enero","feb","marzo","abr","mayo","jun","jul","agosto","set","oct","nov","dic"),monthFull =c("enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"),monthSingle =c("E","F","M","A","M","J","J","A","S","O","N","D"))eList$INFO$param.units<-"mg/L"concentration_esp<-new("concUnit",longPrefix ="Concentración",shortPrefix ="conc.")boxConcMonth(eList,printTitle =FALSE,showXLabels =FALSE,monthLab = spanish_month,concLab = concentration_esp)
Concentration by month.

Concentration by month.


[8]ページ先頭

©2009-2025 Movatter.jp