Re: regarding the retention of coordinate variables

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 19 2013 - 21:25:02 MDT

Hi Danny,

This is a good question.

Copying over coordinate data and/or attributes can be an expensive operation, both time-wise and memory-wise, especially if you have large arrays and/or lots of arrays.

I believe it was a conscious decision when NCL was first being developed to have this NOT be the default behavior, and to let the user manage this.

We do provide special _Wrap versions of some functions which copy over meta data, but unfortunately not for the ones that you listed.

It may not be very hard to add your own _Wrap versions of the functions you listed.

Look at the fie:

$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl

and search for "_Wrap ("

You will see that all of these functions have corresponding "_Wrap" versions that work exactly the same as their non-_Wrap counterparts, except they add metadata:

area_conserve_remap_Wrap
area_hi2lores_Wrap
cssgrid_Wrap
dim_avg_Wrap
dim_avg_n_Wrap
dim_avg_wgt_Wrap
dim_avg_wgt_n_Wrap
dim_cumsum_Wrap
dim_cumsum_n_Wrap
dim_max_n_Wrap
dim_min_n_Wrap
dim_rmsd_Wrap
dim_rmsd_n_Wrap
dim_rmvmean_Wrap
dim_rmvmean_n_Wrap
dim_rmvmed_Wrap
dim_rmvmed_n_Wrap
dim_standardize_Wrap
dim_standardize_n_Wrap
dim_stddev_Wrap
dim_stddev_n_Wrap
dim_sum_Wrap
dim_sum_n_Wrap
dim_sum_wgt_Wrap
dim_sum_wgt_n_Wrap
dim_variance_Wrap
dim_variance_n_Wrap
dv2uvF_Wrap
dv2uvG_Wrap
eofcor_Wrap
eofcor_pcmsg_Wrap
eofcor_ts_Wrap
eofcov_Wrap
eofcov_pcmsg_Wrap
eofcov_ts_Wrap
eofunc_Wrap
eofunc_ts_Wrap
eofunc_varimax_Wrap
f2fosh_Wrap
f2foshv_Wrap
f2fsh_Wrap
f2fshv_Wrap
f2gsh_Wrap
f2gshv_Wrap
fo2fsh_Wrap
fo2fshv_Wrap
g2fsh_Wrap
g2fshv_Wrap
g2gsh_Wrap
g2gshv_Wrap
ilapsF_Wrap
ilapsG_Wrap
int2p_Wrap
int2p_n_Wrap
linint1_Wrap
linint1_n_Wrap
linint2_Wrap
natgrid_Wrap
obj_anal_ic_Wrap
rcm2rgrid_Wrap
rgrid2rcm_Wrap
shsgc_R42_Wrap
triple2grid_Wrap
uv2dvF_Wrap
uv2dvG_Wrap
uv2vrF_Wrap
uv2vrG_Wrap
vr2uvF_Wrap
vr2uvG_Wrap
wgt_areaave_Wrap
zonal_mpsi_Wrap

You might be able to use one of these as a template for adding your own _Wrap versions of the functions you enquired about.

--Mary

On Aug 19, 2013, at 3:17 PM, Daniel Barandiaran <dbarandiaran@gmail.com> wrote:

> Hi NCLers,
>
> This question is specifically for the developers. In my work I make frequent use for functions such as escorc, regCoef, center_finite_diff_n, and I am sure there are others for which my problem is applicable, but they slip my mind at the moment. Anyway, my question is this: these functions do not retain the coordinate variables in the output; why not? I am sure there is a reason for this, and I am also well-aware of tricks like copy_VarCoords, or pre-assigning the variable name in such a way that coordinate variables are assigned before the desired function is used, but this adds lines to my code. I have been on a quest, if you will, to make my codes shorter and sleeker, and this is a frequent thorn in my side. Maybe I am being too nit-picky, and I have no doubt that you all have more pressing things on your plate than to satisfy the desires of my quest for short code, but I am curious as to why this wasn't worked into functions such as this in the first place. No hur
 ry on this one, and as always I greatly appreciate all the work you guys do for all of us NCL users.
>
> --
> Danny Barandiaran
> Department of Plants, Soils, and Climate
> Utah State University
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 19 21:24:58 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 21 2013 - 13:54:15 MDT