Map coefficient of variation (CV) and standard deviation (STD)

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
jcfischer
Posts: 47
Joined: Wed Aug 23, 2017 12:23 pm America/New_York
Answers: 0

Map coefficient of variation (CV) and standard deviation (STD)

by jcfischer » Fri Feb 02, 2018 5:17 am America/New_York

Dear colleagues,
the command combination l2bin + l3mapgen enables the creation of level 3 mapped image files out of level 2 files. The combined run of those two commands will result in mapped images of the mean of a selected product (in my case Kd_490) representing an indicated period of time (e.g. days, 8-days, months, years, ...). I would like to know whether there is an opportunity in SeaDAS to create the similar files but this time mapping the coefficient of variation (CV) and the standard variation (STD).
This information is already there but how can I display those two statistical variables in a map like the one for the mean? Is there a way to calculate this from the created mean files or how else can this be done?
Thanks in advance! Your help is highly appreciated. Greetings, JC

Filters:

OB.DAACx - SeanBailey
Posts: 1519
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 9 times

Map coefficient of variation (CV) and standard deviation (STD)

by OB.DAACx - SeanBailey » Fri Feb 02, 2018 9:34 pm America/New_York

The l3mapgen program can generate maps of the standard deviation:
   product (string) = comma separated list of products.
        Each product can have an optional colon and modifier appended.
        For example  product=chlor_a,chlor_a:stdev,Kd_490:nobs
        The avaliable modifiers are:
            avg       average value (default)
            stdev     standard deviation
            var       variance
            nobs      number of observations in the bin
            nscenes   number of contributing scenes
            obs_time  average observation time (TAI93)
            bin_num   bin ID number


For CV, you'll need to do the math in SeaDAS using the Band Math function (output the mean and stdev with l3mapgen and compute CV from them).

Sean

jcfischer
Posts: 47
Joined: Wed Aug 23, 2017 12:23 pm America/New_York
Answers: 0

Map coefficient of variation (CV) and standard deviation (STD)

by jcfischer » Mon Feb 05, 2018 1:59 pm America/New_York

Dear Sean,
I thank you for the answer! This is very helpful.

The way to calculate the coefficient of variation is nevertheless not that handy... I would like to do this all in one. This might be easier using R? Did anybody map the mean, the standard deviation and the coefficient of variation of an ocean color product with R? I need to process data from 2002 until 2017. Therefore, this might be the better option for my case. I would be happy about some hints and advice.
Thanks a lot!

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has thanked: 1 time

Map coefficient of variation (CV) and standard deviation (STD)

by gnwiii » Mon Feb 05, 2018 5:14 pm America/New_York

While you can work with binned files using R, it is very slow compared to l3mapgen.   You can use R's raster library to read the avg and stdev files and compute the CV in a raster, but if you simply save the resulting raster to netcdf it won't have all the metadata details of the input files. 

Do you need stdev as a data grid or just to produce a images? 

If you need data files, there are many batch-oriented tools to manipulate NetCDF4-CF data.   Have a look at NCO and CDO -- both are available in Ubuntu 16.04 and probably other linux distros.  With lower level tools (the R ncdf4 library, Matlab, or Python with the Unidata netcdf4-python, among many) you can compute a new raster and add it as a new band to an existing NetCDF file, but this requires some effort and time to become familiar with the tools.

There are many tools to create images from NetCDF data grids.  Many of these (including R, Matlab, Python, ncarg/ncl) support calculations on data grids, so you could read a NetCDF file with <prod>:avg and <prod>:stdev and then generate images for these two products directly and also compute the values and save to a <prod>:CV image.  There are differences in these tools in the support for color, palettes, coastlines and land masks, etc. so you should look at examples and chose one that produces suitable images for your needs.

jcfischer
Posts: 47
Joined: Wed Aug 23, 2017 12:23 pm America/New_York
Answers: 0

Map coefficient of variation (CV) and standard deviation (STD)

by jcfischer » Tue Feb 13, 2018 12:39 am America/New_York

Thanks for answering and providing all the useful information!
I need to produce images of the vlaues of the standard deviation and managed to do this with the raster and ncdf4 library in R.
Greetings, JC

Post Reply