Problem with Pa/hPa units in GUI level selection

Issue #208 resolved
Andreas Hilboll created an issue

I'm having trouble with a netCDF file containing isopressure levels in units of Pa (When I had units in hPa, the vertical sections didn't work properly).

The problem is that in the GUI, in the level dropdown menu, it now says things like 100000.0 (hPa).

This is the netCDF file's metadata:

netcdf CAMSTr_London_2017-07-09_00_pl_co {
dimensions:
    longitude = 177 ;
    latitude = 101 ;
    level = 10 ;
    time = UNLIMITED ; // (41 currently)
variables:
    float longitude(longitude) ;
        longitude:standard_name = "longitude" ;
        longitude:long_name = "longitude" ;
        longitude:units = "degrees_east" ;
        longitude:axis = "X" ;
    float latitude(latitude) ;
        latitude:standard_name = "latitude" ;
        latitude:long_name = "latitude" ;
        latitude:units = "degrees_north" ;
        latitude:axis = "Y" ;
    double level(level) ;
        level:long_name = "pressure_level" ;
        level:positive = "down" ;
        level:axis = "Z" ;
        level:standard_name = "atmosphere_pressure_coordinate" ;
        level:units = "Pa" ;
    float time(time) ;
        time:long_name = "time" ;
        time:calendar = "standard" ;
        time:axis = "T" ;
        time:units = "hours since 2017-07-09T00:00:00" ;
        time:standard_name = "time" ;
    float p26.212(time, level, latitude, longitude) ;
        p26.212:long_name = "Experimental product" ;
        p26.212:units = "~" ;
        p26.212:missing_value = -32767.f ;
        p26.212:standard_name = "mass_fraction_of_carbon_monoxide_in_air" ;

// global attributes:
        :CDI = "Climate Data Interface version 1.7.2 (http://mpimet.mpg.de/cdi)" ;
        :Conventions = "CF-1.6" ;
        :history = "Sun Jul 09 17:03:09 2017: cdo -b F32 copy 20170709_tracer4emerge_pl.nc /exthomes/gomzo2/home2/annebl/Tracer-Runs/20170709_tracer4emerge_pl.nc\n",
            "2017-07-09 14:44:07 GMT by grib_to_netcdf-2.1.0: grib_to_netcdf /scratch/ms/datex/gdba/tracer-runs/20170709_tracer4emerge_pl.grb -o /scratch/ms/datex/gdba/tracer-runs/20170709_tracer4emerge_pl.nc -utime" ;
        :CDO = "Climate Data Operators version 1.7.2 (http://mpimet.mpg.de/cdo)" ;
data:

 level = 10000, 20000, 30000, 40000, 50000, 60000, 70000, 85000, 92500, 100000 ;
}

Comments (9)

  1. Joern Ungermann

    What vertical/horizontal sections were used in combination with the file? AFAIK, MSS does not do any unit conversion internally. This implies that the Plot routines need to take care of any needed conversion. We use hPa files for CLaMS and CAMS data, but have a multiplication with 100 in the VSec Plotting to convert to the needed Pa. The VS_MSSChemStyle style seems to be missing that unit conversion (there is a TODO comment where the multiplication would take place...).

    In fact, the vertical plot needs to use Pascal for the y-axis of the plot and needs to manually convert the data if required.

    With respect to the level fiel for horizontal plots, MSS currently hard codes that value to hPa regardless of the units employed in the file. I would classify this as bug, which I would fix in the current stable (including a fallback to hPa in case of no units attribute being present). For altitude and potential temperature as vertical coordinate, the NetCDF units field is already evaluated and we should do and require this here as well.

    Does this help you?

  2. Andreas Hilboll reporter

    yes, thanks, @joernu76 . That was indeed a VS_MSSChemStyle, and I remember that TODO I'll have to look into...

    As for fixing the display bug, I just submitted pull request #398

  3. Reimar Bauer

    In General if we want to use a Units conversion Tool we should discuss a proposal before. Likly this is a User Level Feature.

  4. Joern Ungermann

    Conversion is a user issue. However, there is no good documentation with respect to generating new plotting styles and that vertical sections need to be plotted in Pa. I like the merge request and it fixes the major issue I see here.

  5. Andreas Hilboll reporter

    Before merging this: should I also do the try: ... except: thing for the isopottemp and isoalt cases, just to be consistent?

  6. Joern Ungermann

    Not necessarily. I think that requiring the unit field is more than sensible. For pressure we should retain the old functionality for compatability reasons, but I do not think we should relax our requirements other file types.

  7. Andreas Hilboll reporter

    "old functionality" means explicitly put in "hPa" and "1E-3 PVU"? Sure, can do that, if you prefer.

  8. Joern Ungermann

    Maybe that would be preferable. "unknown" is fine, too. But crashing the server where it worked previously, I would not like.

  9. Log in to comment