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

Comments about run-off fluxes are overly specific to JRA55 #98

Open
glwagner opened this issue Jul 1, 2024 · 2 comments
Open

Comments about run-off fluxes are overly specific to JRA55 #98

glwagner opened this issue Jul 1, 2024 · 2 comments

Comments

@glwagner
Copy link
Member

glwagner commented Jul 1, 2024

There are comments in the code that are overly specific to JRA55 reanalysis. Given that we will eventually support many different prescribed atmospheres, including both JRA55 and ERA5, which presumably have a variety of ways of prescribing run-off, etc, this code needs to be generalized somehow.

# Retrieve the details of runoff fluxes (rivers and icebergs, if present in the simulation).
# Note that these forcing fields are different in terms of frequency (daily instead of three-hourly)
# and gridsize (1/4 degree instead of 1/2 degree) when compared to the other prescribed fluxes
# So they need to be interpolated using their own grid / times / backend / time_indexing
@inline get_runoff_args(::Nothing) = nothing
@inline function get_runoff_args(runoff_flux)
data = map-> ϕ.data, runoff_flux)
grid = runoff_flux.rivers.grid
times = runoff_flux.rivers.times
backend = runoff_flux.rivers.backend
time_indexing = runoff_flux.rivers.time_indexing
return (data, grid, times, backend, time_indexing)
end
@inline get_runoff_flux(X, time, ::Nothing) = zero(eltype(X))
@inline function get_runoff_flux(X, time, runoff_args)
@inbounds runoff_flux = runoff_args[1] # The data is located at position 1 of the tuple
@inbounds other_args = runoff_args[2:end] # Other args contain grid, times, backend and time_indexing
Mr = interp_atmos_time_series(runoff_flux, X, time, other_args...)
return Mr
end

@glwagner
Copy link
Member Author

glwagner commented Jul 1, 2024

This comment also should be removed:

# Rememeber runoff fluxes could be `nothing` if rivers and icebergs are not included in the forcing

because any of the fluxes can be nothing --- why not?

@glwagner
Copy link
Member Author

glwagner commented Jul 1, 2024

Here are two solutions:

  1. Every variable has it's own grid.
  2. Every variable lives on the same spatial grid. This requires interpolating the atmos variables to a common grid when constucting them.

It's too complicated to pick a random subset of variables (like runoff) to have a different grid, this doesn't generalize to many different reanalysis products.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant