Comments (4)
Some references from Sandro:
https://www.ncl.ucar.edu/Applications/vert_interp.shtml
from hn2016_falwa.
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.
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.
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)
- Provide the option to compute QGPV from relative vorticity in QGFIeld
- Compute vertically averaged local non-conservative force contribution
- Rename the python package to falwa for release v1.0.0 HOT 1
- IMPORTANT: Code error in calculating advective flux in bug fix release 0.7.2
- numpy.disutils will deprecate for python 3.12
- Bug in processing latitude grid that does not include equator
- Automate deployment onto PyPI via GitHub workflow
- Issue in reference state calculations for model data HOT 1
- A potential bug in the 'u_baro' calculation of FALWA v.1.2.0 HOT 2
- Add diabatic heating in the LWA budget HOT 3
- Create another class of QGField that computes only QGPV and LWA HOT 1
- Covariance calculation (between <LWA> and <U>) needs optimization HOT 1
- Enable option to skip vertical interpolation in QGField if variables are already on uniform pseudoheight grid HOT 1
- To-do items for Release 1.3 HOT 1
- To-do items for Release1.4
- Design error handling mechanism in case Uref cannot be solved HOT 1
- Create data catalog for finite amplitude wave diagnostic use cases in MDTF
- Add script to MDTF to plot predigested data HOT 1
- Documentation on how to preprocess NaN values below topography HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hn2016_falwa.