Closed Marston closed 2 years ago
Also, could you please check the documentation page, as well, it does not match with the function arguments and there are statements there that are not used.
Hello @Marston! This is currently being looked in to and will be addressed soon. Thank you for reporting this issue!
@Marston, this has been addressed, thank you! We will be reviewing similar changes for more docstrings in this project imminently.
Also! Just to be clear, the geocat-comp docs still appear incorrect for the time being. We are also looking at how we're updating these docs. The function here is actually coming from geocat-f2py, which has its own docs here. The docs for this function are updated there. The docs for geocat-comp will be updated when a new release of geocat-f2py is made.
Hi,
Wonderful! I was also looking at the f2py docs but when I tested the function it didn't work either. I appreciate you guys addressing this. I was an avid fan of the NCL project. It was the best software package for meteorologists and researchers in the filed. Happy to see it is somewhat resurrected here. Hope to see the full suite back on the market soon. Something I would definitely purchase.
@Marston, I will continue to look in to this, then. Sorry for all the trouble it's giving you!
Thank you for your input on this project, if there are any functions you'd like to see implemented, we do try to prioritize user requests! Also, the entirety of the project will remain open source and free for use, no need for purchase.
Hi,
Thanks. Could you post the exact call to the function that works for you?
Btw, when is the next release with the latest bug fixes?
@Marston there will be a geocat-f2py release this month with the docstring fix. I can ping this thread again when it is released.
Also, here is a solution to the error you are receiving above:
triple_to_grid
requires x_in
(your ilat
) and y_in
(your ilon
) to be the same length. This is because triple_to_grid
does not assume that the input data
is on any sort of evenly spaced grid and requires an x
and y
value for each point.
Additionally, we need to specify that we are only working with one dimension of data.
From your example, I'm assuming that you want to change data from a 100x1000 grid to a 500x1500 grid.
See this annotated example I've made from your original post:
# original grid for data
ilat = np.linspace(-90, 90, 100)
ilon = np.linspace(0, 360, 1000)
# meshgrid for input data
lat, lon = np.meshgrid(ilat, ilon)
# flatten meshgrid to 1D arrays of length n
lat = lat.flatten()
lon = lon.flatten()
# intended new grid
olat = np.linspace(-90, 90, 500) # [M]
olon = np.linspace(0, 360, 1500) # [N]
# data, note that data needs to be [n, K]. Here K=1.
data = np.random.randint(1, 500, size=(1, lat.shape[0]))
# place data on new rectilinear grid
test = out = geocat.comp.triple_to_grid(data, lat, lon,
olat, olon,
method=1, domain=1.0,
distmx=None, missing_value=-9990.9,
meta=False)
# test is now [K x N x M], where K is 1, we can use np.squeeze to remove K dimension
test = np.squeeze(test)
# plotting test
plt.imshow(test)
Does this answer your question?
Hi,
Yes, yes it does. Thank you. Please let me know how this project is developing.
Will do! Also feel free to submit requests for any functions from ncl you use and check out the GeoCAT blog!
Attempting to use this function: https://geocat-comp.readthedocs.io/en/latest/user_api/generated/geocat.comp.triple_to_grid.html#geocat.comp.triple_to_grid but noticed that the arguments are not in order in the example and the function definition. I tried using it but got the error:
triple_to_grid: The length of
x_inand
y_inmust be the same as the rightmost dimension of
data!
I expected the function to return an array interpolated to the new grid.
Ubuntu 22.04 LTS
Environment