Skip to content

Can not make wind plot using mnetcdf,mwind. #36

@RyosukeDTomita

Description

@RyosukeDTomita

problem fixed!

Hi!
I want to make vector figure to display netcdf wind data.
So, I write a code showing below.

from Magics.macro import *
ncfile = "../data/surface_2020-12-28_0" #netcdf
output = output(
                output_formats                = ['png'],
                output_name                   = "windtest",
                output_name_first_page_number = "off",
                output_width                  = 800)
center = page(
             layout           = 'automatic',
             page_x_length    = 45.,
             page_y_length    = 20.,
             page_id_line     = 'off',# erase ECMWF logo↲
             page_x_position  = 0.,
             page_y_position  = 0.,)
area = mmap(
            subpage_map_projection        = "cylindrical",
            subpage_lower_left_longitude  = 120,
            subpage_lower_left_latitude   = 25,
            subpage_upper_right_longitude = 150,
            subpage_upper_right_latitude  = 50,)

coast = mcoast(
            map_coastline_land_shade         = "on",
            map_coastline_land_shade_colour  = "cream",
            map_grid_line_style              = "dash",
            map_grid_colour                  = "charcoal",
            map_grid_thickness               = 2.0,
            map_grid_latitude_increment      = 10,
            map_grid_longitude_increment     = 10,
            map_label                        = "on",
            map_coastline_colour             = "black",
            map_coastline_thickness          = 2.7,
            )
# My problem!
vector = mnetcdf(
        netcdf_type                 = "vector",
        netcdf_filename             = ncfile,
        netcdf_x_component_variable = "u10", #something wrong?
        netcdf_y_component_variable = "v10", #something wrong?
        )

wind = mwind(
        legend                = "on",
        wind_field_type       = "arrows",
        wind_arrow_thickness  = 1,
        wind_thinning_factor  = 1,
        wind_arrow_calm_below = 0.5, # min
        wind_arrow_head_ratio = 0.3,
        wind_arrow_colour     = 'evergreen',)
plot(center,output,area,coast,vector,wind)

Then, I run this code. Unkown Error is occured.↓

# error
Magics-warning: Netcdf MagException:  Can not find variable ---> x
Magics-ERROR: Netcdf MagException:  Can not find variable ---> x

I think "netcdf_x_component_variable" is needed other information but, I'm not sure what kind of information is needed.

Here is information of data .
I tryid to replace "u10" "v10" to 1,2(index number), but I cannot fix this problem.

$ cdo infon data/surface_2020-12-28_0
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 2020-12-28 00:00:00       0   259920       0 :     -23.178   -0.059718      22.385 : u10           
     2 : 2020-12-28 00:00:00       0   259920       0 :     -23.545    -0.27896      23.001 : v10           
     3 : 2020-12-28 00:00:00       0   259920       0 :      220.35      276.99      310.51 : t2m           
     4 : 2020-12-28 00:00:00       0   259920       0 :      5.0713      82.041      100.01 : r2            
     5 : 2020-12-28 00:00:00       0   259920       0 :      94224.  1.0107e+05  1.0836e+05 : prmsl         
     6 : 2020-12-28 00:00:00       0   259920       0 :      48682.      96751.  1.0571e+05 : sp            
     7 : 2020-12-28 00:00:00       0   259920       0 :      0.0000      36.312      100.00 : lcc           
     8 : 2020-12-28 00:00:00       0   259920       0 :      0.0000      22.342      100.00 : mcc           
     9 : 2020-12-28 00:00:00       0   259920       0 :      0.0000      21.905      100.00 : hcc           
cdo    infon: Processed 9 variables over 1 timestep [0.03s 53MB].

I also gogled this problem but, I cannot find answer.
If you have the idea to fix this problem, plase tell me.
※My environment is macOS catarina and Ubuntu20.04, python3 version is 3.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions