GithubHelp home page GithubHelp logo

Comments (4)

csyhuang avatar csyhuang commented on July 23, 2024

Some references from Sandro:
https://www.ncl.ucar.edu/Applications/vert_interp.shtml

from hn2016_falwa.

Pragallva avatar Pragallva commented on July 23, 2024

Thanks Clare for the discussion for your suggested solutions! :)
Just some continuing thoughts here..
I think a better work around might be to interpolate variables from model levels (sigma or hybrid coordinates) to plevs directly using ncl or other python functions and then use the QGField class as it is since the falwa library transforms from pressure to pseudo-height coordinate.

One caution is that in this case we will be interpolating two times, model levels --> pressure --> pseudo-height (log-pressure). This could be a potential source of residual errors in the LWA budget since during the first step (model levels --> pressure) one has to make some choices about how to fill the extrapolated values below topography.

In future we should aim for having a function that directly transforms from model levels to pseudo-height coordinates and then calculates qg, LWA etc.

  • One way to go about it would be to use the pyngl library (https://www.pyngl.ucar.edu/) to use the ncl functionality. But I had some issues installing it on the falwa python environment since it has some old dependencies.
  • Other option is to use a plain vanilla python code (I have one using the scipy interp function). But more work needed to incorporate into the falwa code base. Also this could be bit slow compared to other methods.
  • Other option is to use a fortran method if someone has one!

from hn2016_falwa.

Pragallva avatar Pragallva commented on July 23, 2024

Some updates about pre-processing model data when the variables are on hybrid vertical coordinates. The following method works for me now.

1 - First I do a coordinate transformation from hybrid vertical levels to pressure levels using scipy interp function.
2 - There is missing data for regions below topography (or lat-lon grids where no values exist at the required pressure levels). I fill them with nans.
3 - Finally I replace the nans by solving Poisson's equation using a relaxation scheme. This is done using the gridfill python library available here - https://github.com/ajdawson/gridfill . The gridfill function is similar to NCL's poisson_grid_fill. I use itermax = 10000 to give as smooth interpolated values as possible. This seems to be necessary for getting reasonable values when using falwa library on this dataset.

from hn2016_falwa.

csyhuang avatar csyhuang commented on July 23, 2024

Hi @Pragallva ,
I'm looking into your code to interpolate from hybrid coordinate to pressure levels. Yeah - it is pathetically slow 😢 took me 4 seconds to interpolate via a single (32, 192, 288) time slice... 🤦 The NGL package seems no longer maintained... and I cannot find anywhere official that does such preprocessing...

QGField.interpolate_fields only do the interpolation once per variable, but the hybrid coordinate conversion is doing it 192 x 288 times, so the latter is incredibly slower. But still, let me try modifying the QGField such that it you can skip interpolation if the input is on regular psudoheight grid. I'll keep you updated when this is done.

I created #115 to cover this

from hn2016_falwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.