NCAR / geocat-comp

GeoCAT-comp provides implementations of computational functions for operating on geosciences data. Many of these functions originated in NCL and were translated into Python.
https://geocat-comp.readthedocs.io
Apache License 2.0
124 stars 56 forks source link

Function arguments order #235

Closed Marston closed 2 years ago

Marston commented 2 years ago

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 ofx_inandy_inmust be the same as the rightmost dimension ofdata!

import geocat.comp
import numpy as np
import matplotlib.pyplot as plt

olat = np.linspace(-90, 90, 500)
olon = np.linspace(0, 360, 1500)
nlat = olat.size
nlon = olon.size

ilat = np.linspace(-90, 90, 100)
ilon = np.linspace(0, 360, 1000)

data = np.random.randint(1, 500, size=(100, 1000))

test =  out = geocat.comp.triple_to_grid(data, ilat, ilon, 
                                         olat, olon, 
                                         method=1, domain=1.0, 
                                         distmx=None, missing_value=-9990.9, 
                                         meta=False)
plt.imshow(test)

I expected the function to return an array interpolated to the new grid.

Ubuntu 22.04 LTS

Environment

(imerg) ➜  ~ conda list
# packages in environment at /home/ard/anaconda3/envs/imerg:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
_r-mutex                  1.0.1               anacondar_1    conda-forge
affine                    2.3.1              pyhd8ed1ab_0    conda-forge
alsa-lib                  1.2.6.1              h7f98852_0    conda-forge
aom                       3.4.0                h27087fc_1    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
asciitree                 0.3.3                      py_2    conda-forge
asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
attr                      2.5.1                h166bdaf_0    conda-forge
attrs                     22.1.0             pyh71513ae_0    conda-forge
autopep8                  1.6.0              pyhd8ed1ab_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
binutils_impl_linux-64    2.36.1               h193b22a_2    conda-forge
binutils_linux-64         2.36                hf3e587d_10    conda-forge
blosc                     1.21.1               h83bc5f7_3    conda-forge
bokeh                     2.4.3           py310hff52083_0    conda-forge
boost-cpp                 1.74.0               h75c5d50_8    conda-forge
brotli                    1.0.9                h166bdaf_7    conda-forge
brotli-bin                1.0.9                h166bdaf_7    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1004    conda-forge
bwidget                   1.9.14               ha770c72_1    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.6.15            ha878542_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cairo                     1.16.0            ha61ee94_1011    conda-forge
cartopy                   0.20.3          py310he7eef42_1    conda-forge
certifi                   2022.6.15       py310hff52083_0    conda-forge
cf_xarray                 0.7.4              pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_0    conda-forge
cfgrib                    0.9.10.1           pyhd8ed1ab_0    conda-forge
cfitsio                   4.1.0                hd9d235c_0    conda-forge
cftime                    1.6.1           py310hde88566_0    conda-forge
charset-normalizer        2.1.0              pyhd8ed1ab_0    conda-forge
click                     8.1.3           py310hff52083_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
cloudpickle               2.1.0              pyhd8ed1ab_0    conda-forge
cmaps                     1.0.5              pyhd8ed1ab_0    conda-forge
colorama                  0.4.5              pyhd8ed1ab_0    conda-forge
configobj                 5.0.6                      py_0    conda-forge
cryptography              37.0.4          py310h597c629_0    conda-forge
curl                      7.83.1               h7bff187_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cytoolz                   0.12.0          py310h5764c6d_0    conda-forge
dask                      2022.7.1           pyhd8ed1ab_0    conda-forge
dask-core                 2022.7.1           pyhd8ed1ab_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
distributed               2022.7.1           pyhd8ed1ab_0    conda-forge
docutils                  0.19            py310hff52083_0    conda-forge
donfig                    0.7.0              pyhd8ed1ab_1    conda-forge
eccodes                   2.26.0               hc08acdf_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
eofs                      1.4.0                      py_0    conda-forge
esmf                      8.2.0           nompi_h61edca3_0    conda-forge
esmpy                     8.2.0           nompi_py310ha0140b2_1    conda-forge
executing                 0.9.1              pyhd8ed1ab_0    conda-forge
expat                     2.4.8                h27087fc_0    conda-forge
fasteners                 0.17.3             pyhd8ed1ab_0    conda-forge
ffmpeg                    4.4.2           gpl_h2b602b6_106    conda-forge
fftw                      3.3.10          nompi_h77c792f_102    conda-forge
findlibs                  0.0.2              pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.0               h8e229c2_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.34.4          py310h5764c6d_0    conda-forge
freeglut                  3.2.2                h9c3ff4c_1    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
freexl                    1.0.6                h7f98852_0    conda-forge
fribidi                   1.0.10               h36c2ea0_0    conda-forge
fsspec                    2022.7.1           pyhd8ed1ab_0    conda-forge
gcc_impl_linux-64         10.3.0              hf2f2afa_16    conda-forge
gcc_linux-64              10.3.0              hc39de41_10    conda-forge
geocat-comp               2022.07.0          pyha770c72_0    conda-forge
geocat-datafiles          2022.03.0          pyha770c72_0    conda-forge
geocat-f2py               2022.04.0       py310h8adf1f6_0    conda-forge
geocat-viz                2022.07.0          pyhd8ed1ab_0    conda-forge
geos                      3.11.0               h27087fc_0    conda-forge
geotiff                   1.7.1                h4fc65e6_3    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
gfortran_impl_linux-64    10.3.0              h73f4979_16    conda-forge
gfortran_linux-64         10.3.0              hb09a455_10    conda-forge
giflib                    5.2.1                h36c2ea0_2    conda-forge
glib                      2.72.1               h6239696_0    conda-forge
glib-tools                2.72.1               h6239696_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.7.6                hf3e180e_5    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
gsl                       2.7                  he838d99_0    conda-forge
gst-plugins-base          1.20.3               hf6a322e_0    conda-forge
gstreamer                 1.20.3               hd4edc92_0    conda-forge
gxx_impl_linux-64         10.3.0              hf2f2afa_16    conda-forge
gxx_linux-64              10.3.0              h2593f52_10    conda-forge
h5netcdf                  1.0.1              pyhd8ed1ab_0    conda-forge
h5py                      3.7.0           nompi_py310h06dffec_100    conda-forge
harfbuzz                  5.0.1                hf9f4e7c_0    conda-forge
hdf4                      4.2.15               h10796ff_3    conda-forge
hdf5                      1.12.1          nompi_h2386368_104    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4          py310hff52083_0    conda-forge
importlib_resources       5.9.0              pyhd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipython                   8.4.0           py310hff52083_0    conda-forge
jack                      1.9.18            h8c3723f_1002    conda-forge
jasper                    2.0.33               ha77e612_0    conda-forge
jedi                      0.18.1          py310hff52083_1    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.1.0              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h166bdaf_2    conda-forge
jsmin                     3.0.1              pyhd8ed1ab_0    conda-forge
json-c                    0.16                 hc379101_0    conda-forge
jsonschema                4.8.0              pyhd8ed1ab_0    conda-forge
kealib                    1.4.15               hfe1a663_0    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.4           py310hbf28c38_0    conda-forge
krb5                      1.19.3               h3790be6_0    conda-forge
lame                      3.100             h7f98852_1001    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libaec                    1.0.6                h9c3ff4c_0    conda-forge
libblas                   3.9.0           15_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h166bdaf_7    conda-forge
libbrotlidec              1.0.9                h166bdaf_7    conda-forge
libbrotlienc              1.0.9                h166bdaf_7    conda-forge
libcap                    2.64                 ha37c62d_0    conda-forge
libcblas                  3.9.0           15_linux64_openblas    conda-forge
libclang                  14.0.6          default_h2e3cab8_0    conda-forge
libclang13                14.0.6          default_h3a83d3e_0    conda-forge
libcups                   2.3.3                hf5a7f15_1    conda-forge
libcurl                   7.83.1               h7bff187_0    conda-forge
libdap4                   3.20.6               hd7c4107_2    conda-forge
libdb                     6.2.32               h9c3ff4c_0    conda-forge
libdeflate                1.12                 h166bdaf_0    conda-forge
libdrm                    2.4.112              h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.3.4                h27087fc_0    conda-forge
libgcc-devel_linux-64     10.3.0              he6cfe16_16    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgdal                   3.5.1                h32640fd_1    conda-forge
libgfortran-ng            12.1.0              h69a702a_16    conda-forge
libgfortran5              12.1.0              hdcd56e2_16    conda-forge
libglib                   2.72.1               h2d90d5f_0    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libidn2                   2.3.3                h166bdaf_0    conda-forge
libkml                    1.3.0             h238a007_1014    conda-forge
liblapack                 3.9.0           15_linux64_openblas    conda-forge
liblapacke                3.9.0           15_linux64_openblas    conda-forge
libllvm11                 11.1.0               hf817b99_3    conda-forge
libllvm14                 14.0.6               he0ac6c6_0    conda-forge
libnetcdf                 4.8.1           nompi_h329d8a1_102    conda-forge
libnghttp2                1.47.0               h727a467_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.20          pthreads_h78a6416_1    conda-forge
libopencv                 4.6.0           py310he663ad9_2    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpciaccess              0.16                 h516909a_0    conda-forge
libpng                    1.6.37               h753d276_3    conda-forge
libpq                     14.4                 hd77ab85_0    conda-forge
libprotobuf               3.20.1               h6239696_0    conda-forge
librttopo                 1.1.0               hf730bdb_11    conda-forge
libsanitizer              10.3.0              h26c7422_16    conda-forge
libsndfile                1.0.31               h9c3ff4c_1    conda-forge
libspatialite             5.0.1               h38b5f51_18    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-devel_linux-64  10.3.0              he6cfe16_16    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libtasn1                  4.18.0               h166bdaf_1    conda-forge
libtiff                   4.4.0                h0d92c0b_2    conda-forge
libtool                   2.4.6             h9c3ff4c_1008    conda-forge
libudev1                  249                  h166bdaf_4    conda-forge
libunistring              0.9.10               h7f98852_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libva                     2.15.0               h166bdaf_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libvpx                    1.11.0               h9c3ff4c_3    conda-forge
libwebp                   1.2.3                h522a892_1    conda-forge
libwebp-base              1.2.3                h166bdaf_2    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.14               h22db469_3    conda-forge
libzip                    1.9.2                hc869a4a_0    conda-forge
libzlib                   1.2.12               h166bdaf_2    conda-forge
llvmlite                  0.38.1          py310h58363a5_0    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
lz4                       4.0.0           py310h5d5e884_2    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
make                      4.3                  hd18ef5c_1    conda-forge
markupsafe                2.1.1           py310h5764c6d_1    conda-forge
matplotlib                3.5.2           py310hff52083_1    conda-forge
matplotlib-base           3.5.2           py310h5701ce4_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
metpy                     1.3.1              pyhd8ed1ab_0    conda-forge
msgpack-python            1.0.4           py310hbf28c38_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mysql-common              8.0.29               haf5c9bc_1    conda-forge
mysql-libs                8.0.29               h28c427c_1    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
netcdf-fortran            4.5.4           nompi_h2b6e579_100    conda-forge
netcdf4                   1.6.0           nompi_py310h947f774_100    conda-forge
nettle                    3.8.1                hc379101_1    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.78                 h2350873_0    conda-forge
numba                     0.55.2          py310ha5257ce_0    conda-forge
numcodecs                 0.10.1          py310hd8f1fbe_0    conda-forge
numpy                     1.22.4          py310h4ef5377_0    conda-forge
opencv                    4.6.0           py310hff52083_2    conda-forge
openh264                  2.2.0                h27087fc_2    conda-forge
openjpeg                  2.4.0                hb52868f_1    conda-forge
openssl                   1.1.1q               h166bdaf_0    conda-forge
p11-kit                   0.24.1               hc5aa10d_0    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandas                    1.4.3           py310h769672d_0    conda-forge
pango                     1.50.8               hc4f8a73_1    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
partd                     1.2.0              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pcre2                     10.37                h032f7d1_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.2.0           py310he619898_0    conda-forge
pint                      0.19.2             pyhd8ed1ab_0    conda-forge
pip                       22.2.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pluggy                    1.0.0           py310hff52083_3    conda-forge
ply                       3.11                       py_1    conda-forge
pooch                     1.6.0              pyhd8ed1ab_0    conda-forge
poppler                   22.04.0              h1434ded_1    conda-forge
poppler-data              0.4.11               hd8ed1ab_0    conda-forge
portaudio                 19.6.0               h57a0ea0_5    conda-forge
postgresql                14.4                 hfdbbde3_0    conda-forge
proj                      9.0.1                h93bde94_1    conda-forge
prompt-toolkit            3.0.30             pyha770c72_0    conda-forge
psutil                    5.9.1           py310h5764c6d_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pulseaudio                14.0                 h7f54b18_8    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py                        1.11.0             pyh6c4a22f_0    conda-forge
py-opencv                 4.6.0           py310hfdc917e_2    conda-forge
pycodestyle               2.9.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.12.0             pyhd8ed1ab_0    conda-forge
pygrib                    2.1.4           py310h815554b_5    conda-forge
pykdtree                  1.3.5           py310hde88566_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pyorbital                 1.7.3              pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyproj                    3.3.1           py310hf94497c_1    conda-forge
pyqt                      5.15.7          py310h29803b5_0    conda-forge
pyqt5-sip                 12.11.0         py310hd8f1fbe_0    conda-forge
pyresample                1.25.0          py310h769672d_0    conda-forge
pyrsistent                0.18.1          py310h5764c6d_1    conda-forge
pyshp                     2.3.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1           py310hff52083_5    conda-forge
pyspectral                0.11.0             pyhd8ed1ab_0    conda-forge
pysteps                   1.6.3           py310h5764c6d_0    conda-forge
pytest                    7.1.2           py310hff52083_0    conda-forge
python                    3.10.5          h582c2e5_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-eccodes            1.4.2           py310hde88566_0    conda-forge
python-geotiepoints       1.4.1           py310hde88566_0    conda-forge
python-tzdata             2022.1             pyhd8ed1ab_0    conda-forge
python_abi                3.10                    2_cp310    conda-forge
pytz                      2022.1             pyhd8ed1ab_0    conda-forge
pytz-deprecation-shim     0.1.0.post0     py310hff52083_2    conda-forge
pyyaml                    6.0             py310h5764c6d_4    conda-forge
qt-main                   5.15.4               ha5833f6_2    conda-forge
r-base                    4.1.3                h06d3f91_1    conda-forge
rasterio                  1.3.0           py310h1bedc6d_0    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
requests                  2.28.1             pyhd8ed1ab_0    conda-forge
rpy2                      3.5.1           py310r41hde88566_0    conda-forge
satpy                     0.36.0             pyhd8ed1ab_0    conda-forge
scikit-learn              1.1.1           py310hffb9edd_0    conda-forge
scipy                     1.8.1           py310hdfbd76f_2    conda-forge
sed                       4.8                  he412f7d_0    conda-forge
setuptools                63.2.0          py310hff52083_0    conda-forge
shapely                   1.8.2           py310h5e49deb_3    conda-forge
simplegeneric             0.8.1                      py_1    conda-forge
sip                       6.6.2           py310hd8f1fbe_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.9                hbd366e4_1    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.39.2               h4ff8645_0    conda-forge
stack_data                0.3.0              pyhd8ed1ab_0    conda-forge
svt-av1                   1.1.0                h27087fc_1    conda-forge
sysroot_linux-64          2.12                he073ed8_15    conda-forge
tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tiledb                    2.9.5                h1e4a385_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tktable                   2.10                 hb7b940f_3    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tornado                   6.1             py310h5764c6d_3    conda-forge
tqdm                      4.64.0             pyhd8ed1ab_0    conda-forge
traitlets                 5.3.0              pyhd8ed1ab_0    conda-forge
trollimage                1.18.3             pyhd8ed1ab_0    conda-forge
trollsift                 0.4.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.3.0                hd8ed1ab_0    conda-forge
typing_extensions         4.3.0              pyha770c72_0    conda-forge
tzcode                    2022a                h166bdaf_0    conda-forge
tzdata                    2022a                h191b570_0    conda-forge
tzlocal                   4.2             py310hff52083_1    conda-forge
unicodedata2              14.0.0          py310h5764c6d_1    conda-forge
urllib3                   1.26.11            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
x264                      1!161.3030           h7f98852_1    conda-forge
x265                      3.5                  h924138e_3    conda-forge
xarray                    2022.6.0           pyhd8ed1ab_1    conda-forge
xcb-util                  0.4.0                h166bdaf_0    conda-forge
xcb-util-image            0.4.0                h166bdaf_0    conda-forge
xcb-util-keysyms          0.4.0                h166bdaf_0    conda-forge
xcb-util-renderutil       0.3.9                h166bdaf_0    conda-forge
xcb-util-wm               0.4.1                h166bdaf_0    conda-forge
xerces-c                  3.2.3                h55805fa_5    conda-forge
xesmf                     0.3.0                      py_0    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-inputproto           2.3.2             h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxi                1.7.10               h7f98852_0    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxt                1.2.1                h7f98852_2    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zarr                      2.12.0             pyhd8ed1ab_0    conda-forge
zict                      2.2.0              pyhd8ed1ab_0    conda-forge
zipp                      3.8.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.12               h166bdaf_2    conda-forge
zstd                      1.5.2                h8a70e8d_2    conda-forge
Marston commented 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.

anissa111 commented 2 years ago

Hello @Marston! This is currently being looked in to and will be addressed soon. Thank you for reporting this issue!

anissa111 commented 2 years ago

@Marston, this has been addressed, thank you! We will be reviewing similar changes for more docstrings in this project imminently.

anissa111 commented 2 years ago

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.

Marston commented 2 years ago

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.

anissa111 commented 2 years ago

@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.

Marston commented 2 years ago

Hi,

Thanks. Could you post the exact call to the function that works for you?

Marston commented 2 years ago

Btw, when is the next release with the latest bug fixes?

anissa111 commented 2 years ago

@Marston there will be a geocat-f2py release this month with the docstring fix. I can ping this thread again when it is released.

anissa111 commented 2 years ago

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?

Marston commented 2 years ago

Hi,

Yes, yes it does. Thank you. Please let me know how this project is developing.

anissa111 commented 2 years ago

Will do! Also feel free to submit requests for any functions from ncl you use and check out the GeoCAT blog!