graymartin / PythonNDFD

A quick set of functions to access the National Digital Forecast Database using Python.
2 stars 2 forks source link

Mirroring of xarray #1

Open sheilasaia opened 4 years ago

sheilasaia commented 4 years ago

@gramart529, thank you very much for sharing this script! I hope all is as well as possible given current circumstances. I was able to get it to work and plot some results (attached) and will fork and submit a pull request soon. However, you can see that the values are being mirrored along an x_index value of approximately 96 (there are 193 unique x_index values divided by 2 = 96.5).

I have a work around for now (filtering out all x_index values less than 96) but was wondering if it would be possible to set half (by the diagonal) of the xarray to na values? That might fix this when it's converted to a pandas data frame, which is what I end up using.

Am happy to talk via Zoom, if that's easier!

Screen Shot 2020-03-25 at 4 46 16 PM

graymartin commented 4 years ago

I can take a look at this and try to figure out why it's being mirrored--do you think legitimate values are being overwritten, or do you think that the duplicated values are just junk?

In terms of a fix, it should be easy to generate a masking matrix to set half of the values (whether vertically, horizontally, or along a diagonal) equal to NaN. We could also just drop the columns with duplicate values, but I want to make sure we aren't losing helpful info if we do that. I'd love to have a Zoom meeting sometime this week or next!

sheilasaia commented 4 years ago

I think it's just a duplicating values values issue and I like the idea of making a matrix with NaNs along the other half of the diagonal. I'll send an email to set up a meeting. :) Pasting the quick fix version on the right with the spatial scope on the right. You can see the precip patterns around the coast on the right image.

Screen Shot 2020-03-25 at 8 10 41 PM