Question

Convert Polar Coords in NetCDF

  • 22 February 2018
  • 2 replies
  • 1 view

Hi, I am pretty new to FME and trying to get my head around the new NetCDF sSupport.

I have a NetCDF 4 file with two raster bands: MEAN_WIND (magnitude) and MEAN_WIND_DIR (radians). I need to convert this to two new raster bands U and V. I.e. a vector equivalent to the input bands.

The math is like this:

mean_uwave = Math.Cos( mean_wave_dir * 2 * Math.PI / 360.0 );

mean_vwave = Math.Sos( mean_wave_dir * 2 * Math.PI / 360.0 );

But how would I apply this calculation to NetCDF files?

Thanks.

Garth


2 replies

Userlevel 2
Badge +17

As the IFC property sets are configured in other systems i do not have prior knowledge of the attributes to expose these for the writers. I need to be able to feature attribute cleanup so that i can expose these attribute collections without prior knowledge of the feature information.

I have successfully exposed the attributes from the collections as a feature attribute but these are still hidden from the writer. I am able to interrogate each feature and build a picture of those attributes in Python but cannot seem to expose these programmatically. 

 

def processFeature(feature):
    print("**Processing feature**")
    print(feature.getAttribute('ifc_property_set'))
    #ifcpropertieslist = feature.getAttribute('ifc_properties')
    print(feature.getAllAttributeNames())
    i=0
    attrNames=feature.getAllAttributeNames()
    elementCount = int(feature.getAttribute("_element_count"))
    print(elementCount)
    exposeAttrsNames={}
    for i in range(elementCount):
        attrname = "ifc_properties{"+str(i)+"}.name"
        #print(attrname)
        #print(feature.getAttribute(attrname))
        featAttrName = feature.getAttribute(attrname)
        
        exposeAttrsNames[featAttrName] = feature.getAttribute(featAttrName)
    print(exposeAttrsNames)
    pass

Excuse the disorganization its a work in progress

FMEIFCAttr 

 Any ideas would be apricated. 

Hi @gtissington,

You can use the RasterExpressionEvaluator transformer to create the new bands and perform the calculations. For examples on how to use the transformer, please see this article.

OK. I can see how that is part of the solution.

 

 

Sadly, I guess I don't even understand my own data very well.

 

 

The problem is that actually 'mean_wave' and 'mean_wave_dir' are NetCDF variables. Each of these variables has 360 raster bands (each band is lat/lon indexed).

 

 

So, in the RasterExpressionEvaluator I need to process all bands for both variables

 

 

i.e.

 

for each band(A,B) in (mean_wave, mean_wave_dir)

 

u = A * @sin( B * 2 * PI * 360 )

 

v = A * @cos( B * 2 * PI * 360 )

 

 

 

I tried a raster band separator before the expression evaluator but it throws an error saying only one "A" dataset can be supplied

 

Any other suggested are very much appreciated.

 

Thanks in advance,

 

Garth

 

 

 

Reply