conda-forge / iris-grib-feedstock

A conda-smithy repository for iris-grib.
BSD 3-Clause "New" or "Revised" License
0 stars 10 forks source link

Convert netcdf to grib problem #18

Closed taoansf closed 5 years ago

taoansf commented 5 years ago

Hello,

I'm looking for a solution to conversion from netcdf SST-MUR data to grib2 format

This is my code that I'm running with miniconda python3

#! /usr/bin/env python
import iris
cubes = iris.load('2015-01-15.nc')       # each variable in the netcdf file is a cube
data=cubes[0]

data.coord(axis='X').coord_system=iris.coord_systems.GeogCS(4326)
data.coord(axis='Y').coord_system=iris.coord_systems.GeogCS(4326)
print (data)
iris.save(data,'2015-01-15.grib2')  # save a specific variable to grib

Python gives me this message 
sea_surface_foundation_temperature / (kelvin) (time: 1; latitude: 1144; longitude: 1137)
     Dimension coordinates:
          time                                     x            -                -
          latitude                                 -            x                -
          longitude                                -            -                x
     Attributes:
          comment: "Final" version using Multi-Resolution Variational Analysis (MRVA) method...
          source: AVHRR19_G-NAVO, AVHRR_METOP_A-EUMETSAT, MODIS_A-JPL, MODIS_T-JPL, WSAT-REMSS,...
          valid_max: 32767
          valid_min: -32767
/home/taoan/miniconda3/lib/python3.7/site-packages/iris_grib/_save_rules.py:719: UserWarning: Unable to determine Grib2 parameter code for cube.
discipline, parameterCategory and parameterNumber have been set to "missing".
  warnings.warn('Unable to determine Grib2 parameter code for cube.\n'
/home/taoan/miniconda3/lib/python3.7/site-packages/iris_grib/_save_rules.py:1462: UserWarning: Unable to determine Grib2 parameter code for cube.
Message data may not be correctly scaled.
  warnings.warn('Unable to determine Grib2 parameter code for cube.\n'

This is my input data 2015-01-15-netcdf.zip

This is my output 2015-01-15-grib2.zip

I believe that the problem can be related with the grib rules for metada, but I don't know how to set this for my grib output. Any suggestions on how to help me with this problem will be greatly appreciated.

With best regards,

Taoan

ocefpaf commented 5 years ago

This is a usage questions. This repository is for the conda package and package related issued. You'll have better luck asking on StackOverflow or mailing lists about the topic.

taoansf commented 5 years ago

Ok, thank you! I will follow your suggestion.