Re: Visualising categorical vegetation data

From: Saji Hameed <saji.nh_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 27 2010 - 06:56:23 MDT

Hi Will,

About your second question, see
http://ncl.ucar.edu/Applications/classification.shtml These describe ways to
plot categorical data.

Parts of your first problem (question) are confusing. Especially it is not
clear how one may use onedtond to derive a subset. Since the data is in CSV
format (not on a grid), you may have to first define your grid and fill up
the grid appropriately from information in the CSV file.

For e.g. veg=new( (/ntim,nlat,nlon/), float)
veg!0="year"
veg&year = all_years

where all_years is found by finding unique years in the 'year' array and
then sorting the result. Same way for the other coordinates lat and lon.

Then while iterating through your varname array, you will fill up the veg
array at the right places
do isiz=0,dimsizes(varname)-1
  veg({year(i)},{lat(i)},{lon(i)} =varname(i)
end do

This approach will possibly take for ever. Hopefully there is a better
solution from others..

cheers,

saji

On Tue, Oct 26, 2010 at 5:58 AM, Willow S Hallgren <hallgren@mit.edu> wrote:

> Hi,
>
> I have some very large ascii (csv) files (approx 9.9 gb each) and I'm
> trying to write an NCL script to (a) create a subset of them, and output
> this to a netcdf file, and (b) visualise them.
>
> I've done (a) via the code:
>
> filename = "/dir/XYZ_dataset.csv"
> lines = asciiread(filename,-1,"string")
> delim = ","
> lon = str_get_field(lines,1,delim)
> lat = str_get_field(lines,2,delim)
> varname = str_get_field(lines,3,delim)
> year = str_get_field(lines,4,delim)
> potveg =str_get_field(lines,9,delim)
>
> I then convert data types from string to whatever they're supposed to be
> using the NCL type converter functions
>
> e.g. lon_f = stringtofloat(lon)
>
> I then create a subset using the onedtond function; subset = (/var 1,var 3,
> var 5/) etc...
>
> When I print this subset, it gives me a long list of values with their
> column and row numbers.
>
> My questions are:
>
> - Is there an easy way I can write this subset of ascii data to netcdf
> format?
>
> - how would I visualise this data? basically I want to be able to draw a
> map of vegetation classes on a global grid. - how would I go about doing
> this - none of the plot types I've come across seem to do what I want...
>
> Thanks in advance if anyone can give me some pointers....
>
> Regards,
> Wil
> _______________________________________________
> 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 Wed Oct 27 06:56:30 2010

This archive was generated by hypermail 2.1.8 : Fri Oct 29 2010 - 13:09:32 MDT