Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularise netCDF output #522

Closed
milankl opened this issue Apr 16, 2024 · 1 comment
Closed

Modularise netCDF output #522

milankl opened this issue Apr 16, 2024 · 1 comment
Labels
output 📤 NetCDF or JLD2 output, their writers, formats, etc user interface 🎹 How users use our user interface

Comments

@milankl
Copy link
Member

milankl commented Apr 16, 2024

Motivated by discussion in #507 we need to refactor our OutputWriter. Something like this should be possible

# initialise output writer generally but not variable specific
output = OutputWriter(spectral_grid, schedule = Schedule(every = Hour(6)), output_Grid = ...)

# add some variables that should be output with some variable-specific options
add!(output, StreamfunctionOutput(spectral_grid), keepbits=15, compression_level = 2)

# also adds default variables to output, u, v, vor, ...
model = PrimitiveWetModel(;spectral_grid, output)

# remove or add other variables to output
remove!(output, DivergenceOutput)
add!(output, ConvectivePrecipitationOutput(spectral_grid))

so that we have for every variable that should be outputted something like

struct TemperatureOutput{NF} <: AbstractOutputVariable
    NF::DataType = Float32
    dimensions = [true, true, true, true]    # x, y, z, t
    long_name::String = "Temperature"
    units::String = "degC"
    ...
end

output!(::OutputWriter, ::StreamfunctionOutput, ::PrognosticVariables, ::DiagnosticVariables, ::ModelSetup)
    # define here how to take variables from progn, diagn and put them into
    # the nc file in output
    # some variables need unscaling, temperature needs -273.15 for K->˚C
    # pressure needs a exp, precipitation needs unit adjustment etc...
end

which would allow users to define their own output variables with any possible processing

@milankl milankl added user interface 🎹 How users use our user interface output 📤 NetCDF or JLD2 output, their writers, formats, etc labels Apr 16, 2024
@milankl
Copy link
Member Author

milankl commented Sep 25, 2024

@minifuo with #525 merged this is now also documented in the dev docs, should be built any moment

@milankl milankl closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
output 📤 NetCDF or JLD2 output, their writers, formats, etc user interface 🎹 How users use our user interface
Projects
None yet
Development

No branches or pull requests

1 participant