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
125 stars 56 forks source link

NCL to GeoCAT External Reference #490

Open cyschneck opened 1 year ago

cyschneck commented 1 year ago

Describe the feature you'd like added to this project Set up public documentation for converting from NCL to GeoCAT

Links for functions that:

kafitzgerald commented 1 year ago

This is a few steps ahead (and maybe some scope creep), but we should make sure this is updated / referenced in a few existing locations (especially since some of the current references are a bit dated):

cyschneck commented 9 months ago

Include links for #295 as external documentation

Currently to find geocat-comp functions that correspond to NCL functions, users have to search the -comp documentation.

It would be nice to link relevant geocat-comp function documentation in the NCL documentation.

cyschneck commented 8 months ago

Look into housing as part of geocat-application with documentation/code examples/external links for NCL->Python transition document

cyschneck commented 7 months ago

164 Functions Flagged for Built-In Python or simple implementations that do not require full functional replication in GeoCAT. Good potential starting place for application guide

NCL Function | Python Implementation
-- | --
abs | abs(x)
addfile | open(x)
all | all(x)
any | any(x)
atan | math.atan
atan2 | math.atan2
avg | statistics.fmean or statistics.mean
byte2flt | struct.unpack
byte2flt_hdf | struct.pack
cbinread | struct.unpack
cbinwrite | struct.pack
ceil | math.ceil
changeCaseChar | str.lower(), str.upper()
cos | math.cos(x)
cshstringtolist | str.split(x)
decimalPlaces | round()
dim_product | math.product()
dim_product_n | math.product()
dim_stddev | statistics.stdev()
dim_stddev_n | statistics.stdev()
dim_stddev_n_Wrap | statistics.stdev()
dim_stddev_Wrap | statistics.stdev()
dim_sum | math.fsum()
dim_sum_n | math.fsum()
dim_sum_n_Wrap | math.fsum()
dim_sum_Wrap | sum()
dim_variance | statistics.variance()
dim_variance_n | statistics.variance()
dim_variance_n_Wrap | statistics.variance()
dim_variance_Wrap | statistics.variance()
erf | math.erf()
exit | exit()
exp | math.exp(x)
fabs | abs(x)
fbindirread | open()
fbindirwrite | bytearray()
fileattdef | Python global variables
floattochar | str()
floattocharacter | str()
floattoint | int()
floattointeger | int()
get_cpu_time | time.process_time()
get_file_suffix | os.path.splittext
get_ncl_version | sys.version_info
get_pi | math.pi
get_script_name | os.path.basename(__file__)
get_script_prefix_name | os.path.basename(__file__)
getfileatts | os.scandir()
getfilepath | os.path.realpath(file.name)
int2dble | float()
int2flt | float()
integertobyte | int.to_bytes
integertochar | chr()
integertocharacter | chr()
integertoshort | c_ushort
inttobyte | int.to_bytes
inttochar | chr()
inttoshort | c_ushort
ischar | char == str
isfile | is_file
isfloat | isinstance(x, float)
isint | isinstance(x, int)
isinteger | isinstance(x, int)
islogical | isinstance(x, bool)
isstring | isinstance(x, str)
isStrSubset | b in a
ListAppend | list.append()
ListCount | len()
ListGetType | type()
ListIndex | list.index(x)
ListIndexFromName | list.index(x)
ListPop | list.pop()
ListPush | list.append()
log | math.log()
log10 | math.log10()
longtobyte | int.to_bytes()
longtoint | int()
longtointeger | int()
NewList | list()
num | sum([True, False])
numeric2int | int()
print | print()
print_clock | datetime()
print_table | str.format()
printMinMax | max()
product | product()
qsort | sort()
rand | random.random
replace_ieeenan | str.replace()
rgbhls | colorsys.rgb_to_hls
rgbhsv | colorsys.rgb_to_hsv
rgbyiq | colorsys.rgb_to_yiq
round | round()
sleep | time.sleep()
sprintf | str.format
sprinti | str.format
sqrt | math.sqrt()
srand | random.seed()
str_capital | str.upper()
str_concat | str.join()
str_fields_count | count()
str_get_dq | str.join()
str_get_nl | str()
str_get_sq | str()
str_get_tab | str()
str_index_of_substr | str.find()
str_insert | str.join()
str_is_blank | bool()
str_join | str.join()
str_left_strip | strip()
str_lower | lower()
str_match | any()
str_match_bool | [query in e for e in list]
str_match_bool_ic | [query in e for e in list]
str_match_ic | any()
str_match_ic_regex | any()
str_match_ind | any()
str_match_ind_ic | str.find()
str_match_ind_ic_regex | str.find()
str_match_ind_regex | str.find()
str_match_regex | any()
str_right_strip | strip()
str_split | split()
str_split_by_length | Possible Implementation
str_split_csv | split()
str_squeeze | strip()
str_strip | strip()
str_sub_str | replace()
str_switch | swapcase()
str_upper | str.upper()
stringtochar | list()
stringtocharacter | list()
stringtofloat | float()
stringtoint | int()
stringtointeger | int()
strlen | len()
sum | sum()
symMinMaxPlt | min() and max()
tan | math.tan()
tanh | math.tanh()
tdsort | sort()
tochar | str()
todouble | float()
tofloat | float()
toint | int()
toint64 | int()
tointeger | int()
tolong | int()
toshort | int()
tosigned | int()
tostring | str()
tostring_with_format | str()
totype |  
toubyte | int()
touint | int()
touint64 | int()
toulong | int()
tounsigned | int()
toushort | int()
typeof | type()
ushorttoint | int()
venn2_difference | symmetric_difference
venn2_intersection | list(set(a) & set(b))
venn2_union | list_a + list_b