[ncl-talk] how to read off multiple variables from a nc file through one reading operation within a loop

Tabish Ansari tabishumaransari at gmail.com
Thu Oct 25 05:46:33 MDT 2018


Hi,

I want to read in several variables, in my case emissions of chemical
species, from a netcdf file.

There are too many variables in the file, eg- E_PM25I, E_PM25J, E_CO, E_NO2
etc
Is it possible to store them in a string array and supply them one by one
to the reading function?

Currently, I'm unable to do this due to datatype mismatch.

I'm trying something like this:








*begina=addfile("/data3/tabish/vert-MEIC-emis/APEC-wrfchemi/wrfchemi_00z_d03_total_Oct_8lev_0.5BTHso2_so4_allnormal.nc
<http://wrfchemi_00z_d03_total_Oct_8lev_0.5BTHso2_so4_allnormal.nc>","r")pm25
= a->E_PM25J(0,0,:,:)print("var read in the normal way")var = "E_PM25J"pm25
= a->var(0,0,:,:)print("var read in dynamic way")end*

however, the string variable var isn't used in the reading process.

Please let me know if there's a way in NCL to do this.
This will make the algorithm much more efficient.

Cheers,

Tabish

Tabish U Ansari
PhD student, Lancaster Environment Center
Lancaster Univeristy
Bailrigg, Lancaster,
LA1 4YW, United Kingdom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181025/d223c8c1/attachment.html>


More information about the ncl-talk mailing list